/* ========================================
   Doctolib Scraper — Light / Dark Interface
   ======================================== */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=JetBrains+Mono:wght@300;400;500&display=swap');

/* ---- Light mode (default) ---- */
:root {
    --bg-base: #f5f6f8;
    --bg-raised: #ffffff;
    --bg-surface: #f0f1f4;
    --bg-surface-hover: #e8e9ed;
    --bg-overlay: rgba(255, 255, 255, 0.85);
    --border-subtle: rgba(0, 0, 0, 0.06);
    --border-medium: rgba(0, 0, 0, 0.12);
    --text-primary: #1a1d26;
    --text-secondary: #5a5f72;
    --text-muted: #8b90a0;
    --accent: #4f6fdf;
    --accent-soft: rgba(79, 111, 223, 0.1);
    --accent-glow: rgba(79, 111, 223, 0.15);
    --green: #1a9960;
    --green-soft: rgba(26, 153, 96, 0.1);
    --red: #dc4444;
    --red-soft: rgba(220, 68, 68, 0.08);
    --yellow: #b8860b;
    --yellow-soft: rgba(184, 134, 11, 0.1);
    --purple: #7c5cbf;
    --purple-soft: rgba(124, 92, 191, 0.1);
    --header-bg: rgba(255, 255, 255, 0.8);
    --header-border: rgba(0, 0, 0, 0.06);
    --log-bg: #1a1d26;
    --log-scrollbar: rgba(0, 0, 0, 0.1);
    --log-scrollbar-hover: rgba(0, 0, 0, 0.2);
    --font-body: 'DM Sans', -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', 'SF Mono', monospace;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --shadow-card: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-card-hover: 0 4px 12px rgba(0,0,0,0.08);
    --noise-opacity: 0;
}

/* ---- Dark mode ---- */
.dark {
    --bg-base: #0c0e14;
    --bg-raised: #13161f;
    --bg-surface: #1a1e2b;
    --bg-surface-hover: #212636;
    --bg-overlay: rgba(19, 22, 31, 0.85);
    --border-subtle: rgba(255, 255, 255, 0.08);
    --border-medium: rgba(255, 255, 255, 0.14);
    --text-primary: #edf0f7;
    --text-secondary: #a3a8ba;
    --text-muted: #6e7489;
    --accent: #6c8cff;
    --accent-soft: rgba(108, 140, 255, 0.12);
    --accent-glow: rgba(108, 140, 255, 0.25);
    --green: #3dd68c;
    --green-soft: rgba(61, 214, 140, 0.12);
    --red: #ff6b6b;
    --red-soft: rgba(255, 107, 107, 0.12);
    --yellow: #fbbf24;
    --yellow-soft: rgba(251, 191, 36, 0.12);
    --purple: #a78bfa;
    --purple-soft: rgba(167, 139, 250, 0.12);
    --header-bg: rgba(12, 14, 20, 0.8);
    --header-border: rgba(255, 255, 255, 0.06);
    --log-bg: #0c0e14;
    --log-scrollbar: rgba(255,255,255,0.08);
    --log-scrollbar-hover: rgba(255,255,255,0.15);
    --shadow-card: none;
    --shadow-card-hover: none;
    --noise-opacity: 0.025;
}

*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: var(--font-body);
    background: var(--bg-base);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background 0.3s ease, color 0.3s ease;
}

/* Noise grain overlay (dark mode only) */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 9999;
    pointer-events: none;
    opacity: var(--noise-opacity);
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 256px 256px;
}

/* ---- Glass panels ---- */
.glass-panel {
    background: var(--bg-raised);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    transition: background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}
.dark .glass-panel {
    backdrop-filter: blur(20px);
}
.glass-panel-inset {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    transition: background 0.3s ease, border-color 0.3s ease;
}

/* ---- Glow effects ---- */
.glow-accent {
    box-shadow: 0 0 20px var(--accent-glow), 0 4px 24px rgba(0,0,0,0.1);
}
.dark .glow-accent {
    box-shadow: 0 0 20px var(--accent-glow), 0 4px 24px rgba(0,0,0,0.4);
}

/* ---- Custom Inputs ---- */
.input-field {
    background: var(--bg-surface);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-body);
    padding: 10px 14px;
    font-size: 14px;
    transition: all 0.2s ease;
    outline: none;
    width: 100%;
}
.input-field::placeholder {
    color: var(--text-muted);
}
.input-field:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.input-field-sm {
    padding: 7px 10px;
    font-size: 13px;
}

select.input-field {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238b90a0' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

/* ---- Buttons ---- */
.btn-primary {
    background: var(--accent);
    color: #fff;
    font-weight: 600;
    font-family: var(--font-body);
    border: none;
    border-radius: var(--radius-sm);
    padding: 10px 20px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.btn-primary:hover:not(:disabled) {
    filter: brightness(1.1);
    box-shadow: 0 0 16px var(--accent-glow);
}
.btn-primary:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    font-weight: 500;
    font-family: var(--font-body);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-sm);
    padding: 8px 16px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.btn-ghost:hover {
    background: var(--bg-surface-hover);
    color: var(--text-primary);
}

.btn-danger {
    background: var(--red-soft);
    color: var(--red);
    font-weight: 500;
    font-family: var(--font-body);
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    padding: 8px 16px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
}
.btn-danger:hover {
    filter: brightness(1.1);
}

.btn-green {
    background: var(--green-soft);
    color: var(--green);
    font-weight: 500;
    font-family: var(--font-body);
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    padding: 8px 16px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
}
.btn-green:hover {
    filter: brightness(1.1);
}

/* ---- Toggle Mode Buttons ---- */
.mode-btn {
    background: var(--bg-surface);
    color: var(--text-secondary);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-sm);
    padding: 8px 20px;
    font-size: 13px;
    font-weight: 500;
    font-family: var(--font-body);
    cursor: pointer;
    transition: all 0.2s ease;
    flex: 1;
    text-align: center;
}
.mode-btn:hover {
    background: var(--bg-surface-hover);
}
.mode-btn.active {
    background: var(--accent-soft);
    color: var(--accent);
    border-color: var(--accent);
}

/* ---- Status badges ---- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 100px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.02em;
}
.badge-running {
    background: var(--yellow-soft);
    color: var(--yellow);
}
.badge-completed {
    background: var(--green-soft);
    color: var(--green);
}
.badge-failed {
    background: var(--red-soft);
    color: var(--red);
}
.badge-cancelled {
    background: var(--bg-surface);
    color: var(--text-muted);
}
.badge-pending {
    background: var(--accent-soft);
    color: var(--accent);
}

/* ---- Progress bar ---- */
.progress-track {
    height: 4px;
    background: var(--bg-surface);
    border-radius: 100px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    border-radius: 100px;
    background: linear-gradient(90deg, var(--accent), var(--purple));
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---- Log viewer (always dark) ---- */
.log-line {
    white-space: pre-wrap;
    word-break: break-all;
    line-height: 1.35;
    padding: 1px 0;
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 300;
}
.log-container::-webkit-scrollbar {
    width: 6px;
}
.log-container::-webkit-scrollbar-track {
    background: transparent;
}
.log-container::-webkit-scrollbar-thumb {
    background: var(--log-scrollbar);
    border-radius: 3px;
}
.log-container::-webkit-scrollbar-thumb:hover {
    background: var(--log-scrollbar-hover);
}
.mini-log-container {
    scroll-behavior: smooth;
}

/* ---- Toggle switch ---- */
.toggle-switch {
    position: relative;
    width: 40px;
    height: 22px;
    background: var(--bg-surface);
    border: 1px solid var(--border-medium);
    border-radius: 100px;
    transition: all 0.2s ease;
    cursor: pointer;
    flex-shrink: 0;
}
.toggle-switch.active {
    background: var(--accent);
    border-color: var(--accent);
}
.toggle-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    background: var(--text-muted);
    border-radius: 100px;
    transition: all 0.2s ease;
}
.toggle-switch.active::after {
    transform: translateX(18px);
    background: #fff;
}

/* ---- Checkbox styling ---- */
input[type="checkbox"] {
    accent-color: var(--accent);
}

/* ---- Section headers ---- */
.section-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

/* ---- Form section ---- */
.form-section {
    padding: 24px 0;
    border-top: 1px solid var(--border-subtle);
}
.form-section:first-child {
    padding-top: 0;
    border-top: none;
}

/* ---- Pill count ---- */
.pill {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: 100px;
    font-size: 11px;
    font-weight: 600;
}
.pill-accent {
    background: var(--accent-soft);
    color: var(--accent);
}
.pill-purple {
    background: var(--purple-soft);
    color: var(--purple);
}
.pill-green {
    background: var(--green-soft);
    color: var(--green);
}

/* ---- Slider styling ---- */
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 4px;
    background: var(--bg-surface);
    border-radius: 100px;
    outline: none;
}
input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    border: 2px solid var(--bg-raised);
    box-shadow: 0 0 8px var(--accent-glow);
}

/* ---- Animations ---- */
@keyframes fade-in-up {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}
.animate-fade-in {
    animation: fade-in-up 0.4s ease forwards;
}
@keyframes pulse-ring {
    0% { box-shadow: 0 0 0 0 rgba(61, 214, 140, 0.4); }
    70% { box-shadow: 0 0 0 8px rgba(61, 214, 140, 0); }
    100% { box-shadow: 0 0 0 0 rgba(61, 214, 140, 0); }
}
.pulse-ring {
    animation: pulse-ring 2s infinite;
}

/* ---- Login background ---- */
.login-bg {
    position: fixed;
    inset: 0;
    background: var(--bg-base);
    overflow: hidden;
}
.login-bg::after {
    content: '';
    position: absolute;
    width: 600px;
    height: 600px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: radial-gradient(circle, var(--accent-soft) 0%, transparent 70%);
    border-radius: 50%;
}

/* ---- Job card ---- */
.job-card {
    background: var(--bg-raised);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-card);
}
.job-card:hover {
    border-color: var(--border-medium);
    box-shadow: var(--shadow-card-hover);
}
.job-card-active {
    border-color: var(--accent);
    border-left: 3px solid var(--accent);
}

/* ---- Theme toggle button ---- */
.theme-toggle {
    background: var(--bg-surface);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-sm);
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-secondary);
}
.theme-toggle:hover {
    background: var(--bg-surface-hover);
    color: var(--text-primary);
}

/* ---- Scrollbar for category/ville lists ---- */
.scroll-list::-webkit-scrollbar {
    width: 4px;
}
.scroll-list::-webkit-scrollbar-track {
    background: transparent;
}
.scroll-list::-webkit-scrollbar-thumb {
    background: var(--border-medium);
    border-radius: 2px;
}

/* ---- Focus visible ---- */
input:focus-visible,
button:focus-visible,
select:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* ---- Alpine cloak ---- */
[x-cloak] { display: none !important; }

/* ---- Responsive tweaks ---- */
@media (max-width: 640px) {
    .job-card { padding: 16px; }
}
