/* ==========================================================================
   РЭУС Educational Testing Platform - Modern Dark Design System
   ========================================================================== */

:root {
    --bg-main: #0a0e17;
    --bg-surface: #111827;
    --bg-card: #162032;
    --bg-card-hover: #1c293f;
    --bg-input: #0d1424;
    --border-color: rgba(255, 255, 255, 0.08);
    --border-highlight: rgba(56, 189, 248, 0.35);

    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    --accent-blue: #38bdf8;
    --accent-blue-hover: #0ea5e9;
    --accent-cyan: #06b6d4;

    --grade-5: #10b981;
    --grade-5-bg: rgba(16, 185, 129, 0.15);
    --grade-4: #3b82f6;
    --grade-4-bg: rgba(59, 130, 246, 0.15);
    --grade-3: #f59e0b;
    --grade-3-bg: rgba(245, 158, 11, 0.15);
    --grade-2: #ef4444;
    --grade-2-bg: rgba(239, 68, 68, 0.15);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;

    --shadow-card: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px rgba(56, 189, 248, 0.15);
}

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

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ==========================================================================
   Header & Navigation
   ========================================================================== */

.site-header {
    background-color: rgba(17, 24, 39, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 12px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: inherit;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #0ea5e9, #38bdf8);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    box-shadow: 0 0 15px rgba(14, 165, 233, 0.3);
}

.logo-text {
    display: flex;
    flex-direction: column;
}

.logo-title {
    font-weight: 700;
    font-size: 16px;
    letter-spacing: -0.2px;
    color: #fff;
}

.logo-subtitle {
    font-size: 12px;
    color: var(--text-secondary);
}

.header-nav {
    display: flex;
    gap: 12px;
}

.nav-link {
    text-decoration: none;
    color: var(--text-secondary);
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.nav-link:hover, .nav-link.active {
    color: #fff;
    background-color: rgba(255, 255, 255, 0.05);
}

.teacher-badge {
    border: 1px solid var(--border-color);
    background: rgba(56, 189, 248, 0.05);
}

.teacher-badge:hover {
    border-color: var(--accent-blue);
    color: var(--accent-blue);
}

/* ==========================================================================
   Main Layout Container
   ========================================================================== */

.main-content {
    flex: 1;
    padding: 32px 20px;
}

.page-container {
    max-width: 1100px;
    margin: 0 auto;
}

/* ==========================================================================
   Hero Section
   ========================================================================== */

.hero-section {
    text-align: center;
    margin-bottom: 48px;
}

.hero-badge {
    display: inline-block;
    padding: 6px 16px;
    background: rgba(56, 189, 248, 0.1);
    color: var(--accent-blue);
    border: 1px solid rgba(56, 189, 248, 0.25);
    border-radius: 9999px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.5px;
    margin-bottom: 16px;
}

.hero-title {
    font-size: 36px;
    font-weight: 800;
    letter-spacing: -0.5px;
    margin-bottom: 14px;
    background: linear-gradient(180deg, #ffffff 0%, #cbd5e1 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-desc {
    font-size: 17px;
    color: var(--text-secondary);
    max-width: 760px;
    margin: 0 auto 28px;
    line-height: 1.7;
}

.highlight-text {
    color: var(--accent-blue);
}

.rules-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    max-width: 900px;
    margin: 0 auto;
    box-shadow: var(--shadow-card);
    text-align: left;
}

.rules-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.rules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.rule-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 14px;
    color: var(--text-secondary);
}

.rule-icon {
    font-size: 18px;
}

/* ==========================================================================
   Tests Grid
   ========================================================================== */

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.section-title {
    font-size: 22px;
    font-weight: 700;
}

.section-counter {
    font-size: 14px;
    color: var(--text-muted);
}

.tests-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 24px;
}

.test-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 28px;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-card);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.test-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #0ea5e9, #38bdf8);
    opacity: 0.8;
}

.test-card:hover {
    transform: translateY(-4px);
    border-color: var(--border-highlight);
    box-shadow: var(--shadow-glow), var(--shadow-card);
}

.test-card-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.topic-pill {
    background: rgba(56, 189, 248, 0.15);
    color: var(--accent-blue);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

.time-limit-badge {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-secondary);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
}

.test-card-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 12px;
    line-height: 1.4;
    color: #fff;
}

.test-card-desc {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 24px;
    flex: 1;
    line-height: 1.6;
}

.test-card-meta {
    display: flex;
    justify-content: space-between;
    border-top: 1px solid var(--border-color);
    padding-top: 16px;
    margin-bottom: 20px;
    font-size: 13px;
}

.meta-item {
    display: flex;
    flex-direction: column;
}

.meta-label {
    color: var(--text-muted);
}

.meta-value {
    color: var(--text-primary);
    font-weight: 600;
}

.start-test-btn {
    background: linear-gradient(135deg, #0284c7, #0ea5e9);
    color: #fff;
    text-decoration: none;
    padding: 12px 20px;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease;
}

.start-test-btn:hover {
    background: linear-gradient(135deg, #0ea5e9, #38bdf8);
    box-shadow: 0 4px 15px rgba(14, 165, 233, 0.4);
}

.start-test-btn .arrow {
    transition: transform 0.2s ease;
}

.start-test-btn:hover .arrow {
    transform: translateX(4px);
}

/* ==========================================================================
   Testing Interface (test.html)
   ========================================================================== */

.test-container {
    max-width: 900px;
    margin: 0 auto;
}

.test-status-bar {
    position: sticky;
    top: 65px;
    z-index: 90;
    background: rgba(17, 24, 39, 0.95);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px 20px;
    margin-bottom: 24px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
}

.status-bar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.status-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.topic-tag {
    background: rgba(56, 189, 248, 0.15);
    color: var(--accent-blue);
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
}

.status-test-title {
    font-size: 14px;
    font-weight: 600;
    max-width: 320px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.status-center {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 160px;
}

.progress-info {
    font-size: 12px;
    color: var(--text-secondary);
}

.progress-bar-bg {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 999px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #0ea5e9, #10b981);
    transition: width 0.3s ease;
}

.timer-box {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.05);
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

.timer-digits {
    font-family: 'JetBrains Mono', monospace;
    font-size: 17px;
    font-weight: 700;
    color: #fff;
}

.timer-box.warning {
    border-color: #f59e0b;
    background: rgba(245, 158, 11, 0.15);
}

.timer-box.warning .timer-digits {
    color: #fbbf24;
}

.timer-box.danger {
    border-color: #ef4444;
    background: rgba(239, 68, 68, 0.2);
    animation: pulse 1s infinite;
}

.timer-box.danger .timer-digits {
    color: #f87171;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* Student Info Card */

.student-info-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-card);
}

.card-section-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 4px;
}

.card-section-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 18px;
}

.form-row {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group.flex-1 { flex: 1; min-width: 180px; }
.form-group.flex-2 { flex: 2; min-width: 260px; }

label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}

.req {
    color: #ef4444;
}

.custom-input, .custom-select {
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    color: #fff;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: all 0.2s ease;
}

.custom-input:focus, .custom-select:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2);
}

.custom-input.error {
    border-color: #ef4444;
}

.input-hint {
    font-size: 12px;
    color: var(--text-muted);
}

.input-hint.error {
    color: #f87171;
}

/* Question Cards */

.question-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-card);
    transition: border-color 0.2s ease;
}

.question-card.answered {
    border-left: 4px solid var(--accent-blue);
}

.q-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.q-number {
    font-size: 13px;
    font-weight: 700;
    color: var(--accent-blue);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.q-badge {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
}

.q-badge.answered {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
}

.q-text {
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    line-height: 1.5;
    margin-bottom: 20px;
}

.options-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.option-label {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background-color: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    padding: 14px 16px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
}

.option-label:hover {
    background-color: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.2);
}

.option-radio {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.option-custom-radio {
    width: 18px;
    height: 18px;
    border: 2px solid var(--text-muted);
    border-radius: 50%;
    margin-top: 2px;
    flex-shrink: 0;
    display: inline-block;
    transition: all 0.2s ease;
    position: relative;
}

.option-radio:checked + .option-custom-radio {
    border-color: var(--accent-blue);
    background-color: var(--accent-blue);
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.5);
}

.option-radio:checked + .option-custom-radio::after {
    content: '';
    position: absolute;
    top: 4px;
    left: 4px;
    width: 6px;
    height: 6px;
    background: #fff;
    border-radius: 50%;
}

.option-label:has(.option-radio:checked) {
    background: rgba(56, 189, 248, 0.08);
    border-color: var(--accent-blue);
}

.option-text {
    font-size: 14px;
    color: var(--text-primary);
    line-height: 1.5;
}

/* Submit Panel */

.submit-panel {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    text-align: center;
    box-shadow: var(--shadow-card);
    margin-top: 32px;
}

.submit-hints {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.primary-btn {
    background: linear-gradient(135deg, #0284c7, #0ea5e9);
    color: #fff;
    border: none;
    border-radius: var(--radius-md);
    padding: 14px 28px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.2s ease;
}

.primary-btn:hover {
    background: linear-gradient(135deg, #0ea5e9, #38bdf8);
    box-shadow: 0 6px 20px rgba(14, 165, 233, 0.4);
}

.primary-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.secondary-btn {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    text-decoration: none;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.secondary-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* ==========================================================================
   Results View
   ========================================================================== */

.hidden {
    display: none !important;
}

.result-header-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 36px 24px;
    text-align: center;
    box-shadow: var(--shadow-card);
    margin-bottom: 32px;
}

.result-icon-badge {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
}

.result-title {
    font-size: 26px;
    font-weight: 800;
    margin-bottom: 6px;
}

.result-student-info {
    font-size: 15px;
    color: var(--text-secondary);
    margin-bottom: 28px;
}

.score-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    max-width: 650px;
    margin: 0 auto 32px;
}

.score-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.score-label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.score-value {
    font-size: 28px;
    font-weight: 800;
    color: #fff;
    font-family: 'JetBrains Mono', monospace;
}

.score-value.grade-num {
    font-size: 36px;
}

.grade-5 { color: var(--grade-5) !important; }
.grade-4 { color: var(--grade-4) !important; }
.grade-3 { color: var(--grade-3) !important; }
.grade-2 { color: var(--grade-2) !important; }

.score-subtext {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.result-actions {
    display: flex;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
}

/* Review Questions */

.review-heading {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 20px;
    padding-left: 4px;
}

.review-item-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 22px;
    margin-bottom: 18px;
    box-shadow: var(--shadow-card);
}

.review-item-card.is-correct {
    border-left: 5px solid var(--grade-5);
}

.review-item-card.is-wrong {
    border-left: 5px solid var(--grade-2);
}

.review-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.review-status-badge {
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 700;
}

.review-status-badge.correct {
    background: var(--grade-5-bg);
    color: var(--grade-5);
}

.review-status-badge.wrong {
    background: var(--grade-2-bg);
    color: var(--grade-2);
}

.review-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 16px 0;
}

.review-opt {
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    border: 1px solid transparent;
}

.review-opt.normal {
    background: rgba(255, 255, 255, 0.02);
    color: var(--text-secondary);
}

.review-opt.user-chosen-wrong {
    background: var(--grade-2-bg);
    border-color: rgba(239, 68, 68, 0.4);
    color: #fca5a5;
}

.review-opt.is-correct-target {
    background: var(--grade-5-bg);
    border-color: rgba(16, 185, 129, 0.4);
    color: #6ee7b7;
    font-weight: 600;
}

.explanation-box {
    background: rgba(56, 189, 248, 0.08);
    border: 1px solid rgba(56, 189, 248, 0.2);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    margin-top: 14px;
    font-size: 13.5px;
    line-height: 1.6;
    color: #e0f2fe;
}

.explanation-title {
    font-weight: 700;
    color: var(--accent-blue);
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ==========================================================================
   Teacher Auth Page
   ========================================================================== */

.auth-page-container {
    max-width: 440px;
    margin: 60px auto;
}

.auth-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 36px 30px;
    box-shadow: var(--shadow-card);
    text-align: center;
}

.auth-icon {
    font-size: 40px;
    margin-bottom: 12px;
}

.auth-title {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 6px;
}

.auth-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.auth-error-banner {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    text-align: left;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
    text-align: left;
}

.pin-input {
    letter-spacing: 6px;
    font-size: 20px;
    text-align: center;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
}

.auth-submit-btn {
    width: 100%;
}

.auth-footer-help {
    margin-top: 24px;
}

.back-link {
    font-size: 13px;
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s ease;
}

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

/* ==========================================================================
   Teacher Dashboard
   ========================================================================== */

.teacher-dashboard-container {
    max-width: 1300px;
    margin: 0 auto;
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 28px;
    flex-wrap: wrap;
    gap: 16px;
}

.dashboard-badge {
    background: rgba(56, 189, 248, 0.15);
    color: var(--accent-blue);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    display: inline-block;
    margin-bottom: 6px;
}

.dashboard-title {
    font-size: 28px;
    font-weight: 800;
}

.dashboard-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
}

.dashboard-actions {
    display: flex;
    gap: 12px;
}

.excel-download-btn {
    background: linear-gradient(135deg, #15803d, #16a34a);
    color: #fff;
    text-decoration: none;
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.excel-download-btn:hover {
    background: linear-gradient(135deg, #16a34a, #22c55e);
    box-shadow: 0 4px 15px rgba(22, 163, 74, 0.4);
}

.logout-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    text-decoration: none;
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.logout-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

/* Stats Overview */

.stats-overview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: var(--shadow-card);
}

.stat-icon-wrapper {
    width: 46px;
    height: 46px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.stat-icon-wrapper.blue { background: rgba(59, 130, 246, 0.15); color: #60a5fa; }
.stat-icon-wrapper.cyan { background: rgba(6, 182, 212, 0.15); color: #22d3ee; }
.stat-icon-wrapper.purple { background: rgba(168, 85, 247, 0.15); color: #c084fc; }
.stat-icon-wrapper.green { background: rgba(16, 185, 129, 0.15); color: #34d399; }
.stat-icon-wrapper.yellow { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-val {
    font-size: 22px;
    font-weight: 800;
    font-family: 'JetBrains Mono', monospace;
    color: #fff;
}

.stat-name {
    font-size: 12px;
    color: var(--text-muted);
}

/* Grade Distribution */

.grade-distribution-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px 20px;
    margin-bottom: 24px;
}

.distrib-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.distrib-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}

.grade-pills {
    display: flex;
    gap: 10px;
}

.grade-badge-count {
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
}

.grade-badge-count.grade-5 { background: var(--grade-5-bg); color: var(--grade-5); border: 1px solid rgba(16, 185, 129, 0.3); }
.grade-badge-count.grade-4 { background: var(--grade-4-bg); color: var(--grade-4); border: 1px solid rgba(59, 130, 246, 0.3); }
.grade-badge-count.grade-3 { background: var(--grade-3-bg); color: var(--grade-3); border: 1px solid rgba(245, 158, 11, 0.3); }
.grade-badge-count.grade-2 { background: var(--grade-2-bg); color: var(--grade-2); border: 1px solid rgba(239, 68, 68, 0.3); }

/* Table Controls */

.table-controls-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.filter-group, .search-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.search-input-wrapper {
    position: relative;
}

.search-icon {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 13px;
    color: var(--text-muted);
}

.refresh-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 9px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
}

.refresh-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Journal Table */

.journal-table-wrapper {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow-x: auto;
    box-shadow: var(--shadow-card);
}

.journal-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
    text-align: left;
}

.journal-table th {
    background: rgba(17, 24, 39, 0.9);
    padding: 14px 16px;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-color);
}

.journal-table td {
    padding: 14px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.journal-table tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

.col-center { text-align: center; }
.text-mono { font-family: 'JetBrains Mono', monospace; }
.text-muted { color: var(--text-muted); }

.grade-pill {
    display: inline-block;
    width: 28px;
    height: 28px;
    line-height: 28px;
    text-align: center;
    border-radius: 50%;
    font-weight: 800;
    font-family: 'JetBrains Mono', monospace;
}

.grade-pill-5 { background: var(--grade-5-bg); color: var(--grade-5); border: 1px solid rgba(16, 185, 129, 0.4); }
.grade-pill-4 { background: var(--grade-4-bg); color: var(--grade-4); border: 1px solid rgba(59, 130, 246, 0.4); }
.grade-pill-3 { background: var(--grade-3-bg); color: var(--grade-3); border: 1px solid rgba(245, 158, 11, 0.4); }
.grade-pill-2 { background: var(--grade-2-bg); color: var(--grade-2); border: 1px solid rgba(239, 68, 68, 0.4); }

.actions-cell {
    display: flex;
    justify-content: center;
    gap: 8px;
}

.action-btn {
    border: none;
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.view-btn {
    background: rgba(56, 189, 248, 0.15);
    color: var(--accent-blue);
    border: 1px solid rgba(56, 189, 248, 0.3);
}

.view-btn:hover {
    background: var(--accent-blue);
    color: #0b0f17;
}

.delete-btn {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.delete-btn:hover {
    background: #ef4444;
    color: #fff;
}

.empty-state {
    padding: 60px 20px !important;
    text-align: center;
}

.empty-state-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    color: var(--text-muted);
}

.empty-icon {
    font-size: 36px;
}

/* Modal */

.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(6px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-dialog {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 800px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
    overflow: hidden;
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    background: var(--bg-card);
}

.modal-title {
    font-size: 18px;
    font-weight: 700;
}

.modal-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
}

.modal-close-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
    padding: 4px;
}

.modal-close-btn:hover {
    color: #fff;
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

/* ==========================================================================
   Footer
   ========================================================================== */

.site-footer {
    border-top: 1px solid var(--border-color);
    padding: 20px 24px;
    font-size: 13px;
    color: var(--text-muted);
    background: var(--bg-surface);
    margin-top: auto;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.footer-sep {
    margin: 0 8px;
}

/* ==========================================================================
   Responsive Adaptations
   ========================================================================== */

@media (max-width: 768px) {
    .hero-title { font-size: 26px; }
    .hero-desc { font-size: 15px; }
    .test-status-bar { top: 60px; }
    .status-left { flex-direction: column; align-items: flex-start; gap: 4px; }
    .status-test-title { max-width: 200px; }
    .dashboard-header { flex-direction: column; align-items: flex-start; }
    .dashboard-actions { width: 100%; justify-content: space-between; }
}

@media print {
    .site-header, .site-footer, .result-actions, .test-status-bar {
        display: none !important;
    }
    body {
        background: #fff !important;
        color: #000 !important;
    }
    .result-header-card, .review-item-card {
        border: 1px solid #ccc !important;
        background: #fff !important;
        color: #000 !important;
        box-shadow: none !important;
    }
    .score-value, .q-text, .result-title {
        color: #000 !important;
    }
}
