/* ==========================================================================
   REPXADMIN — Modern Minimal Design System
   Mobile-app feel · responsive desktop/tablet/mobile
   Overrides Bootstrap 5.3 defaults; keeps existing markup working.
   ========================================================================== */

:root {
    --brand: #4f46e5;
    --brand-600: #4338ca;
    --brand-soft: #eef2ff;
    --ink: #0f172a;
    --ink-2: #334155;
    --muted: #64748b;
    --line: #e2e8f0;
    --bg: #f6f7fb;
    --surface: #ffffff;
    --success: #059669;
    --success-soft: #ecfdf5;
    --danger: #dc2626;
    --danger-soft: #fef2f2;
    --warning: #d97706;
    --warning-soft: #fffbeb;
    --info: #0284c7;
    --info-soft: #f0f9ff;
    --r-sm: .5rem;
    --r-md: .75rem;
    --r-lg: 1rem;
    --r-xl: 1.25rem;
    --shadow-xs: 0 1px 2px rgba(15, 23, 42, .05);
    --shadow-sm: 0 1px 3px rgba(15, 23, 42, .07), 0 1px 2px rgba(15, 23, 42, .04);
    --shadow-md: 0 4px 12px rgba(15, 23, 42, .08), 0 2px 4px rgba(15, 23, 42, .04);
    --shadow-lg: 0 12px 32px rgba(15, 23, 42, .12), 0 4px 8px rgba(15, 23, 42, .06);
    --font: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    --nav-h: 60px;
    --bnav-h: 64px;
}

/* ---------- Base ---------- */
body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--ink);
    -webkit-font-smoothing: antialiased;
    letter-spacing: -.01em;
}
.student-body { background: var(--bg); }
h1, h2, h3, h4, h5, h6 { font-weight: 700; letter-spacing: -.02em; color: var(--ink); }
a { color: var(--brand); }
::selection { background: var(--brand-soft); }

/* ---------- Cards ---------- */
.card {
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-xs);
    transition: box-shadow .2s ease, transform .2s ease;
}
.card:hover { box-shadow: var(--shadow-md); }
.card-header {
    background: transparent;
    border-bottom: 1px solid var(--line);
    font-weight: 600;
    padding: .9rem 1.25rem;
}
.card-body { padding: 1.25rem; }

/* ---------- Buttons ---------- */
.btn { border-radius: var(--r-md); font-weight: 600; font-size: .9rem; padding: .5rem 1rem; }
.btn-primary {
    background: var(--brand); border-color: var(--brand);
}
.btn-primary:hover, .btn-primary:focus {
    background: var(--brand-600); border-color: var(--brand-600);
    box-shadow: 0 4px 12px rgba(79, 70, 229, .3);
}
.btn-outline-primary { color: var(--brand); border-color: var(--brand); }
.btn-outline-primary:hover { background: var(--brand); border-color: var(--brand); }
.btn-outline-light { border-color: rgba(255,255,255,.35); }
.btn-outline-light:hover { background: rgba(255,255,255,.12); border-color: #fff; color: #fff; }
.btn-light { background: var(--bg); border-color: var(--line); color: var(--ink-2); }
.btn-light:hover { background: var(--brand-soft); color: var(--brand-600); }
.btn-sm { border-radius: .5rem; padding: .35rem .75rem; font-size: .82rem; }

/* ---------- Forms ---------- */
.form-control, .form-select {
    border-radius: var(--r-md);
    border-color: #cbd5e1;
    padding: .6rem .85rem;
    font-size: .92rem;
    color: var(--ink);
    background-color: #fff;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.form-control:focus, .form-select:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, .12);
}
.form-label { font-weight: 600; font-size: .82rem; color: var(--ink-2); margin-bottom: .35rem; }
.form-text { color: var(--muted); }
.input-group-text {
    background: var(--bg); border-color: var(--line); color: var(--muted);
    border-radius: var(--r-md) 0 0 var(--r-md); border-right: none;
}
.input-group > .form-control { border-left: none; border-radius: 0 var(--r-md) var(--r-md) 0 !important; }
.input-group > .form-control:focus { box-shadow: 0 0 0 3px rgba(79,70,229,.12); }
.auth-inner { border-radius: var(--r-xl) !important; box-shadow: var(--shadow-md) !important; }
.demo-email { color: var(--brand-600); font-weight: 500; }
.demo-email:hover { text-decoration: underline !important; color: var(--brand); }

/* ---------- Badges ---------- */
.badge {
    font-weight: 600;
    padding: .35em .65em;
    border-radius: 999px;
    font-size: .72rem;
}
.text-bg-light { background: var(--bg) !important; color: var(--ink-2) !important; }
.text-bg-primary { background: var(--brand-soft) !important; color: var(--brand-600) !important; }
.text-bg-success { background: var(--success-soft) !important; color: var(--success) !important; }
.text-bg-warning { background: var(--warning-soft) !important; color: var(--warning) !important; }
.text-bg-danger { background: var(--danger-soft) !important; color: var(--danger) !important; }
.text-bg-info { background: var(--info-soft) !important; color: var(--info) !important; }

/* ---------- Tables ---------- */
.table thead th {
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--muted);
    border-bottom: 1px solid var(--line);
    font-weight: 700;
    white-space: nowrap;
    background: #fafbfe;
    padding: .75rem .75rem;
}
.table td { vertical-align: middle; padding: .75rem; font-size: .9rem; border-color: #f1f5f9; }
.table-hover tbody tr:hover { background: var(--brand-soft); }
.table-responsive { border-radius: var(--r-lg); }

/* ---------- Alerts ---------- */
.alert { border-radius: var(--r-md); border: none; font-size: .9rem; }
.alert-success { background: var(--success-soft); color: #065f46; }
.alert-danger { background: var(--danger-soft); color: #991b1b; }
.alert-info { background: var(--info-soft); color: #075985; }
.alert-warning { background: var(--warning-soft); color: #92400e; }

/* ---------- Pagination ---------- */
.pagination { margin-bottom: 0; gap: .25rem; }
.page-link { border-radius: var(--r-sm) !important; border: none; color: var(--ink-2); font-weight: 500; padding: .45rem .8rem; }
.page-link:hover { background: var(--brand-soft); color: var(--brand-600); }
.page-item.active .page-link { background: var(--brand); color: #fff; }
.page-item.disabled .page-link { color: #cbd5e1; }

/* ---------- Dropdowns ---------- */
.dropdown-menu {
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    box-shadow: var(--shadow-md);
    padding: .4rem;
}
.dropdown-item { border-radius: .5rem; padding: .5rem .75rem; font-size: .88rem; font-weight: 500; }
.dropdown-item:hover { background: var(--brand-soft); color: var(--brand-600); }

/* ==========================================================================
   ADMIN SHELL
   ========================================================================== */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
    width: 256px;
    background: linear-gradient(180deg, #0f172a 0%, #111c34 100%);
    color: #94a3b8;
    position: fixed; top: 0; bottom: 0; left: 0; z-index: 100;
    overflow-y: auto;
    transition: transform .25s ease;
    display: flex; flex-direction: column;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border-radius: 4px; }
.sidebar-brand {
    color: #fff; font-weight: 700; font-size: 1.02rem;
    padding: 1.15rem 1.4rem;
    border-bottom: 1px solid rgba(255,255,255,.07);
    display: flex; align-items: center; gap: .65rem;
    letter-spacing: -.01em;
}
.sidebar-brand i { color: #818cf8; font-size: 1.25rem; }
.sidebar-nav { flex: 1; padding: .5rem 0 1.5rem; }
.nav-section {
    font-size: .64rem; text-transform: uppercase; letter-spacing: .1em;
    padding: 1.15rem 1.4rem .45rem; color: #5b6b84; font-weight: 700;
}
.sidebar-nav a.nav-link {
    color: #94a3b8; padding: .55rem 1.4rem;
    display: flex; align-items: center; gap: .8rem;
    font-size: .88rem; font-weight: 500;
    border-left: 3px solid transparent;
    text-decoration: none;
    margin: .1rem .55rem;
    border-radius: .6rem;
    transition: all .15s ease;
}
.sidebar-nav a.nav-link i { font-size: 1rem; width: 20px; text-align: center; opacity: .85; }
.sidebar-nav a.nav-link:hover { color: #fff; background: rgba(255,255,255,.06); }
.sidebar-nav a.nav-link.active {
    color: #fff;
    background: linear-gradient(90deg, rgba(79,70,229,.28), rgba(79,70,229,.1));
    border-left-color: #818cf8;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.05);
}

.main { flex: 1; margin-left: 256px; min-width: 0; display: flex; flex-direction: column; }
.topbar {
    background: rgba(255,255,255,.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--line);
    padding: .7rem 1.75rem;
    display: flex; align-items: center; gap: 1rem;
    position: sticky; top: 0; z-index: 90;
}
.page-title { font-size: 1.12rem; font-weight: 700; margin: 0; letter-spacing: -.02em; }

/* ---------- Stat cards ---------- */
.stat-card { border: none; border-radius: var(--r-lg); overflow: hidden; position: relative; }
.stat-card .card-body { padding: 1.25rem 1.35rem; }
.stat-icon {
    width: 44px; height: 44px; border-radius: .75rem;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.3rem; margin-bottom: .75rem;
    background: var(--brand-soft); color: var(--brand-600);
}
.stat-card:nth-child(4n+2) .stat-icon { background: var(--success-soft); color: var(--success); }
.stat-card:nth-child(4n+3) .stat-icon { background: var(--info-soft); color: var(--info); }
.stat-card:nth-child(4n+4) .stat-icon { background: var(--warning-soft); color: var(--warning); }
.stat-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 700; }
.stat-value { font-size: 1.7rem; font-weight: 800; line-height: 1.15; letter-spacing: -.03em; }
.stat-meta { font-size: .8rem; color: var(--muted); margin-top: .25rem; }

/* ==========================================================================
   AUTH PAGES
   ========================================================================== */
.auth-page {
    background:
        radial-gradient(ellipse 80% 50% at 20% -10%, rgba(99,102,241,.35), transparent),
        radial-gradient(ellipse 60% 40% at 90% 110%, rgba(14,165,233,.25), transparent),
        linear-gradient(135deg, #0f172a 0%, #1e1b4b 55%, #172554 100%);
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    padding: 1.25rem;
}
.auth-wrap { width: 100%; max-width: 430px; }
.auth-card {
    border-radius: 1.5rem !important;
    border: 1px solid rgba(255,255,255,.6) !important;
    box-shadow: var(--shadow-lg) !important;
    overflow: hidden;
}
.auth-card .card-body { padding: 2.25rem 2rem !important; }
.auth-logo {
    width: 60px; height: 60px; border-radius: 1.1rem;
    background: linear-gradient(135deg, var(--brand), #7c3aed);
    color: #fff; display: inline-flex; align-items: center; justify-content: center;
    font-size: 1.7rem; margin-bottom: .9rem;
    box-shadow: 0 8px 24px rgba(99,102,241,.4);
}
.auth-logo .brand-mark { width: 60px; height: 60px; border-radius: 1.1rem; background: none; box-shadow: none; font-size: 1.7rem; }
.auth-card h4 { font-weight: 800; letter-spacing: -.03em; }

/* ==========================================================================
   STUDENT PORTAL — mobile app feel
   ========================================================================== */
.student-body { min-height: 100vh; padding-bottom: calc(var(--bnav-h) + 24px); }
@media (min-width: 992px) { .student-body { padding-bottom: 2rem; } }

/* App header */
.app-header {
    position: sticky; top: 0; z-index: 95;
    background: rgba(255,255,255,.85);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--line);
}
.app-header .inner { max-width: 1080px; margin: 0 auto; padding: .65rem 1rem; display: flex; align-items: center; gap: .9rem; }
.app-header .brand { font-weight: 800; font-size: 1.05rem; letter-spacing: -.02em; color: var(--ink); text-decoration: none; display: flex; align-items: center; gap: .55rem; }
.app-header .brand .brand-mark { width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(135deg, #6366f1, #8b5cf6); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 1.05rem; box-shadow: 0 3px 10px rgba(99,102,241,.4); flex-shrink: 0; }
.app-header .brand .brand-text { white-space: nowrap; }
.app-header .brand i { color: inherit; font-size: inherit; }
.wallet-chip {
    display: inline-flex; align-items: center; gap: .45rem;
    background: var(--brand-soft); color: var(--brand-600);
    border-radius: 999px; padding: .35rem .85rem;
    font-size: .82rem; font-weight: 700; text-decoration: none;
    border: 1px solid rgba(79,70,229,.15);
}
.wallet-chip:hover { background: #e0e7ff; color: var(--brand-600); }

/* Desktop top nav */
.app-topnav { display: none; }
@media (min-width: 992px) {
    .app-topnav { display: flex; align-items: center; gap: .35rem; margin-left: auto; }
    .app-topnav a {
        color: var(--ink-2); text-decoration: none; font-weight: 600; font-size: .88rem;
        padding: .45rem .9rem; border-radius: .6rem; display: inline-flex; align-items: center; gap: .45rem;
        transition: all .15s ease;
    }
    .app-topnav a:hover { background: var(--brand-soft); color: var(--brand-600); }
    .app-topnav a.active { background: var(--brand); color: #fff; box-shadow: 0 3px 10px rgba(79,70,229,.3); }
}

/* Mobile bottom nav — app-like */
.bottom-nav {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
    background: rgba(255,255,255,.92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--line);
    display: flex; justify-content: space-around;
    padding: .4rem .5rem calc(.4rem + env(safe-area-inset-bottom));
    box-shadow: 0 -6px 20px rgba(15,23,42,.06);
}
[data-theme="dark"] .bottom-nav { background: rgba(17, 26, 44, .92); box-shadow: 0 -6px 20px rgba(0,0,0,.4); }
.bottom-nav a {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: .2rem;
    text-decoration: none; color: var(--muted); font-size: .64rem; font-weight: 600;
    padding: .35rem .2rem; border-radius: .7rem; transition: color .15s ease;
    max-width: 84px;
}
[data-theme="dark"] .bottom-nav a { color: #b6c2d4; }
.bottom-nav a i { font-size: 1.3rem; line-height: 1; }
.bottom-nav a.active { color: var(--brand); }
.bottom-nav a.active i { transform: translateY(-1px); }
.bottom-nav form { flex: 1; max-width: 84px; display: flex; }
.bottom-nav form button {
    flex: 1; background: none; border: none; color: var(--muted);
    display: flex; flex-direction: column; align-items: center; gap: .2rem;
    font-size: .64rem; font-weight: 600; padding: .35rem .2rem; border-radius: .7rem;
    cursor: pointer; font-family: var(--font);
}
[data-theme="dark"] .bottom-nav form button { color: #b6c2d4; }
.bottom-nav form button i { font-size: 1.3rem; }
.bottom-nav form button:hover { color: var(--danger); }
@media (min-width: 992px) { .bottom-nav { display: none; } }

/* Admin data tables — allow horizontal scroll on mobile instead of crushing */
.table-responsive > .table { min-width: 680px; }
@media (max-width: 575px) {
    .table-responsive > .table.qtable { min-width: 780px; }
    .table-responsive > .table.ctable { min-width: 760px; }
    .table-responsive > .table.rtable { min-width: 780px; }
    .table-responsive > .table.ptable { min-width: 760px; }
    .table-responsive > .table { min-width: 620px; }
}

/* Student content container — phone-width on mobile, grid on desktop */
.student-shell { max-width: 1080px; margin: 0 auto; padding: 1rem 1rem 2rem; }
@media (max-width: 575px) { .student-shell { padding: .85rem .85rem 5.5rem; } }

/* Student page header */
.student-pagehead { margin-bottom: 1.1rem; }
.student-pagehead h4 { margin: 0; font-weight: 800; letter-spacing: -.02em; }
.student-pagehead p { margin: .15rem 0 0; color: var(--muted); font-size: .85rem; }

/* Test cards — app-like */
.test-card { border-radius: var(--r-xl); border: 1px solid var(--line); background: var(--surface); overflow: hidden; }
.test-card .card-body { padding: 1.15rem 1.2rem; }
.test-type {
    display: inline-flex; align-items: center; gap: .35rem;
    font-size: .68rem; font-weight: 700; letter-spacing: .04em;
    text-transform: uppercase; border-radius: 999px; padding: .28rem .7rem;
    background: var(--brand-soft); color: var(--brand-600);
}
.test-type.mock { background: var(--brand-soft); color: var(--brand-600); }
.test-type.practice { background: var(--success-soft); color: var(--success); }
.test-type.quiz { background: var(--warning-soft); color: var(--warning); }
.test-type.series { background: var(--info-soft); color: var(--info); }
.test-meta { display: flex; flex-wrap: wrap; gap: .4rem; }
.test-meta .chip {
    display: inline-flex; align-items: center; gap: .3rem;
    font-size: .74rem; font-weight: 600; color: var(--ink-2);
    background: var(--bg); border-radius: 999px; padding: .28rem .6rem;
}
.test-meta .chip i { color: var(--muted); }
.test-price { font-weight: 800; font-size: 1.02rem; letter-spacing: -.02em; }

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
@media (max-width: 991px) {
    .sidebar { transform: translateX(-100%); box-shadow: none; }
    .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); }
    .main { margin-left: 0; }
    .topbar { padding: .6rem 1rem; }
    .page-title { font-size: 1rem; }
}
@media (max-width: 575px) {
    .card-body { padding: 1rem; }
    .table td, .table thead th { padding: .6rem .55rem; font-size: .82rem; }
    .auth-card .card-body { padding: 1.75rem 1.4rem !important; }
}

/* ---------- Misc polish ---------- */
.q-preview { max-width: 420px; }
.form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }
.progress { background: #eef2f7; border-radius: 999px; }
.progress-bar { background: var(--brand); border-radius: 999px; }
.list-group-item { border-color: var(--line); padding: .85rem 1rem; }
.list-group-item:first-child { border-top-left-radius: var(--r-lg); border-top-right-radius: var(--r-lg); }
.list-group-item:last-child { border-bottom-left-radius: var(--r-lg); border-bottom-right-radius: var(--r-lg); }
.nav-tabs .nav-link { color: var(--muted); font-weight: 600; border: none; padding: .6rem 1rem; }
.nav-tabs .nav-link.active { color: var(--brand); border-bottom: 2px solid var(--brand); background: transparent; }
.modal-content { border: none; border-radius: var(--r-xl); box-shadow: var(--shadow-lg); }

/* ---------- Test attempt (student) ---------- */
.question-card { border-radius: var(--r-lg); }
.question-card .form-check {
    border-color: var(--line) !important;
    border-radius: var(--r-md);
    transition: border-color .15s ease, background .15s ease;
    cursor: pointer;
}
.question-card .form-check:hover { border-color: #c7d2fe !important; background: #fafbff; }
.question-card .form-check:has(.opt-radio:checked) {
    border-color: var(--brand) !important;
    background: var(--brand-soft);
    box-shadow: inset 0 0 0 1px rgba(79,70,229,.25);
}
.question-card .form-check .form-check-label { cursor: pointer; font-size: .92rem; }
.question-card .form-check .badge { width: 24px; text-align: center; }
.question-card .form-check:has(.opt-radio:checked) .badge {
    background: var(--brand) !important; color: #fff;
}
.question-card .form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }
#navigator .btn { width: 40px; height: 40px; border-radius: .6rem !important; font-weight: 700; }
.sticky-top { z-index: 80; }

/* Theme toggle button — moon shown in light, sun in dark */
.theme-toggle-btn { width: 34px; height: 34px; display: inline-flex !important; align-items: center; justify-content: center; padding: 0 !important; }
.theme-toggle-btn i { font-size: .95rem; line-height: 1; }
.theme-toggle-btn .bi-sun-fill { display: none; }
[data-theme="dark"] .theme-toggle-btn .bi-moon-stars-fill { display: none; }
[data-theme="dark"] .theme-toggle-btn .bi-sun-fill { display: inline-block; }

/* Exam timer badge — dark chip that reads in both themes */
.timer-badge { background: #0f172a; color: #f8fafc; font-variant-numeric: tabular-nums; letter-spacing: .04em; border: 1px solid rgba(255,255,255,.08); }
[data-theme="dark"] .timer-badge { background: #1e293b; border-color: rgba(255,255,255,.12); color: #f1f5f9; }

/* ==========================================================================
   DARK THEME — [data-theme="dark"] on <html>
   ========================================================================== */
[data-theme="dark"] {
    --brand: #818cf8;
    --brand-600: #6366f1;
    --brand-soft: rgba(99, 102, 241, .16);
    --ink: #f1f5f9;
    --ink-2: #cbd5e1;
    --muted: #94a3b8;
    --line: #293548;
    --bg: #0b1220;
    --surface: #111a2c;
    --success: #34d399;
    --success-soft: rgba(16, 185, 129, .15);
    --danger: #f87171;
    --danger-soft: rgba(239, 68, 68, .15);
    --warning: #fbbf24;
    --warning-soft: rgba(245, 158, 11, .15);
    --info: #38bdf8;
    --info-soft: rgba(14, 165, 233, .15);
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, .45), 0 1px 2px rgba(0, 0, 0, .35);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, .5), 0 2px 4px rgba(0, 0, 0, .4);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, .6), 0 4px 8px rgba(0, 0, 0, .45);
}

/* Dark: Bootstrap component overrides */
[data-theme="dark"] body { background: var(--bg); color: var(--ink); }
[data-theme="dark"] .app-header { background: var(--surface); border-bottom-color: var(--line); }
[data-theme="dark"] .card,
[data-theme="dark"] .modal-content,
[data-theme="dark"] .dropdown-menu,
[data-theme="dark"] .list-group-item,
[data-theme="dark"] .popover,
[data-theme="dark"] .offcanvas,
[data-theme="dark"] .toast {
    background-color: var(--surface);
    border-color: var(--line);
    color: var(--ink);
}
[data-theme="dark"] .card-header,
[data-theme="dark"] .card-footer,
[data-theme="dark"] .modal-header,
[data-theme="dark"] .modal-footer,
[data-theme="dark"] .table thead th {
    background-color: rgba(255, 255, 255, .03);
    border-color: var(--line);
    color: var(--ink-2);
}
[data-theme="dark"] .table { --bs-table-bg: transparent; color: var(--ink); }
[data-theme="dark"] .table td,
[data-theme="dark"] .table th { border-color: var(--line); color: var(--ink); }
[data-theme="dark"] .table-hover tbody tr:hover { background-color: rgba(255, 255, 255, .04); color: var(--ink); }
[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select {
    background-color: #0d1526;
    border-color: var(--line);
    color: var(--ink);
}
[data-theme="dark"] .form-control::placeholder { color: var(--muted); }
[data-theme="dark"] .form-control:focus,
[data-theme="dark"] .form-select:focus {
    background-color: #0d1526;
    border-color: var(--brand);
    color: var(--ink);
}
[data-theme="dark"] .form-control[disabled],
[data-theme="dark"] .form-control[readonly] { background-color: #0a101d; }
[data-theme="dark"] .input-group-text { background: rgba(255, 255, 255, .05); border-color: var(--line); color: var(--muted); }
[data-theme="dark"] .form-label { color: var(--ink-2); }
[data-theme="dark"] .dropdown-item { color: var(--ink-2); }
[data-theme="dark"] .dropdown-item:hover,
[data-theme="dark"] .dropdown-item:focus { background: var(--brand-soft); color: var(--ink); }
[data-theme="dark"] .text-muted { color: var(--muted) !important; }
[data-theme="dark"] .bg-white { background-color: var(--surface) !important; }
[data-theme="dark"] .border,
[data-theme="dark"] .border-top,
[data-theme="dark"] .border-bottom,
[data-theme="dark"] .border-start,
[data-theme="dark"] .border-end { border-color: var(--line) !important; }
[data-theme="dark"] .btn-light { background: rgba(255, 255, 255, .06); border-color: var(--line); color: var(--ink); }
[data-theme="dark"] .btn-light:hover { background: rgba(255, 255, 255, .1); color: #fff; }
[data-theme="dark"] .btn-outline-secondary { border-color: var(--line); color: var(--ink-2); }
[data-theme="dark"] .btn-outline-secondary:hover { background: var(--brand-soft); color: var(--ink); }
[data-theme="dark"] .nav-tabs .nav-link { color: var(--muted); }
[data-theme="dark"] .nav-tabs .nav-link.active { color: var(--brand); }
[data-theme="dark"] .accordion-button { background: var(--surface); color: var(--ink); }
[data-theme="dark"] .accordion-button:not(.collapsed) { background: var(--brand-soft); color: var(--brand-600); }
[data-theme="dark"] .question-card .form-check:hover { border-color: #4c5a74 !important; background: rgba(255, 255, 255, .03); }
[data-theme="dark"] .question-card .form-check .badge { color: var(--muted); }
[data-theme="dark"] .text-primary { color: var(--brand-600) !important; }
[data-theme="dark"] .btn-primary { --bs-btn-bg: var(--brand); --bs-btn-border-color: var(--brand); --bs-btn-hover-bg: var(--brand-600); --bs-btn-hover-border-color: var(--brand-600); }
[data-theme="dark"] .btn-outline-primary { --bs-btn-color: var(--brand); --bs-btn-border-color: var(--brand); --bs-btn-hover-bg: var(--brand); --bs-btn-hover-border-color: var(--brand); }
[data-theme="dark"] .badge.text-bg-light { background: rgba(255, 255, 255, .08) !important; color: var(--ink) !important; }
[data-theme="dark"] .alert { background-color: var(--surface); border-color: var(--line); color: var(--ink); }
[data-theme="dark"] .pagination .page-link { background: var(--surface); border-color: var(--line); color: var(--ink-2); }
[data-theme="dark"] .pagination .page-item.active .page-link { background: var(--brand); border-color: var(--brand); color: #fff; }
[data-theme="dark"] .theme-toggle-btn i { transition: transform .3s ease; }
[data-theme="dark"] .theme-toggle-btn i.bi-sun-fill { display: inline-block; }
[data-theme="dark"] .theme-toggle-btn i.bi-moon-stars-fill { display: none; }

/* ==========================================================================
   APP-FEEL POLISH (mobile app-like experience)
   ========================================================================== */
html { -webkit-tap-highlight-color: transparent; }
body { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; touch-action: manipulation; }
.student-body { overscroll-behavior-y: none; }

/* no text selection on UI chrome */
.app-header, .app-topnav, .bottom-nav, .btn, .test-type, .chip, .nav-link { user-select: none; -webkit-user-select: none; }

/* press feedback (native app feel) */
.bottom-nav a, .bottom-nav form button { transition: transform .12s ease, color .15s ease; }
.bottom-nav a:active, .bottom-nav form button:active { transform: scale(.88); }
.btn:active { transform: scale(.96); }

/* iOS-style active dot indicator */
.bottom-nav a.active { position: relative; }
.bottom-nav a.active::before {
    content: ""; position: absolute; top: 2px; left: 50%; transform: translateX(-50%);
    width: 5px; height: 5px; border-radius: 50%; background: var(--brand);
}

/* iOS input auto-zoom fix (fonts >= 16px on mobile) */
@media (max-width: 991.98px) {
    input, select, textarea { font-size: 16px !important; }
}

/* page-load fade (app-like transition between pages) */
.student-shell { animation: appFade .28s ease both; }
@keyframes appFade {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
    .student-shell { animation: none !important; }
    .bottom-nav a, .bottom-nav form button, .btn { transition: none !important; }
}

/* ==========================================================================
   APP-FEEL UI v2 (mobile app-like — iOS-style polish)
   ========================================================================== */

/* iPhone notch / status-bar safe area for the sticky header */
.app-header .inner {
    padding-top: calc(.65rem + env(safe-area-inset-top));
    padding-bottom: calc(.6rem + env(safe-area-inset-top, 0px) * .35);
}

/* iOS large-title style page headers */
.student-pagehead h4 { font-size: 1.42rem; letter-spacing: -.03em; }
@media (min-width: 768px) { .student-pagehead h4 { font-size: 1.55rem; } }

/* Bottom nav — iOS-style app bar: bigger targets + active pill */
.bottom-nav { padding: .3rem .4rem calc(.3rem + env(safe-area-inset-bottom)); }
.bottom-nav a, .bottom-nav form { max-width: none; }
.bottom-nav a, .bottom-nav form button {
    padding: .5rem .15rem; border-radius: .95rem; gap: .24rem;
    font-size: .66rem; transition: color .15s ease, background .15s ease, transform .12s ease;
}
.bottom-nav a i, .bottom-nav form button i { font-size: 1.35rem; }
.bottom-nav a.active { background: var(--brand-soft); color: var(--brand-600); }
.bottom-nav a.active::before { display: none; }
.bottom-nav a.active i { transform: none; }
[data-theme="dark"] .bottom-nav a.active { background: rgba(99,102,241,.2); color: #a5b4fc; }

/* Test cards — soft elevation + press feedback */
.test-card { box-shadow: var(--shadow-sm); transition: transform .12s ease, box-shadow .18s ease; }
.test-card:active { transform: scale(.985); }
@media (hover: hover) {
    .test-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
}
[data-theme="dark"] .test-card { box-shadow: 0 8px 24px rgba(0,0,0,.35); }
.chip-attempted { background: var(--success-soft) !important; color: var(--success) !important; }

/* Buttons — app-friendly radius + press feedback */
.student-body .btn { border-radius: .7rem; font-weight: 600; }
.student-body .btn:active { transform: scale(.97); }
.student-body .btn-sm { padding: .42rem .85rem; }

/* General cards — consistent radius */
.student-body .card { border-radius: var(--r-lg); }
.student-body .dropdown-menu { border-radius: var(--r-md); box-shadow: var(--shadow-md); }

/* Page-load fade between sections (already on shell) */
.student-shell { animation: appFade .26s ease both; }
