/* ═══ MijnSPO Portal — Design Tokens ═══ */
:root {
    --void: #030810;
    --base: #060e18;
    --surface: #0c1626;
    --card: rgba(255,255,255,.035);
    --card-s: #0e1a2f;
    --card-h: rgba(255,255,255,.06);
    --elev: rgba(255,255,255,.07);
    --input: rgba(255,255,255,.05);
    --brd: rgba(255,255,255,.055);
    --brd-a: rgba(0,220,120,.3);
    --acc: #00DC78;
    --acc-d: #00b563;
    --acc-s: rgba(0,220,120,.10);
    --acc-g: linear-gradient(135deg, #00DC78, #00f5a0);
    --acc-g2: linear-gradient(135deg, #00DC78, #38bdf8);
    --t1: #f0fdf4;
    --t2: #c1d0dc;
    --t3: #5d7389;
    --t4: #364559;
    --ok: #22c55e;
    --warn: #f59e0b;
    --err: #ef4444;
    --info: #38bdf8;
    --hgl: #F7941D;
    --ap: #3CB54A;
    --hgv: #5B9BD5;
    --fd: system-ui, -apple-system, 'Segoe UI', sans-serif;
    --r-s: 12px;
    --r-m: 16px;
    --r-l: 22px;
    --r-f: 9999px;
    --e: cubic-bezier(.16, 1, .3, 1);
    --safe-t: env(safe-area-inset-top, 0px);
    --safe-b: env(safe-area-inset-bottom, 0px);
    --nav: 68px;
}

[data-theme="light"] {
    --void: #f2f5f9;
    --base: #f8fafb;
    --surface: #fff;
    --card: rgba(0,0,0,.025);
    --card-s: #fff;
    --card-h: rgba(0,0,0,.04);
    --elev: rgba(0,0,0,.045);
    --input: rgba(0,0,0,.04);
    --brd: rgba(0,0,0,.07);
    --brd-a: rgba(0,160,80,.25);
    --acc: #00a85c;
    --acc-d: #009050;
    --acc-s: rgba(0,168,92,.08);
    --acc-g: linear-gradient(135deg, #00a85c, #00d175);
    --acc-g2: linear-gradient(135deg, #00a85c, #38bdf8);
    --t1: #0c1829;
    --t2: #3e5068;
    --t3: #8898aa;
    --t4: #c0ccda;
}

/* ═══ RESET ═══ */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html {
    font-family: var(--fd);
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
    overscroll-behavior: none;
}
body {
    background: var(--void);
    color: var(--t1);
    min-height: 100dvh;
    font-size: 15px;
    overflow-x: hidden;
}
a { text-decoration: none; color: inherit; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input { font-family: inherit; }

/* ═══ GLASS ═══ */
.glass {
    background: rgba(255,255,255,.04);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,.06);
}
[data-theme="light"] .glass {
    background: rgba(255,255,255,.7);
    border-color: rgba(0,0,0,.06);
}

/* ═══ LOGIN SCREEN ═══ */
.login-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100dvh;
    padding: 24px;
    background: var(--void);
}

.login-card {
    width: 100%;
    max-width: 380px;
    background: var(--surface);
    border: 1px solid var(--brd);
    border-radius: var(--r-l);
    padding: 40px 32px;
}

.login-logo {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 12px;
    background: var(--acc-g);
    border-radius: var(--r-m);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 700;
    color: #030810;
}

.login-logo h1 {
    font-size: 22px;
    font-weight: 700;
    color: var(--t1);
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.login-error {
    padding: 10px 14px;
    background: rgba(239, 68, 68, .1);
    border: 1px solid rgba(239, 68, 68, .2);
    border-radius: var(--r-s);
    color: var(--err);
    font-size: 13px;
}

/* ═══ FORM FIELDS ═══ */
.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.field label {
    font-size: 13px;
    font-weight: 500;
    color: var(--t3);
}

.field input {
    padding: 12px 14px;
    background: var(--input);
    border: 1px solid var(--brd);
    border-radius: var(--r-s);
    color: var(--t1);
    font-size: 15px;
    outline: none;
    transition: border-color .2s;
}

.field input:focus {
    border-color: var(--acc);
    box-shadow: 0 0 0 3px var(--acc-s);
}

.form-error {
    padding: 8px 12px;
    background: rgba(239, 68, 68, .1);
    border-radius: var(--r-s);
    color: var(--err);
    font-size: 13px;
}

/* ═══ BUTTONS ═══ */
.btn-primary {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    background: var(--acc-g);
    border: none;
    border-radius: var(--r-s);
    color: #030810;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity .2s, transform .1s;
    min-height: 44px;
}

.btn-primary:hover { opacity: .9; }
.btn-primary:active { transform: scale(.98); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }

.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    background: var(--card);
    border: 1px solid var(--brd);
    border-radius: var(--r-s);
    color: var(--t1);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background .2s;
}

.btn-secondary:hover { background: var(--card-h); }

.btn-danger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    background: rgba(239, 68, 68, .1);
    border: 1px solid rgba(239, 68, 68, .2);
    border-radius: var(--r-s);
    color: var(--err);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background .2s;
}

.btn-danger:hover { background: rgba(239, 68, 68, .15); }

/* ═══ SPINNER ═══ */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(3, 8, 16, .3);
    border-top-color: #030810;
    border-radius: 50%;
    animation: spin .6s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ═══ PORTAL SHELL ═══ */
.portal-shell {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

/* ═══ OVERLAY (password change, onboarding) ═══ */
.overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: var(--void);
}

.overlay-card {
    width: 100%;
    max-width: 400px;
    background: var(--surface);
    border: 1px solid var(--brd);
    border-radius: var(--r-l);
    padding: 32px 24px;
}

.overlay-card h2 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 8px;
}

.overlay-card p {
    font-size: 14px;
    color: var(--t3);
    margin-bottom: 20px;
}

.overlay-card form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* ═══ ONBOARDING ═══ */
.onboarding {
    text-align: center;
}

.onboarding h2 { margin-bottom: 8px; }
.onboarding h3 { margin-bottom: 16px; font-size: 16px; }
.onboarding p { margin-bottom: 24px; }

.lang-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-bottom: 24px;
}

.lang-btn {
    padding: 10px 18px;
    background: var(--card);
    border: 1px solid var(--brd);
    border-radius: var(--r-s);
    color: var(--t2);
    font-size: 14px;
    cursor: pointer;
    transition: all .2s;
}

.lang-btn:hover { background: var(--card-h); }
.lang-btn.active {
    background: var(--acc-s);
    border-color: var(--acc);
    color: var(--acc);
}

.theme-grid {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-bottom: 24px;
}

.theme-btn {
    padding: 10px 20px;
    background: var(--card);
    border: 1px solid var(--brd);
    border-radius: var(--r-s);
    color: var(--t2);
    font-size: 14px;
    cursor: pointer;
    transition: all .2s;
}

.theme-btn:hover { background: var(--card-h); }
.theme-btn.active {
    background: var(--acc-s);
    border-color: var(--acc);
    color: var(--acc);
}

/* ═══ APP MAIN LAYOUT ═══ */
.app-main {
    display: flex;
    flex-direction: column;
    min-height: 100dvh;
}

/* ═══ HEADER ═══ */
.portal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    padding-top: calc(12px + var(--safe-t));
    background: var(--base);
    border-bottom: 1px solid var(--brd);
}

.portal-title {
    font-size: 18px;
    font-weight: 700;
    background: var(--acc-g);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--acc-g);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    font-weight: 700;
    color: #030810;
    cursor: pointer;
}

/* ═══ CONTENT ═══ */
.portal-content {
    flex: 1;
    padding: 20px;
    padding-bottom: calc(var(--nav) + 20px + var(--safe-b));
    overflow-y: auto;
}

/* ═══ HERO CARD (today's route) ═══ */
.hero-card {
    background: var(--surface);
    border: 1px solid var(--brd);
    border-radius: var(--r-l);
    padding: 20px;
    margin-bottom: 20px;
    position: relative;
    overflow: hidden;
}

.hero-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--acc-g);
}

.hero-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--acc);
    margin-bottom: 12px;
}

.hero-empty {
    color: var(--t3);
    font-size: 14px;
    padding: 12px 0;
}

/* ═══ ROUTE CARDS ═══ */
.route-card {
    background: var(--card);
    border: 1px solid var(--brd);
    border-radius: var(--r-m);
    padding: 14px 16px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 14px;
}

.route-card.compact { padding: 10px 14px; }

.route-nr {
    font-size: 18px;
    font-weight: 700;
    color: var(--t1);
    min-width: 60px;
}

.route-card.compact .route-nr { font-size: 15px; }

.route-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--t3);
    flex-wrap: wrap;
}

.depot-badge {
    padding: 2px 8px;
    border-radius: var(--r-f);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .03em;
}

.depot-badge[data-depot="hengelo"] { background: rgba(247, 148, 29, .15); color: var(--hgl); }
.depot-badge[data-depot="apeldoorn"] { background: rgba(60, 181, 74, .15); color: var(--ap); }
.depot-badge[data-depot="hoogeveen"] { background: rgba(91, 155, 213, .15); color: var(--hgv); }

/* ═══ SECTION LABEL ═══ */
.section-label {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--t3);
    margin-bottom: 10px;
    margin-top: 8px;
}

.empty-msg {
    color: var(--t4);
    font-size: 13px;
    padding: 8px 0;
}

/* ═══ COMPLAINTS COUNTER ═══ */
.complaints-card {
    background: var(--surface);
    border: 1px solid var(--brd);
    border-radius: var(--r-m);
    padding: 16px 20px;
    margin-top: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.complaints-label {
    font-size: 13px;
    color: var(--t3);
}

.complaints-count {
    font-size: 20px;
    font-weight: 700;
    color: var(--ok);
}

.complaints-count.danger {
    color: var(--err);
}

/* ═══ SETTINGS ═══ */
.settings-section {
    margin-bottom: 28px;
}

.settings-section h2 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 24px;
}

.settings-section h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--t3);
    margin-bottom: 10px;
}

/* ═══ BOTTOM NAV ═══ */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(var(--nav) + var(--safe-b));
    padding-bottom: var(--safe-b);
    background: var(--base);
    border-top: 1px solid var(--brd);
    display: flex;
    align-items: center;
    justify-content: space-around;
    z-index: 50;
}

.nav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 8px 16px;
    color: var(--t4);
    font-size: 11px;
    font-weight: 500;
    transition: color .2s;
}

.nav-btn.active { color: var(--acc); }
.nav-btn:hover { color: var(--t2); }

.nav-icon {
    width: 22px;
    height: 22px;
}

/* ═══ RTL SUPPORT ═══ */
[dir="rtl"] .route-card { flex-direction: row-reverse; }
[dir="rtl"] .route-meta { flex-direction: row-reverse; }
[dir="rtl"] .complaints-card { flex-direction: row-reverse; }
[dir="rtl"] .portal-header { flex-direction: row-reverse; }
