@import url('https://fonts.googleapis.com/css2?family=Geist:wght@300;400;500;600;700&family=Geist+Mono:wght@400;500&display=swap');

:root {
    --bg: #f8f9fb;
    --bg-white: #ffffff;
    --border: #e4e7ed;
    --border-2: #d0d5de;

    --text: #0f1117;
    --text-2: #4b5563;
    --text-3: #9ca3af;

    --blue: #2563eb;
    --blue-light: #eff4ff;
    --blue-border: #c7d7fe;

    --red: #dc2626;
    --red-light: #fff1f1;

    --green: #16a34a;
    --green-light: #f0fdf4;

    --radius: 10px;
    --sans: 'Geist', sans-serif;
    --mono: 'Geist Mono', monospace;

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.08), 0 2px 4px rgba(0, 0, 0, 0.04);
}

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

body {
    font-family: var(--sans);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    -webkit-font-smoothing: antialiased;
}

/* ── Sidebar ─────────────────────────────────────── */
.sidebar {
    width: 228px;
    background: var(--bg-white);
    border-right: 1px solid var(--border);
    padding: 24px 20px;
    position: fixed;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.brand {
    display: flex;
    align-items: center;
    gap: 9px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 28px;
}

.brand-shield {
    width: 30px;
    height: 30px;
    background: var(--blue);
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.brand-shield svg {
    width: 15px;
    height: 15px;
    color: #fff;
}

.brand-text {
    line-height: 1.2;
}

.brand-name {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text);
}

.brand-sub {
    font-size: 0.7rem;
    color: var(--text-3);
    margin-top: 1px;
}

.sidebar-label {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 8px;
    padding-left: 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 7px;
    font-size: 0.83rem;
    font-weight: 500;
    color: var(--text-2);
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s;
    margin-bottom: 2px;
}

.nav-item svg {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
}

.nav-item:hover {
    background: var(--bg);
    color: var(--text);
}

.nav-item.active {
    background: var(--blue-light);
    color: var(--blue);
}

.nav-item.active svg {
    color: var(--blue);
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.sidebar-footer p {
    font-size: 0.72rem;
    color: var(--text-3);
    line-height: 1.6;
    font-family: var(--mono);
}

.dot-live {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--green);
    margin-right: 5px;
    animation: blink 2s infinite;
}

@keyframes blink {

    0%,
    100% {
        opacity: 1
    }

    50% {
        opacity: 0.3
    }
}

/* ── Main ────────────────────────────────────────── */
.main-content {
    margin-left: 228px;
    flex: 1;
    padding: 56px 64px;
    max-width: calc(100% - 228px);
}

/* ── Header ──────────────────────────────────────── */
.page-eyebrow {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--blue);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 10px;
}

.page-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.03em;
    line-height: 1.15;
    margin-bottom: 10px;
}

.page-sub {
    font-size: 0.9rem;
    color: var(--text-2);
    line-height: 1.6;
    max-width: 480px;
    margin-bottom: 40px;
}

/* ── Upload card ─────────────────────────────────── */
.card {
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    margin-bottom: 16px;
    overflow: hidden;
}

.card-inner {
    padding: 28px 32px;
}

.card-title {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.card-title svg {
    width: 15px;
    height: 15px;
    color: var(--blue);
}

.card-desc {
    font-size: 0.78rem;
    color: var(--text-3);
    font-family: var(--mono);
    margin-bottom: 22px;
}

/* Drop zone */
.drop-zone {
    border: 1.5px dashed var(--border-2);
    border-radius: 9px;
    padding: 44px 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--bg);
    position: relative;
}

.drop-zone:hover,
.drop-zone.over {
    border-color: var(--blue);
    background: var(--blue-light);
}

.drop-icon-wrap {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    border: 1px solid var(--border-2);
    background: var(--bg-white);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 14px;
    color: var(--blue);
    transition: 0.2s;
}

.drop-zone:hover .drop-icon-wrap {
    border-color: var(--blue-border);
    box-shadow: 0 0 0 3px var(--blue-light);
}

.drop-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 4px;
}

.drop-hint {
    font-size: 0.78rem;
    color: var(--text-3);
}

.drop-hint strong {
    color: var(--blue);
    font-weight: 500;
}

.file-chip {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 14px;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--green);
    font-family: var(--mono);
}

.file-chip svg {
    width: 13px;
    height: 13px;
}

/* Button */
.btn-primary {
    margin-top: 18px;
    width: 100%;
    height: 44px;
    background: var(--blue);
    color: white;
    border: none;
    border-radius: 8px;
    font-family: var(--sans);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    letter-spacing: -0.01em;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
}

.btn-primary:hover {
    background: #1d4ed8;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: none;
}

.btn-primary svg {
    width: 15px;
    height: 15px;
}

/* Error */
.error-box {
    display: flex;
    gap: 10px;
    padding: 13px 16px;
    background: var(--red-light);
    border: 1px solid #fecaca;
    border-radius: 8px;
    font-size: 0.82rem;
    color: var(--red);
    margin-bottom: 16px;
}

.error-box svg {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
    margin-top: 1px;
}

/* Hint box */
.hint-card .card-inner {
    padding: 22px 28px;
}

.hint-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 0.09em;
    margin-bottom: 10px;
}

.hint-code {
    font-family: var(--mono);
    font-size: 0.74rem;
    line-height: 1.8;
    color: var(--text-2);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 7px;
    padding: 14px 16px;
}

.hint-code .k {
    color: #2563eb;
}

.hint-code .s {
    color: #16a34a;
}

.hint-code .p {
    color: var(--text-3);
}

/* ── Mobile hamburger (index page) ──────────────────────────── */
.mobile-nav-btn {
    display: none;
    position: fixed;
    top: 14px; left: 14px;
    z-index: 201;
    width: 38px; height: 38px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg-white);
    color: var(--text);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.sidebar-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,0.5); z-index: 99;
}
.sidebar-overlay.open { display: block; }

@media (max-width: 768px) {
    .mobile-nav-btn { display: flex; }

    /* Sidebar becomes a slide-in drawer */
    .sidebar {
        display: flex !important;
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        z-index: 100;
    }
    .sidebar.open { transform: translateX(0); }

    .main-content {
        margin-left: 0;
        padding: 24px 16px;
        padding-top: 64px;
        max-width: 100%;
    }

    .page-title { font-size: 1.6rem; }
    .page-sub   { font-size: 0.85rem; }

    .card { border-radius: 10px; }
    .card-inner { padding: 18px; }
    .card-title { font-size: 0.95rem; }

    .drop-zone { padding: 28px 16px; }
    .drop-title { font-size: 0.9rem; }

    .btn-primary { font-size: 0.9rem; padding: 0.8rem; }

    .hint-code { font-size: 0.78rem; overflow-x: auto; }
}

/* ── Dark mode overrides ─────────────────────────── */
body.dark-mode {
    --bg:          #0f172a;
    --bg-white:    #1e293b;
    --border:      #334155;
    --border-2:    #475569;
    --text:        #e2e8f0;
    --text-2:      #94a3b8;
    --text-3:      #64748b;
    --blue:        #3b82f6;
    --blue-light:  rgba(59, 130, 246, 0.12);
    --blue-border: rgba(59, 130, 246, 0.3);
    --red:         #f87171;
    --red-light:   rgba(239, 68, 68, 0.12);
    --green:       #4ade80;
    --green-light: rgba(34, 197, 94, 0.1);
    background: linear-gradient(145deg, #0f172a, #111827);
}

body.dark-mode .sidebar {
    background: #0b1220;
    border-right-color: #1e293b;
}

body.dark-mode .brand-name          { color: #e2e8f0; }
body.dark-mode .brand-sub           { color: #64748b; }
body.dark-mode .nav-item            { color: #94a3b8; }
body.dark-mode .nav-item:hover      { background: rgba(59,130,246,0.1); color: #e2e8f0; }
body.dark-mode .nav-item.active     { background: rgba(59,130,246,0.15); color: #93c5fd; }
body.dark-mode .sidebar-footer p    { color: #64748b; }
body.dark-mode .sidebar-label       { color: #475569; }

body.dark-mode .page-title          { color: #e2e8f0; }
body.dark-mode .page-eyebrow        { color: #60a5fa; }
body.dark-mode .page-sub            { color: #94a3b8; }

body.dark-mode .card                { background: #1e293b; border-color: #334155; box-shadow: 0 4px 12px rgba(0,0,0,0.3); }
body.dark-mode .card-title          { color: #e2e8f0; }
body.dark-mode .card-desc           { color: #64748b; }

body.dark-mode .drop-zone           { background: #152033; border-color: #334155; }
body.dark-mode .drop-zone:hover,
body.dark-mode .drop-zone.over      { background: rgba(59,130,246,0.1); border-color: #3b82f6; }
body.dark-mode .drop-title          { color: #e2e8f0; }
body.dark-mode .drop-icon-wrap      { background: #0f172a; border-color: #334155; }

body.dark-mode .hint-label          { color: #64748b; }
body.dark-mode .hint-code           { background: #152033; border-color: #334155; color: #94a3b8; }
body.dark-mode .hint-code .k        { color: #60a5fa; }
body.dark-mode .hint-code .s        { color: #4ade80; }
body.dark-mode .hint-code .p        { color: #475569; }

body.dark-mode .error-box           { background: rgba(239,68,68,0.1); border-color: rgba(239,68,68,0.3); color: #f87171; }

/* Theme toggle button in dark mode */
body.dark-mode #themeToggle-index   { border-color: #334155; color: #94a3b8; background: transparent; }
body.dark-mode #themeToggle-index:hover { background: rgba(59,130,246,0.1); color: #e2e8f0; }

/* Loading overlay in dark mode */
body.dark-mode #loadingOverlay      { background: rgba(10,15,28,0.95) !important; }