/* ===== CSS CUSTOM PROPERTIES (DARK/LIGHT) ===== */
:root {
    --bg-body: radial-gradient(circle at 20% 25%, #12172a 0%, #070b16 55%, #02040b 100%);
    --text-primary: #f1f5ff;
    --text-secondary: #d8e1ff;
    --text-muted: #9aa8cc;
    --bg-header: linear-gradient(120deg, #0f1f34 0%, #121f3e 50%, #172a46 100%);
    --header-border: rgba(165, 190, 250, 0.2);
    --bg-main: rgba(18, 25, 40, 0.98);
    --main-border: rgba(87, 117, 180, 0.25);
    --bg-card: rgba(16, 24, 42, 0.82);
    --card-border: rgba(98, 146, 255, 0.3);
    --bg-question: #1b233d;
    --question-border: #2b3350;
    --bg-option: #1f2a46;
    --option-border: #2f3a58;
    --option-hover-bg: #283353;
    --option-hover-border: #5ebcff;
    --option-selected-bg: rgba(55, 100, 210, 0.3);
    --option-selected-border: #6aa5ff;
    --bg-input: #111a2f;
    --input-border: #4e6aa8;
    --bg-select: #0f1c38;
    --select-border: #4d6eb7;
    --bg-progress: #2b3350;
    --progress-border: #2f3a58;
    --bg-score-summary: #121a32;
    --score-summary-border: #2b3b6d;
    --bg-score-cell: rgba(26, 37, 60, 0.95);
    --score-cell-border: rgba(90, 130, 230, 0.3);
    --bg-history-panel: rgba(15, 23, 40, 0.7);
    --history-panel-border: rgba(98, 146, 255, 0.2);
    --bg-history-item: rgba(20, 31, 52, 0.9);
    --history-item-border: rgba(95, 134, 212, 0.28);
    --bg-history-summary: rgba(16, 25, 44, 0.72);
    --history-summary-border: rgba(106, 146, 230, 0.28);
    --bg-userbar: rgba(16, 25, 43, 0.85);
    --userbar-border: rgba(109, 157, 255, 0.3);
    --bg-auth: rgba(18, 27, 46, 0.92);
    --auth-border: rgba(98, 146, 255, 0.25);
    --bg-dashboard-cell: rgba(20, 31, 55, 0.92);
    --dashboard-cell-border: rgba(111, 157, 255, 0.25);
    --h1-color: #e8f4ff;
    --h2-color: #3c70e6;
    --link-color: #8db6ff;
    --link-hover: #d0e5ff;
    --btn-bg: #3f6cde;
    --btn-border: #3e79ff;
    --btn-hover-bg: #2b56db;
    --btn-hover-border: #5fb8ff;
    --scenario-color: #7fd6ff;
    --scenario-border: #69c8ff;
    --explanation-bg: #16203a;
    --explanation-border: #3f57af;
    --feedback-correct-bg: rgba(13, 58, 39, 0.85);
    --feedback-correct-border: #4fca9a;
    --feedback-correct-color: #b5ffe1;
    --feedback-incorrect-bg: rgba(50, 31, 31, 0.85);
    --feedback-incorrect-border: #ee8f8f;
    --feedback-incorrect-color: #ffcec5;
    --review-ok-bg: rgba(19, 84, 58, 0.35);
    --review-ok-border: rgba(95, 220, 164, 0.5);
    --review-ok-color: #caffeb;
    --review-item-bg: rgba(22, 31, 50, 0.8);
    --review-item-border: rgba(98, 135, 212, 0.3);
    --review-wrong-bg: rgba(90, 30, 40, 0.45);
    --review-wrong-border: rgba(242, 125, 125, 0.65);
    --review-wrong-color: #ffd6d0;
    --nav-dot-bg: rgba(25, 37, 62, 0.88);
    --nav-dot-border: rgba(94, 140, 230, 0.55);
    --mode-badge-color: #d6ecff;
    --mode-badge-bg: rgba(41, 90, 168, 0.4);
    --mode-badge-border: rgba(107, 169, 255, 0.45);
    --timer-color: #d9edff;
    --timer-bg: rgba(22, 78, 116, 0.4);
    --timer-border: rgba(113, 198, 255, 0.5);
    --timer-warn-color: #ffe0df;
    --timer-warn-bg: rgba(116, 37, 37, 0.42);
    --timer-warn-border: rgba(255, 154, 154, 0.55);
    --badge-pass-bg: rgba(23, 107, 68, 0.6);
    --badge-pass-border: rgba(110, 225, 171, 0.7);
    --badge-pass-color: #b9ffdd;
    --badge-fail-bg: rgba(131, 44, 44, 0.55);
    --badge-fail-border: rgba(255, 147, 147, 0.72);
    --badge-fail-color: #ffd2cb;
    --shadow-main: rgba(0, 0, 0, 0.55);
}

[data-theme="light"] {
    --bg-body: linear-gradient(135deg, #eef2f7 0%, #dfe6ef 100%);
    --text-primary: #1a2030;
    --text-secondary: #334155;
    --text-muted: #6b7a96;
    --bg-header: linear-gradient(120deg, #ffffff 0%, #f0f4ff 50%, #e8eeff 100%);
    --header-border: rgba(100, 130, 200, 0.25);
    --bg-main: rgba(255, 255, 255, 0.96);
    --main-border: rgba(100, 130, 200, 0.2);
    --bg-card: rgba(255, 255, 255, 0.9);
    --card-border: rgba(100, 130, 200, 0.25);
    --bg-question: #f7f9ff;
    --question-border: #d0d8e8;
    --bg-option: #ffffff;
    --option-border: #c8d4ea;
    --option-hover-bg: #edf2ff;
    --option-hover-border: #4a90e2;
    --option-selected-bg: rgba(66, 133, 244, 0.12);
    --option-selected-border: #4285f4;
    --bg-input: #ffffff;
    --input-border: #b0bdd4;
    --bg-select: #ffffff;
    --select-border: #b0bdd4;
    --bg-progress: #dde4f0;
    --progress-border: #c8d4ea;
    --bg-score-summary: #f0f4ff;
    --score-summary-border: #c0cde6;
    --bg-score-cell: rgba(240, 245, 255, 0.95);
    --score-cell-border: rgba(100, 130, 200, 0.25);
    --bg-history-panel: rgba(245, 248, 255, 0.9);
    --history-panel-border: rgba(100, 130, 200, 0.2);
    --bg-history-item: rgba(255, 255, 255, 0.95);
    --history-item-border: rgba(100, 130, 200, 0.25);
    --bg-history-summary: rgba(240, 245, 255, 0.85);
    --history-summary-border: rgba(100, 130, 200, 0.2);
    --bg-userbar: rgba(255, 255, 255, 0.9);
    --userbar-border: rgba(100, 130, 200, 0.25);
    --bg-auth: rgba(255, 255, 255, 0.95);
    --auth-border: rgba(100, 130, 200, 0.2);
    --bg-dashboard-cell: rgba(248, 250, 255, 0.95);
    --dashboard-cell-border: rgba(100, 130, 200, 0.2);
    --h1-color: #1a2844;
    --h2-color: #2b5bc5;
    --link-color: #2563eb;
    --link-hover: #1d4ed8;
    --btn-bg: #3b6ce7;
    --btn-border: #3b6ce7;
    --btn-hover-bg: #2b5bc5;
    --btn-hover-border: #2b5bc5;
    --scenario-color: #1d6fa5;
    --scenario-border: #3a9ed8;
    --explanation-bg: #f0f5ff;
    --explanation-border: #4a7acc;
    --feedback-correct-bg: rgba(220, 252, 231, 0.85);
    --feedback-correct-border: #22c55e;
    --feedback-correct-color: #166534;
    --feedback-incorrect-bg: rgba(254, 226, 226, 0.85);
    --feedback-incorrect-border: #ef4444;
    --feedback-incorrect-color: #991b1b;
    --review-ok-bg: rgba(220, 252, 231, 0.5);
    --review-ok-border: rgba(34, 197, 94, 0.5);
    --review-ok-color: #166534;
    --review-item-bg: rgba(248, 250, 255, 0.9);
    --review-item-border: rgba(100, 130, 200, 0.25);
    --review-wrong-bg: rgba(254, 226, 226, 0.5);
    --review-wrong-border: rgba(239, 68, 68, 0.5);
    --review-wrong-color: #991b1b;
    --nav-dot-bg: rgba(240, 245, 255, 0.9);
    --nav-dot-border: rgba(100, 130, 200, 0.4);
    --mode-badge-color: #1e3a6e;
    --mode-badge-bg: rgba(59, 130, 246, 0.12);
    --mode-badge-border: rgba(59, 130, 246, 0.35);
    --timer-color: #1a4a6e;
    --timer-bg: rgba(14, 116, 182, 0.1);
    --timer-border: rgba(14, 116, 182, 0.3);
    --timer-warn-color: #991b1b;
    --timer-warn-bg: rgba(239, 68, 68, 0.1);
    --timer-warn-border: rgba(239, 68, 68, 0.4);
    --badge-pass-bg: rgba(220, 252, 231, 0.7);
    --badge-pass-border: rgba(34, 197, 94, 0.6);
    --badge-pass-color: #166534;
    --badge-fail-bg: rgba(254, 226, 226, 0.7);
    --badge-fail-border: rgba(239, 68, 68, 0.6);
    --badge-fail-color: #991b1b;
    --shadow-main: rgba(0, 0, 0, 0.1);
}

body {
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    background: var(--bg-body);
    color: var(--text-primary);
    line-height: 1.5;
}

small {
    color: var(--text-muted);
}

header {
    text-align: center;
    background: var(--bg-header);
    color: var(--text-primary);
    padding: 26px;
    box-shadow: 0 10px 34px var(--shadow-main);
    border-bottom: 1px solid var(--header-border);
}

.header-top {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

.lang-toggle {
    position: absolute;
    right: 0;
    padding: 6px 14px;
    border-radius: 8px;
    border: 1px solid var(--input-border);
    background: var(--bg-input);
    color: var(--text-primary);
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    transition: border-color 0.15s;
}

.lang-toggle:hover {
    border-color: #3b82f6;
}

main {
    max-width: 980px;
    margin: 18px auto;
    background-color: var(--bg-main);
    padding: 24px;
    border-radius: 16px;
    border: 1px solid var(--main-border);
    box-shadow: 0 14px 32px var(--shadow-main);
}

h1 {
    font-family: 'Chakra Petch', 'Inter', sans-serif;
    font-size: 2.8rem;
    letter-spacing: 0.03em;
    margin: 0;
    color: var(--h1-color);
}

p {
    color: var(--text-secondary);
}

#progress-text {
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
}

#progress-container {
    border: 1px solid var(--progress-border);
}

#progress-bar {
    box-shadow: 0 0 8px rgba(117, 216, 255, 0.6);
}

.question {
    background: var(--bg-question);
    border: 1px solid var(--question-border);
    backdrop-filter: blur(5px);
    color: var(--text-primary);
}

.question p,
.question .scenario,
.question strong {
    color: var(--text-primary);
}

.option {
    background: var(--bg-option);
    border: 1px solid var(--option-border);
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.15);
}

.option:hover {
    background: var(--option-hover-bg);
    border-color: var(--option-hover-border);
}

button {
    border: 1px solid var(--btn-border);
    background: var(--btn-bg);
    box-shadow: 0 8px 16px rgba(39, 83, 170, 0.4);
}

button:hover {
    background: var(--btn-hover-bg);
}

#results {
    background: var(--bg-card);
    border: 1px solid var(--card-border);
}

.feedback.correct {
    background: var(--feedback-correct-bg);
    border-color: var(--feedback-correct-border);
    color: var(--feedback-correct-color);
}

.feedback.incorrect {
    background: var(--feedback-incorrect-bg);
    border-color: var(--feedback-incorrect-border);
    color: var(--feedback-incorrect-color);
}

.explanation {
    background: var(--explanation-bg);
    border-left: 4px solid var(--explanation-border);
}

.quiz-header {
    margin-bottom: 18px;
}

#progress-container {
    width: 100%;
    height: 12px;
    background-color: var(--bg-progress);
    border-radius: 8px;
    margin-top: 8px;
    overflow: hidden;
    border: 1px solid var(--progress-border);
}

#progress-bar {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #4a95ff, #58cfb9);
    border-radius: 8px;
    transition: width 0.2s ease;
}

.back-btn,
.subject-buttons button,
#exam-items button,
.controls button,
#results button {
    font-weight: 600;
    padding: 10px 14px;
    margin: 0.25rem;
    border-radius: 10px;
    cursor: pointer;
    min-width: 150px;
}

.subject-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-bottom: 12px;
}

#exam-items {
    margin-top: 8px;
    list-style: none;
    padding-left: 0;
}

#exam-items li {
    margin-bottom: 8px;
}

#exam-items li button {
    width: 100%;
    text-align: left;
}

.back-btn {
    display: inline-block;
    margin-bottom: 12px;
    color: white;
    border-color: var(--card-border);
}

.question {
    margin-bottom: 16px;
    padding: 16px;
    border: 1px solid var(--question-border);
    border-radius: 10px;
    background-color: var(--bg-question);
}

.options {
    margin-top: 12px;
}

.option {
    display: block;
    margin-bottom: 12px;
    padding: 12px;
    border: 1px solid var(--option-border);
    border-radius: 8px;
    background-color: var(--bg-option);
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-primary);
}

.option:hover {
    background-color: var(--option-hover-bg);
    border-color: var(--option-hover-border);
}

.option.selected {
    background-color: var(--option-selected-bg);
    border-color: var(--option-selected-border);
    box-shadow: inset 0 0 0 1px rgba(106, 165, 255, 0.4);
}

.option input {
    margin-right: 10px;
}

.controls {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 22px;
}

button {
    background-color: var(--btn-bg);
    color: white;
    border: 1px solid var(--btn-border);
    padding: 10px 18px;
    cursor: pointer;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s ease;
}

button:hover {
    background-color: var(--btn-hover-bg);
    border-color: var(--btn-hover-border);
}

button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.score-summary {
    margin-top: 12px;
    margin-bottom: 14px;
    padding: 16px;
    background-color: var(--bg-score-summary);
    border: 1px solid var(--score-summary-border);
    border-radius: 14px;
    text-align: center;
}

.score-summary h2 {
    margin: 0 0 4px;
    font-size: 3.8rem;
    line-height: 1;
}

.score-summary h2.score-high { color: #22c55e; }
.score-summary h2.score-mid  { color: #f59e0b; }
.score-summary h2.score-low  { color: #ef4444; }

.score-summary p {
    margin: 3px 0;
    color: var(--text-secondary);
}

.score-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
    margin-top: 12px;
}

.score-cell {
    background: var(--bg-score-cell);
    border: 1px solid var(--score-cell-border);
    border-radius: 10px;
    padding: 8px 10px;
}

.score-cell strong {
    display: block;
    font-size: 1.3rem;
    color: var(--text-primary);
}

.score-cell span {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.score-message {
    margin-top: 8px;
    font-size: 1rem;
    color: #ade4b8;
}

.feedback {
    margin-top: 14px;
    padding: 12px;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.4;
}

.feedback.correct {
    border: 1px solid var(--feedback-correct-border);
    color: var(--feedback-correct-color);
}

.feedback.incorrect {
    border: 1px solid var(--feedback-incorrect-border);
    color: var(--feedback-incorrect-color);
}

.correct {
    color: #7be79f;
    font-weight: bold;
}

.incorrect {
    color: #ff9f94;
    font-weight: bold;
}

.explanation {
    margin-top: 8px;
    background: var(--explanation-bg);
    border-left: 4px solid var(--explanation-border);
    padding: 10px;
    border-radius: 4px;
}

#exam-list ul,
#exam-list li {
    padding: 0;
    margin: 0;
}

#exam-list li {
    margin: 10px 0;
}

#exam-list a {
    display: inline-block;
    font-weight: 700;
    color: var(--link-color);
}

#exam-list a:hover {
    color: var(--link-hover);
}

#progress-text {
    font-size: 14px;
    color: var(--text-muted);
    margin-top: 2px;
}

.scenario {
    margin: 10px 0 8px;
    color: var(--scenario-color);
    font-size: 0.95rem;
    border-left: 3px solid var(--scenario-border);
    padding-left: 10px;
    opacity: 0.92;
}

.quiz-header {
    margin-bottom: 18px;
}

h2 {
    color: var(--h2-color);
    display: flex;
    justify-content: center;
    align-items: center;
}

ul {
    list-style-type: none;
    padding: 0;
}

li {
    margin: 10px 0;
}

a {
    text-decoration: none;
    color: var(--link-color);
    font-weight: bold;
}

a:hover {
    color: var(--link-hover);
}

/* ===== MOBILE FIXES ===== */
@media (max-width: 600px) {

    header {
        padding: 16px 12px;
    }

    main {
        margin: 8px;
        padding: 12px;
        border-radius: 10px;
    }

    h1 {
        font-size: 1.5rem;
    }

    h2 {
        font-size: 1.3rem;
        text-align: center;
    }

    /* Auth kaart full width */
    .auth-card {
        padding: 14px;
        margin-left: 0;
        margin-right: 0;
    }

    .auth-card form {
        max-width: 100%;
    }

    .auth-card button {
        width: 100%;
    }

    .auth-tab {
        width: auto;
    }

    .social-login-buttons {
        grid-template-columns: 1fr;
    }

    /* User bar wrappen bij kleine schermen */
    #user-bar {
        flex-wrap: wrap;
        gap: 8px;
    }

    /* Buttons full width */
    .subject-buttons {
        flex-direction: column;
    }

    .subject-buttons button,
    .controls button,
    .back-btn,
    #exam-items li button {
        width: 100%;
        min-width: unset;
        box-sizing: border-box;
    }

    /* Verberg zoekbalk op mobiel */
    .search-input {
        display: none;
    }

    /* Controls onder elkaar */
    .controls {
        flex-direction: column;
    }

    /* Vraag blok iets compacter */
    .question {
        padding: 12px;
    }

    /* Opties beter klikbaar (touch targets) */
    .option {
        padding: 14px 12px;
        font-size: 15px;
    }

    /* Score samenvatting kleiner */
    .score-summary h2 {
        font-size: 2.8rem;
    }

    /* Score grid netjes stacken */
    .score-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Progress bar spacing */
    #progress-text {
        font-size: 12px;
    }

    /* History toolbar */
    .history-toolbar {
        flex-direction: column;
        align-items: flex-start;
    }

    .history-toolbar select {
        width: 100%;
    }

    /* Result box */
    #results {
        padding: 14px;
    }

    /* Kleinere score cells op heel kleine schermen */
    .score-cell strong {
        font-size: 1.2rem;
    }

    .result-badge {
        font-size: 0.75rem;
    }

    /* User bar compact on mobile */
    #user-bar p {
        font-size: 0.85rem;
        margin: 0;
        word-break: break-all;
    }

    .user-bar-actions {
        display: flex;
        gap: 6px;
    }

    .user-bar-actions button {
        font-size: 0.8rem;
        padding: 6px 10px;
    }

    /* Auth card mobile polish */
    .auth-tabs {
        border-radius: 8px 8px 0 0;
    }

    .auth-tab {
        font-size: 0.9rem;
        padding: 10px 12px;
    }

    .social-login-buttons {
        grid-template-columns: 1fr;
    }

    .social-btn {
        font-size: 0.85rem;
        padding: 10px 14px;
    }

    /* Nav buttons on mobile */
    .main-nav {
        gap: 6px;
    }

    .main-nav-btn {
        font-size: 0.85rem;
        padding: 8px 12px;
    }

    /* Exam tools stacked */
    .exam-tools {
        flex-direction: column;
        gap: 8px;
    }

    .exam-tools select,
    .exam-tools label {
        width: 100%;
    }

    /* Exam meta compact */
    .exam-meta {
        flex-wrap: wrap;
        gap: 6px;
    }

    /* Question nav dots smaller */
    .nav-dot {
        width: 28px;
        height: 28px;
        font-size: 0.75rem;
    }

    /* Dashboard grid on mobile */
    .dashboard-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.auth-card {
    background: var(--bg-auth);
    border: 1px solid var(--auth-border);
    border-radius: 14px;
    padding: 18px;
    margin-bottom: 18px;
    max-width: 620px;
    margin-left: auto;
    margin-right: auto;
}

.auth-card form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 460px;
    margin: 10px auto 0;
}

.auth-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.auth-card label {
    font-weight: 600;
    color: var(--text-secondary);
}

.auth-card input {
    padding: 10px;
    border-radius: 8px;
    border: 1px solid var(--input-border);
    background: var(--bg-input);
    color: var(--text-primary);
}

.auth-card form > button[type="submit"] {
    width: 100%;
    padding: 12px;
    font-size: 1rem;
    font-weight: 600;
    margin-top: 4px;
}

.auth-card select {
    padding: 10px;
    border-radius: 8px;
    border: 1px solid var(--input-border);
    background: var(--bg-input);
    color: var(--text-primary);
}

.auth-tabs {
    display: flex;
    margin-bottom: 16px;
    border-bottom: 2px solid var(--auth-border);
    overflow: hidden;
    border-radius: 10px 10px 0 0;
    background: rgba(255,255,255,0.03);
}

.auth-tab {
    flex: 1;
    padding: 12px 16px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-weight: 600;
    font-size: 1rem;
    text-align: center;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
    min-width: 0;
}

.auth-tab:hover {
    color: var(--text-primary);
    background: rgba(59, 130, 246, 0.05);
}

.auth-tab.active {
    color: #3b82f6;
    border-bottom-color: #3b82f6;
    background: rgba(59, 130, 246, 0.08);
}

.auth-message {
    margin-top: 12px;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.9rem;
}

.auth-error {
    background: rgba(220, 53, 69, 0.15);
    color: #dc3545;
    border: 1px solid rgba(220, 53, 69, 0.3);
}

.auth-success {
    background: rgba(40, 167, 69, 0.15);
    color: #28a745;
    border: 1px solid rgba(40, 167, 69, 0.3);
}

.auth-divider {
    display: flex;
    align-items: center;
    margin: 18px auto 14px;
    gap: 12px;
    max-width: 460px;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--auth-border);
}

.auth-divider span {
    font-size: 0.85rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.social-login-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    max-width: 460px;
    margin: 0 auto;
}

.social-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 10px 16px;
    border-radius: 8px;
    border: 1px solid var(--input-border);
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    width: 100%;
}

.social-btn:hover {
    border-color: #3b82f6;
}

.social-btn svg {
    flex-shrink: 0;
}

.google-btn:hover { border-color: #4285F4; }
.microsoft-btn:hover { border-color: #00a4ef; }
.facebook-btn:hover { border-color: #1877F2; }
.linkedin-btn:hover { border-color: #0A66C2; }

#user-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-userbar);
    border: 1px solid var(--userbar-border);
    border-radius: 12px;
    padding: 10px 14px;
    margin-bottom: 16px;
}

#user-bar p {
    margin: 0;
}

.user-bar-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-shrink: 0;
}

.main-nav {
    display: flex;
    gap: 10px;
    margin-bottom: 14px;
}

.main-nav-btn {
    min-width: 140px;
}

.main-nav-btn.active {
    border-color: rgba(111, 204, 255, 0.9);
    box-shadow: 0 0 0 2px rgba(100, 177, 255, 0.35);
}

.history-panel {
    margin-top: 16px;
    padding: 12px;
    border-radius: 10px;
    border: 1px solid var(--history-panel-border);
    background: var(--bg-history-panel);
}

#history-items {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 10px;
}

.history-item {
    padding: 10px;
    border: 1px solid var(--history-item-border);
    border-radius: 8px;
    background: var(--bg-history-item);
}

.history-empty {
    color: var(--text-muted);
}

.history-summary {
    margin: 10px 0 14px;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--history-summary-border);
    background: var(--bg-history-summary);
}

.history-summary p {
    margin: 0 0 6px;
}

.history-summary ul {
    margin: 0;
    padding-left: 16px;
}

.history-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.history-toolbar select {
    border: 1px solid var(--select-border);
    background: var(--bg-select);
    color: var(--text-primary);
    border-radius: 8px;
    padding: 8px 10px;
}

.exam-tools {
    display: flex;
    gap: 12px;
    align-items: center;
    margin: 10px 0 12px;
    flex-wrap: wrap;
}

.search-input {
    flex: 1 1 280px;
    min-width: 220px;
    border: 1px solid var(--select-border);
    background: var(--bg-select);
    color: var(--text-primary);
    border-radius: 8px;
    padding: 10px 12px;
}

.shuffle-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    font-weight: 600;
}

.result-badge {
    display: inline-block;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    border-radius: 999px;
    padding: 4px 10px;
    margin-right: 6px;
}

.result-badge.pass {
    color: var(--badge-pass-color);
    background: var(--badge-pass-bg);
    border: 1px solid var(--badge-pass-border);
}

.result-badge.fail {
    color: var(--badge-fail-color);
    background: var(--badge-fail-bg);
    border: 1px solid var(--badge-fail-border);
}

.history-duration {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.review-ok {
    margin-top: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid var(--review-ok-border);
    background: var(--review-ok-bg);
    color: var(--review-ok-color);
}

.review-item {
    margin-top: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    background: var(--review-item-bg);
    border: 1px solid var(--review-item-border);
}

.review-item.wrong {
    border-color: var(--review-wrong-border);
    background: var(--review-wrong-bg);
}

.review-item.wrong p {
    color: var(--review-wrong-color);
}

@media (max-width: 400px) {
    h1 {
        font-size: 1.2rem;
    }

    .score-grid {
        grid-template-columns: 1fr;
    }

    .score-summary h2 {
        font-size: 2.2rem;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

/* ===== TABLET (iPad) ===== */
@media (max-width: 1024px) and (min-width: 601px) {
    .search-input {
        display: none;
    }
}

.dashboard-card {
    margin-bottom: 16px;
    padding: 14px;
    border-radius: 12px;
    border: 1px solid var(--card-border);
    background: var(--bg-card);
}

.dashboard-card h3 {
    margin: 0 0 10px;
}

/* ===== TOPIC PROGRESS ===== */
.topic-progress-panel {
    margin-bottom: 16px;
    padding: 14px;
    border-radius: 12px;
    border: 1px solid var(--card-border);
    background: var(--bg-card);
}

.topic-progress-panel h3 {
    margin: 0 0 12px;
}

.topic-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.topic-label {
    min-width: 130px;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.topic-bar-track {
    flex: 1;
    height: 10px;
    border-radius: 6px;
    background: var(--bg-progress);
    overflow: hidden;
}

.topic-bar-fill {
    height: 100%;
    border-radius: 6px;
    transition: width 0.4s ease;
}

.topic-bar-high {
    background: linear-gradient(90deg, #2ecc71, #27ae60);
}

.topic-bar-mid {
    background: linear-gradient(90deg, #f39c12, #e67e22);
}

.topic-bar-low {
    background: linear-gradient(90deg, #e74c3c, #c0392b);
}

.topic-pct {
    min-width: 40px;
    text-align: right;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(110px, 1fr));
    gap: 10px;
    margin-bottom: 10px;
}

.dashboard-cell {
    border-radius: 10px;
    border: 1px solid var(--dashboard-cell-border);
    background: var(--bg-dashboard-cell);
    padding: 10px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: default;
}

.dashboard-cell:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 18px var(--shadow-main);
}

.dashboard-cell strong {
    display: block;
    font-size: 1.35rem;
    color: var(--text-primary);
}

.dashboard-cell span {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.exam-tools label,
.exam-tools select {
    color: var(--text-secondary);
    font-weight: 600;
}

.exam-tools select {
    border: 1px solid var(--select-border);
    background: var(--bg-select);
    border-radius: 8px;
    padding: 9px 10px;
}

.exam-tools select:disabled {
    opacity: 0.5;
}

.exam-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 6px 0 4px;
}

.mode-badge,
.timer-text {
    display: inline-block;
    font-size: 0.84rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    border-radius: 999px;
    padding: 5px 10px;
}

.mode-badge {
    color: var(--mode-badge-color);
    background: var(--mode-badge-bg);
    border: 1px solid var(--mode-badge-border);
}

.timer-text {
    color: var(--timer-color);
    background: var(--timer-bg);
    border: 1px solid var(--timer-border);
}

.timer-text.warning {
    color: var(--timer-warn-color);
    background: var(--timer-warn-bg);
    border-color: var(--timer-warn-border);
}

.question-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 8px 0 14px;
}

/* ===== SUBMIT KNOP ===== */
#submit-btn {
    background: linear-gradient(145deg, #28a060 0%, #1e8a50 100%);
    border-color: rgba(80, 220, 150, 0.7);
    box-shadow: 0 4px 14px rgba(30, 138, 80, 0.4);
    font-size: 15px;
    letter-spacing: 0.02em;
}

#submit-btn:hover {
    background: linear-gradient(145deg, #30b870 0%, #23a05a 100%);
}

/* ===== SECTIES FADE-IN ===== */
#dashboard-view,
#year-list,
#subject-list,
#exam-list,
#exam-container {
    animation: fadeIn 0.25s ease;
}

#subject-list,
#exam-list {
    flex-direction: column;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.nav-dot {
    width: 38px;
    height: 38px;
    min-width: 38px;
    border-radius: 50%;
    border: 2px solid var(--nav-dot-border);
    background: var(--nav-dot-bg);
    color: var(--text-secondary);
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.nav-dot:hover {
    transform: scale(1.12);
    box-shadow: 0 0 8px rgba(110, 174, 255, 0.4);
}

.nav-dot.answered {
    border-color: rgba(89, 210, 162, 0.75);
    background: rgba(15, 77, 55, 0.5);
}

.nav-dot.correct {
    border-color: rgba(93, 231, 175, 0.9);
    background: rgba(17, 108, 73, 0.72);
    color: #d7ffe8;
}

.nav-dot.incorrect {
    border-color: rgba(255, 132, 132, 0.9);
    background: rgba(112, 34, 47, 0.75);
    color: #ffe2e2;
}

.nav-dot.flagged {
    border-color: rgba(255, 188, 104, 0.85);
    background: rgba(110, 71, 22, 0.58);
}

.nav-dot.active {
    box-shadow: 0 0 0 2px rgba(110, 174, 255, 0.6);
}

@media (max-width: 900px) {
    .dashboard-grid {
        grid-template-columns: repeat(2, minmax(120px, 1fr));
    }
}

@media (max-width: 600px) {
    .exam-meta {
        flex-direction: column;
        align-items: flex-start;
    }

    .main-nav {
        flex-direction: column;
    }

    .main-nav-btn {
        width: 100%;
    }

    .question-nav {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        gap: 6px;
        padding-bottom: 4px;
        justify-content: flex-start;
        align-items: center;
    }

    .nav-dot {
        width: 32px;
        height: 32px;
        min-width: 32px;
        font-size: 12px;
        flex-shrink: 0;
    }

    /* Terug-buttons onderaan op mobiel */
    #exam-list,
    #subject-list {
        flex-direction: column;
    }

    #exam-list .back-btn,
    #subject-list .back-btn {
        order: 99;
        margin-top: 16px;
        margin-bottom: 0;
    }

    .exam-tools {
        flex-direction: column;
        align-items: stretch;
    }

    .exam-tools label {
        margin-top: 4px;
    }

    .exam-tools select {
        width: 100%;
    }
}

/* ===== THEME TOGGLE ===== */
.user-bar-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

#theme-toggle-btn {
    background: transparent;
    border: 1px solid var(--card-border);
    color: var(--text-secondary);
    padding: 6px 12px;
    font-size: 13px;
    box-shadow: none;
    min-width: auto;
}

#theme-toggle-btn:hover {
    background: var(--option-hover-bg);
}

/* ===== COLOR-CODED HISTORY SCORES ===== */
.history-item.score-high {
    border-left: 4px solid #22c55e;
}

.history-item.score-mid {
    border-left: 4px solid #f59e0b;
}

.history-item.score-low {
    border-left: 4px solid #ef4444;
}

/* ===== HISTORY PAGINATION ===== */
.history-pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 12px;
}

.history-pagination button {
    min-width: auto;
    padding: 6px 14px;
    font-size: 13px;
}

.history-page-info {
    display: inline-flex;
    align-items: center;
    color: var(--text-muted);
    font-size: 13px;
}