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

:root {
    --primary: #667eea;
    --secondary: #764ba2;
    --success: #28a745;
    --danger: #dc3545;
    --warning: #ffc107;
    --info: #17a2b8;
    --light: #f8f9fa;
    --dark: #343a40;
    --border: #dee2e6;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: var(--dark);
    line-height: 1.6;
    min-height: 100vh;
}

.navbar {
    background: white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.navbar-brand {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
}

.navbar-brand:hover {
    color: var(--primary);
    opacity: 0.85;
}

.navbar-menu {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.nav-link {
    text-decoration: none;
    color: var(--dark);
    transition: color 0.3s;
}

.nav-link:hover {
    color: var(--primary);
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* ========== NAVBAR DROPDOWN ========== */
.nav-dropdown {
    position: relative;
}

.nav-dropdown-toggle {
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-size: inherit;
    padding: 0;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--dark);
    transition: color 0.3s;
}

.nav-dropdown-toggle:hover {
    color: var(--primary);
}

.nav-chevron {
    font-size: 0.65rem;
    transition: transform 0.2s;
}

.nav-dropdown.open .nav-chevron {
    transform: rotate(180deg);
}

.nav-dropdown-menu {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 0.75rem);
    background: white;
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.15);
    min-width: 280px;
    padding: 0.5rem 0;
    z-index: 2000;
    border: 1px solid rgba(0,0,0,0.07);
}

.nav-dropdown.open .nav-dropdown-menu {
    display: block;
}

.dropdown-section-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #999;
    padding: 0.5rem 1rem 0.25rem;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    color: var(--dark);
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
}

.dropdown-item:hover {
    background: #f4f6ff;
    color: var(--primary);
}

.dropdown-item .fa-external-link-alt,
.dropdown-item .fa-file-alt,
.dropdown-item .fa-calendar-alt,
.dropdown-item .fa-book-open {
    font-size: 0.75rem;
    color: var(--primary);
    flex-shrink: 0;
}

.dropdown-divider {
    height: 1px;
    background: #eee;
    margin: 0.4rem 0;
}

.dropdown-fact {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.3rem 1rem;
    font-size: 0.8rem;
    color: #555;
}

.dropdown-fact .fa-check-circle { color: #22c55e; }
.dropdown-fact .fa-star { color: #f59e0b; }
.dropdown-fact .fa-clock { color: var(--primary); }

.main-container {
    max-width: 1400px;
    margin: 2rem auto;
    padding: 0 2rem;
}

.footer {
    background: white;
    text-align: center;
    padding: 2rem;
    margin-top: 4rem;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
}

.footer-content {
    max-width: 1400px;
    margin: 0 auto;
}

.footer-content p {
    color: #666;
    margin: 0.5rem 0;
}

/* ========== AUTHENTICATION ========== */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 2rem;
}

.auth-card {
    background: white;
    padding: 3rem;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: 400px;
}

.auth-title {
    text-align: center;
    margin-bottom: 0.5rem;
    color: var(--primary);
}

.auth-subtitle {
    text-align: center;
    color: #666;
    margin-bottom: 2rem;
}

.auth-form {
    display: flex;
    flex-direction: column;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--dark);
}

.form-group input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 5px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 5px rgba(102, 126, 234, 0.3);
}

.auth-footer {
    text-align: center;
    margin-top: 2rem;
    color: #666;
}

.auth-footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

/* ========== BUTTONS ========== */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 5px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--secondary);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #e9ecef;
    color: var(--dark);
}

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

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #c82333;
}

.btn-warning {
    background: var(--warning);
    color: white;
}

.btn-warning:hover {
    background: #e0a800;
}

.btn-block {
    width: 100%;
}

/* ========== DASHBOARD ========== */
.dashboard-container {
    background: white;
    border-radius: 10px;
    padding: 2rem;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
}

/* ========== IAT COUNTDOWN BANNER ========== */
.iat-countdown-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1.5rem;
    background: linear-gradient(135deg, var(--primary) 0%, #1a1a6e 100%);
    color: white;
    border-radius: 10px;
    padding: 1.25rem 2rem;
    margin-bottom: 2rem;
}

.countdown-left {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.countdown-label {
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.countdown-date {
    font-size: 0.8rem;
    opacity: 0.8;
}

.countdown-units {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.countdown-unit {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    padding: 0.5rem 0.9rem;
    min-width: 60px;
}

.cu-val {
    font-size: 1.75rem;
    font-weight: 800;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.cu-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    opacity: 0.75;
    margin-top: 0.15rem;
}

.cu-sep {
    font-size: 1.5rem;
    font-weight: 700;
    opacity: 0.6;
    align-self: flex-start;
    padding-top: 0.3rem;
}

.countdown-over {
    width: 100%;
    text-align: center;
    font-size: 1.1rem;
    font-weight: 700;
    padding: 0.5rem 0;
}

@media (max-width: 600px) {
    .iat-countdown-banner {
        flex-direction: column;
        align-items: flex-start;
    }
    .countdown-units {
        width: 100%;
        justify-content: center;
    }
}

.page-title {
    margin-bottom: 2rem;
    color: var(--primary);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.stat-card {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    padding: 2rem;
    border-radius: 10px;
    text-align: center;
}

.stat-card i {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    opacity: 0.9;
}

.stat-card h3 {
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.stat-value {
    font-size: 2rem;
    font-weight: bold;
}

.mock-tests-section {
    margin-bottom: 3rem;
}

.mock-tests-section h2 {
    margin-bottom: 2rem;
    color: var(--dark);
}

.tests-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
}

.test-card {
    background: #f8f9fa;
    border: 2px solid var(--border);
    border-radius: 10px;
    padding: 2rem;
    transition: all 0.3s;
}

.test-card:hover {
    border-color: var(--primary);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.2);
}

.test-card h3 {
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.test-desc {
    color: #666;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.test-info {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    color: #666;
    font-size: 0.9rem;
}

.nta-info {
    color: var(--secondary);
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.marking-info {
    color: #666;
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

.recent-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 2rem;
}

.recent-table thead {
    background: var(--primary);
    color: white;
}

.recent-table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
}

.recent-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
}

.recent-table tr:hover {
    background: #f8f9fa;
}

.score {
    color: var(--success);
    font-weight: 600;
}

.correct {
    color: var(--success);
}

.wrong {
    color: var(--danger);
}

.unanswered {
    color: #999;
}

.link-button {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.link-button:hover {
    text-decoration: underline;
}

/* ========== EXAM INTERFACE ========== */
.exam-container {
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
    height: 90vh;
    display: flex;
    flex-direction: column;
}

.exam-header {
    background: var(--primary);
    color: white;
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.test-info h2 {
    margin-bottom: 0.25rem;
    color: white;
    font-size: 1.1rem;
}

.exam-header .test-info {
    color: white;
}

#question-counter {
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.9rem;
}

.timer-display {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.5rem;
    font-weight: bold;
}

.exam-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.exam-sidebar {
    width: 200px;
    background: #f8f9fa;
    border-right: 2px solid var(--border);
    padding: 1rem;
    overflow-y: auto;
}

.exam-sidebar h3 {
    margin-bottom: 1rem;
    color: var(--primary);
}

.section-tabs {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.section-tab {
    padding: 0.5rem;
    border: 1px solid var(--border);
    background: white;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s;
}

.section-tab.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.section-tab.section-locked {
    opacity: 0.45;
    cursor: not-allowed;
    color: #999;
    background: #f5f5f5;
    border-color: #ddd;
    text-decoration: line-through;
}

.section-tab.section-locked:hover {
    background: #f5f5f5;
    border-color: #ddd;
    color: #999;
}

.question-palette {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.5rem;
}

.palette-dot {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: bold;
    transition: all 0.3s;
}

.palette-dot.unanswered {
    background: #ddd;
    color: #666;
}

.palette-dot.answered {
    background: var(--success);
    color: white;
}

.palette-dot.marked {
    background: var(--warning);
    color: white;
}

.palette-dot.marked_and_answered {
    background: var(--secondary);
    color: white;
}

.exam-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 2rem;
    overflow-y: auto;
}

.question-display {
    flex: 1;
}

.section-label {
    color: var(--secondary);
    font-weight: 600;
    margin-bottom: 1rem;
}

.question-text {
    font-size: 1.1rem;
    margin-bottom: 2rem;
    line-height: 1.8;
}

.options-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
}

.option-label {
    display: flex;
    align-items: center;
    padding: 1rem;
    border: 2px solid var(--border);
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s;
}

.option-label:hover {
    border-color: var(--primary);
    background: #f8f9fa;
}

.option-label input[type="radio"] {
    margin-right: 1rem;
    cursor: pointer;
}

.option-label input[type="radio"]:checked + span {
    color: var(--primary);
    font-weight: 600;
}

.option-label input[type="radio"]:checked {
    border-color: var(--primary);
    background: #f0f4ff;
}

.review-checkbox {
    margin: 2rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.exam-navigation {
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 2px solid var(--border);
}

/* ========== RESULT PAGE ========== */
.result-container {
    background: white;
    border-radius: 10px;
    padding: 2rem;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    max-width: 1100px;
    margin: 0 auto;
}

/* --- Header row --- */
.result-title-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
}
.result-title-row h1 {
    font-size: 1.4rem;
    color: #1a1a1a;
    margin: 0 0 0.2rem;
}
.result-date {
    color: #888;
    font-size: 0.85rem;
}
.result-actions {
    display: flex;
    gap: 0.75rem;
    flex-shrink: 0;
}

/* --- Score band --- */
.result-scoreband {
    display: flex;
    align-items: center;
    gap: 0;
    background: #f8f9fa;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 1rem 1.5rem;
    margin-bottom: 1.5rem;
}
.scoreband-score {
    display: flex;
    align-items: baseline;
    gap: 0.3rem;
    padding-right: 1.5rem;
}
.scoreband-big {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1;
}
.scoreband-denom {
    font-size: 1rem;
    color: #666;
}
.scoreband-pct {
    font-size: 1.1rem;
    font-weight: 600;
    color: #444;
    margin-left: 0.5rem;
}
.scoreband-divider {
    width: 1px;
    height: 2.5rem;
    background: #d1d5db;
    margin: 0 1.5rem;
}
.scoreband-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0 1.25rem;
    border-right: 1px solid #e5e7eb;
}
.scoreband-stat:last-child {
    border-right: none;
}
.scoreband-num {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1;
}
.scoreband-label {
    font-size: 0.75rem;
    color: #888;
    margin-top: 0.2rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.correct-stat .scoreband-num { color: #16a34a; }
.wrong-stat   .scoreband-num { color: #dc2626; }
.skip-stat    .scoreband-num { color: #888; }
.time-stat    .scoreband-num { color: #2563eb; }

/* --- Filters --- */
.filter-section {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
    align-items: center;
}
.filter-btn {
    padding: 0.35rem 0.9rem;
    border: 1px solid #d1d5db;
    background: white;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.85rem;
    color: #444;
    transition: all 0.2s;
}
.filter-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* --- Question list --- */
.questions-review {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Each question row */
.question-review {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 0;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    border-left: 4px solid #d1d5db;
}
.question-review.correct  { border-left-color: #16a34a; }
.question-review.wrong    { border-left-color: #dc2626; }
.question-review.unanswered { border-left-color: #9ca3af; }

/* Left panel: question + options */
.qr-left {
    padding: 1rem 1.25rem;
    background: #fff;
    border-right: 1px solid #e5e7eb;
}
.qr-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.6rem;
}
.qr-num {
    font-weight: 700;
    font-size: 0.8rem;
    color: #fff;
    background: #4b5563;
    border-radius: 4px;
    padding: 0.1rem 0.45rem;
}
.qr-section {
    font-size: 0.78rem;
    color: #6b7280;
    background: #f3f4f6;
    border-radius: 4px;
    padding: 0.1rem 0.45rem;
}
.qr-diff {
    font-size: 0.72rem;
    border-radius: 4px;
    padding: 0.1rem 0.45rem;
    text-transform: capitalize;
}
.diff-easy   { background: #dcfce7; color: #166534; }
.diff-medium { background: #fef9c3; color: #854d0e; }
.diff-hard   { background: #fee2e2; color: #991b1b; }

.qr-text {
    color: #1a1a1a;
    font-size: 0.95rem;
    line-height: 1.55;
    margin: 0 0 0.85rem;
}

/* Options A B C D */
.opts-list {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}
.opt-row {
    display: flex;
    align-items: baseline;
    gap: 0.6rem;
    padding: 0.5rem 0.75rem;
    border-radius: 5px;
    border: 1px solid #e5e7eb;
    background: #fafafa;
    font-size: 0.9rem;
    color: #1a1a1a;
}
.opt-row.opt-correct {
    background: #f0fdf4;
    border-color: #86efac;
    color: #14532d;
}
.opt-row.opt-wrong {
    background: #fff1f2;
    border-color: #fca5a5;
    color: #7f1d1d;
}
.opt-key {
    font-weight: 700;
    font-size: 0.85rem;
    min-width: 1.4rem;
    color: inherit;
}
.opt-val {
    flex: 1;
    color: inherit;
}
.opt-badge {
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: auto;
    white-space: nowrap;
}
.opt-badge-correct { color: #16a34a; }
.opt-badge-wrong   { color: #dc2626; }

/* Right panel: verdict + explanation */
.qr-right {
    padding: 1rem 1.25rem;
    background: #fafafa;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.ans-line {
    font-size: 0.85rem;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.ans-correct { color: #16a34a; }
.ans-wrong   { color: #dc2626; }
.ans-skip    { color: #6b7280; }

.qr-explanation {
    flex: 1;
}
.exp-heading {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6b7280;
    margin: 0 0 0.4rem;
}
.qr-explanation p:last-child {
    font-size: 0.88rem;
    color: #1a1a1a;
    line-height: 1.55;
    margin: 0;
}

/* ========== HISTORY PAGE ========== */
.history-container {
    background: white;
    border-radius: 10px;
    padding: 2rem;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
}

.history-filters {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    align-items: center;
}

.history-filters select,
.history-filters input {
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 5px;
}

.history-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    margin-bottom: 2rem;
}

.history-stat {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    padding: 2rem;
    border-radius: 10px;
    text-align: center;
}

.history-stat i {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.history-stat span {
    display: block;
    font-size: 2rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.history-table {
    width: 100%;
    border-collapse: collapse;
}

.history-table thead {
    background: var(--primary);
    color: white;
}

.history-table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
}

.history-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
}

.history-table tbody tr:hover {
    background: #f8f9fa;
}

.status {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.85rem;
}

.status.pass {
    background: #d4edda;
    color: var(--success);
}

.status.fail {
    background: #f8d7da;
    color: var(--danger);
}

/* ========== NOTIFICATIONS ========== */
.notification {
    position: fixed;
    top: 80px;
    right: 20px;
    background: white;
    padding: 1rem 1.5rem;
    border-radius: 5px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    max-width: 300px;
    word-wrap: break-word;
    display: none;
    z-index: 2000;
}

.notification.show {
    display: block;
    animation: slideIn 0.3s ease-in-out;
}

.notification.success {
    border-left: 4px solid var(--success);
    color: var(--success);
}

.notification.error {
    border-left: 4px solid var(--danger);
    color: var(--danger);
}

.notification.warning {
    border-left: 4px solid var(--warning);
    color: var(--warning);
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ========== MODAL ========== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: white;
    padding: 2rem;
    border-radius: 10px;
    max-width: 500px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.modal-content h3 {
    margin-bottom: 1rem;
    color: var(--primary);
}

.modal-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
    justify-content: flex-end;
}

/* ========== ALERTS ========== */
.alert {
    padding: 1rem;
    border-radius: 5px;
    margin-bottom: 1rem;
}

.alert-success {
    background: #d4edda;
    color: var(--success);
    border-left: 4px solid var(--success);
}

.alert-error {
    background: #f8d7da;
    color: var(--danger);
    border-left: 4px solid var(--danger);
}

.logout-btn {
    background: var(--danger);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 5px;
}

.logout-btn:hover {
    background: #c82333;
}

/* Source badge for questions */
.source-badge {
    display: inline-block;
    background: #eff6ff;
    color: #1d4ed8;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.75em;
    font-weight: 600;
    margin-bottom: 8px;
    border: 1px solid #bfdbfe;
}

.qr-source {
    display: inline-block;
    background: #eff6ff;
    color: #1d4ed8;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.75em;
    font-weight: 500;
    border: 1px solid #bfdbfe;
}

/* HTML content in options */
.option-content {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    flex: 1;
}

.option-value {
    flex: 1;
}

.option-value table {
    border-collapse: collapse;
    margin: 5px 0;
    font-size: 0.9em;
}

.option-value table td,
.option-value table th {
    border: 1px solid #d1d5db;
    padding: 4px 8px;
}

.option-value img,
.option-value svg {
    max-width: 100%;
    height: auto;
}

/* Question text HTML support */
.question-text table {
    border-collapse: collapse;
    margin: 10px 0;
    width: 100%;
    max-width: 600px;
}

.question-text table td,
.question-text table th {
    border: 1px solid #d1d5db;
    padding: 6px 12px;
    text-align: left;
}

.question-text table th {
    background: #f3f4f6;
    font-weight: 600;
}

.question-text ol,
.question-text ul {
    margin: 8px 0;
    padding-left: 24px;
}

.question-text img,
.question-text svg {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 10px auto;
}

.question-text p {
    margin: 6px 0;
}

/* Results page HTML support */
.qr-text table {
    border-collapse: collapse;
    margin: 8px 0;
    font-size: 0.9em;
}

.qr-text table td,
.qr-text table th {
    border: 1px solid #d1d5db;
    padding: 4px 8px;
}

.qr-text img,
.qr-text svg {
    max-width: 100%;
    height: auto;
}

.opts-list .opt-val table {
    border-collapse: collapse;
    margin: 3px 0;
    font-size: 0.85em;
}

.opts-list .opt-val table td {
    border: 1px solid #d1d5db;
    padding: 2px 6px;
}

@media (max-width: 768px) {
    .exam-content {
        flex-direction: column;
    }

    .exam-sidebar {
        width: 100%;
        height: 150px;
    }

    .stats-grid, .history-stats {
        grid-template-columns: 1fr;
    }

    .result-scoreband {
        flex-wrap: wrap;
        gap: 0.75rem;
    }
    .scoreband-divider { display: none; }

    .question-review {
        grid-template-columns: 1fr;
    }
    .qr-left { border-right: none; border-bottom: 1px solid #e5e7eb; }
}
