/* Global Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

:root {
    --primary: #1e40af;
    --secondary: #3b82f6;
    --accent: #60a5fa;
    --dark: #1e293b;
    --light: #f1f5f9;
    --white: #ffffff;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --gray: #64748b;
}

[data-theme="dark"] {
    --primary: #60a5fa;
    --secondary: #3b82f6;
    --accent: #93c5fd;
    --dark: #e2e8f0;
    --light: #020617;
    --white: #111827;
    --success: #34d399;
    --warning: #fbbf24;
    --danger: #f87171;
    --gray: #94a3b8;
}

html {
    scroll-behavior: smooth;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: var(--light);
    color: var(--dark);
}

a {
    text-decoration: none;
    color: inherit;
}

ul {
    list-style: none;
}

/* Header */
header {
    background: var(--white);
    padding: 1rem 5%;
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

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

.logo span {
    color: var(--secondary);
}

nav {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

nav ul {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.nav-auth {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-left: auto;
}

.theme-toggle {
    min-width: 100px;
    padding: 0.5rem 0.85rem;
    font-size: 0.85rem;
}

.nav-user-name {
    color: var(--gray);
    font-size: 0.9rem;
    white-space: nowrap;
}

nav a {
    color: var(--dark);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s;
    padding: 0.5rem 0;
}

nav a:hover,
nav a.active {
    color: var(--primary);
}

nav a.active {
    border-bottom: 3px solid var(--primary);
}

.menu-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
}

.menu-toggle span {
    width: 25px;
    height: 3px;
    background: var(--dark);
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 1rem;
}

.btn:hover {
    background: var(--secondary);
    transform: translateY(-2px);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
}

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

.btn-disabled {
    background: #cbd5e1;
    color: #475569;
    cursor: not-allowed;
    pointer-events: none;
    border-color: #cbd5e1;
}

.btn-success {
    background: var(--success);
}

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

/* Main */
main {
    flex: 1;
    margin-top: 70px;
}

/* Hero */
.hero {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    padding: 4rem 10%;
    text-align: center;
}

.hero h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.hero p {
    font-size: 1.2rem;
    max-width: 700px;
    margin: 0 auto 2rem;
    opacity: 0.9;
}

.hero-stats {
    display: flex;
    justify-content: center;
    gap: 3rem;
    margin-top: 2rem;
}

.hero-stat {
    text-align: center;
}

.hero-stat h3 {
    font-size: 2rem;
    color: #fbbf24;
}

.hero-stat p {
    font-size: 0.9rem;
    margin-bottom: 0;
}

/* Section */
section {
    padding: 4rem 10%;
}

.section-title {
    text-align: center;
    margin-bottom: 3rem;
}

.section-title h2 {
    font-size: 2rem;
    color: var(--dark);
    margin-bottom: 0.5rem;
}

.section-title p {
    color: var(--gray);
}

/* Cards Grid */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.card {
    background: var(--white);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    transition: transform 0.3s, box-shadow 0.3s;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.12);
}

[data-theme="dark"] header,
[data-theme="dark"] .card,
[data-theme="dark"] .dashboard-card,
[data-theme="dark"] .exam-header,
[data-theme="dark"] .question-container,
[data-theme="dark"] .result-stat,
[data-theme="dark"] .answer-review,
[data-theme="dark"] .callback-card {
    background: var(--white);
    color: var(--dark);
    box-shadow: 0 10px 30px rgba(0,0,0,0.28);
}

[data-theme="dark"] .btn-outline {
    border-color: var(--accent);
    color: var(--accent);
}

[data-theme="dark"] .btn-outline:hover {
    background: var(--accent);
    color: #0f172a;
}

[data-theme="dark"] .review-topic-filter {
    background: rgba(148, 163, 184, 0.08);
    color: var(--dark);
    border-color: rgba(148, 163, 184, 0.22);
}

[data-theme="dark"] .option {
    border-color: rgba(148, 163, 184, 0.18);
    background: rgba(148, 163, 184, 0.04);
}

[data-theme="dark"] .option:hover {
    background: rgba(96, 165, 250, 0.12);
}

[data-theme="dark"] .option.selected {
    background: rgba(96, 165, 250, 0.18);
}

[data-theme="dark"] .progress-bar {
    background: rgba(148, 163, 184, 0.16);
}

[data-theme="dark"] section[style*="background: white"] {
    background: var(--light) !important;
}

[data-theme="dark"] div[style*="background: white"] {
    background: var(--white) !important;
    color: var(--dark);
}

[data-theme="dark"] a[style*="background: white"] {
    background: var(--white) !important;
    color: var(--primary) !important;
}

[data-theme="dark"] input,
[data-theme="dark"] textarea,
[data-theme="dark"] select {
    background: #0b1220;
    color: var(--dark);
    border-color: rgba(148, 163, 184, 0.24);
}

[data-theme="dark"] footer {
    background: #010409;
}

.card-icon {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    font-weight: 700;
    line-height: 1;
    text-align: center;
    margin-bottom: 1rem;
}

.feature-icon {
    font-size: 1rem;
    letter-spacing: 0.03em;
}

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

.card p {
    color: var(--gray);
    line-height: 1.6;
    margin-bottom: 1rem;
}

.card-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.85rem;
    color: var(--gray);
    margin-bottom: 1rem;
}

.card-meta span {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

/* Subject Cards */
.subject-card {
    text-align: center;
    padding: 2rem;
}

.subject-card .icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.subject-card h3 {
    font-size: 1.2rem;
}

.subject-card .questions {
    color: var(--secondary);
    font-weight: 600;
    margin-top: 0.5rem;
}

/* Test Card */
.test-card {
    border-left: 4px solid var(--primary);
}

.test-card .duration {
    display: inline-block;
    background: var(--light);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    color: var(--gray);
    margin-bottom: 0.5rem;
}

.test-card .questions-count {
    font-weight: 600;
    color: var(--dark);
}

.test-card .btn {
    margin-top: 1rem;
    width: 100%;
}

/* Exam Page */
.exam-container {
    max-width: 900px;
    margin: 0 auto;
}

.exam-header {
    background: var(--white);
    padding: 1.5rem 2rem;
    border-radius: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
}

.timer {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.3rem;
    font-weight: bold;
    color: var(--primary);
}

.timer.warning {
    color: var(--warning);
}

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

.question-container {
    background: var(--white);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    margin-bottom: 2rem;
}

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

.question-text {
    font-size: 1.1rem;
    color: var(--dark);
    margin-bottom: 1.5rem;
    line-height: 1.7;
}

.options {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.option {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
}

.option:hover {
    border-color: var(--secondary);
    background: var(--light);
}

.option.selected {
    border-color: var(--primary);
    background: #eff6ff;
}

.option input {
    margin-top: 0.25rem;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.option label {
    cursor: pointer;
    flex: 1;
    line-height: 1.5;
}

.exam-footer {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
}

.exam-footer .btn {
    min-width: 120px;
}

/* Results Page */
.results-summary {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.result-stat {
    background: var(--white);
    padding: 1.5rem;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
}

.result-stat h4 {
    color: var(--gray);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

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

.result-stat.passed .value {
    color: var(--success);
}

.result-stat.failed .value {
    color: var(--danger);
}

.result-stat .label {
    font-size: 0.8rem;
    color: var(--gray);
    margin-top: 0.25rem;
}

.answer-review {
    background: var(--white);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
}

.answer-review h3 {
    margin-bottom: 1.5rem;
    color: var(--dark);
}

.review-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1rem;
}

.review-toolbar {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.review-filter-group {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

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

.review-topic-filter {
    min-width: 220px;
    padding: 0.75rem 0.9rem;
    border-radius: 10px;
    border: 1px solid #cbd5e1;
    background: var(--white);
    color: var(--dark);
}

.review-item {
    padding: 1rem;
    border-bottom: 1px solid #e2e8f0;
}

.review-item:last-child {
    border-bottom: none;
}

.review-item.correct {
    border-left: 4px solid var(--success);
}

.review-item.incorrect {
    border-left: 4px solid var(--danger);
}

.review-item.skipped {
    border-left: 4px solid var(--warning);
}

.review-question {
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 0.5rem;
}

.review-explanation {
    margin-top: 0.5rem;
    padding: 0.75rem;
    background: var(--light);
    border-radius: 8px;
    font-size: 0.92rem;
}

.review-links {
    margin-top: 0.6rem;
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.review-empty {
    padding: 1rem;
    border-radius: 10px;
    background: var(--light);
    color: var(--gray);
}

.subject-section-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
}

.subject-section-grid.two-up {
    grid-template-columns: repeat(2, 1fr);
}

.subject-section-btn {
    display: inline-block;
    text-align: center;
    padding: 0.75rem 0.5rem;
}

.review-answer {
    font-size: 0.9rem;
    color: var(--gray);
}

.review-answer strong {
    color: var(--success);
}

/* Progress Bar */
.progress-bar {
    width: 100%;
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
    margin-top: 0.5rem;
}

.progress-bar .fill {
    height: 100%;
    background: var(--success);
    border-radius: 4px;
    transition: width 0.5s ease;
}

/* Dashboard */
.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
}

.dashboard-card {
    background: var(--white);
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
}

.dashboard-card h3 {
    color: var(--dark);
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--light);
}

.recent-test {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    border-bottom: 1px solid var(--light);
}

.recent-test:last-child {
    border-bottom: none;
}

.recent-test .name {
    font-weight: 600;
    color: var(--dark);
}

.recent-test .score {
    font-weight: bold;
}

.recent-test .score.pass {
    color: var(--success);
}

.recent-test .score.fail {
    color: var(--danger);
}

/* Footer */
footer {
    background: var(--dark);
    color: white;
    padding: 3rem 5% 1.5rem;
    margin-top: auto;
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 3rem;
    margin-bottom: 2rem;
}

.footer-col h4 {
    color: var(--accent);
    margin-bottom: 1rem;
}

.footer-col ul li {
    margin-bottom: 0.5rem;
}

.footer-col a {
    color: #94a3b8;
    transition: color 0.3s;
}

.footer-col a:hover {
    color: white;
}

.footer-bottom {
    border-top: 1px solid #334155;
    padding-top: 1.5rem;
    text-align: center;
    color: #64748b;
}

/* Responsive */
@media (max-width: 992px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    
    .results-summary {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    nav {
        width: 100%;
        justify-content: flex-end;
    }

    nav ul {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background: var(--white);
        flex-direction: column;
        padding: 1rem;
        gap: 1rem;
        box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    }

    nav ul.active {
        display: flex;
    }

    .nav-auth {
        width: 100%;
        justify-content: space-between;
        margin-left: 0;
        order: 2;
        flex-wrap: wrap;
    }

    .menu-toggle {
        display: flex;
        order: 3;
    }

    .hero h1 {
        font-size: 2rem;
    }

    .hero-stats {
        flex-direction: column;
        gap: 1.5rem;
    }

    section {
        padding: 3rem 5%;
    }

    .exam-header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    .exam-footer {
        flex-direction: column;
    }

    .results-summary {
        grid-template-columns: 1fr;
    }

    .review-header,
    .review-toolbar {
        flex-direction: column;
    }

    .review-topic-filter {
        width: 100%;
        min-width: 0;
    }

    .subject-section-grid,
    .subject-section-grid.two-up {
        grid-template-columns: 1fr;
    }

    .footer-grid {
        grid-template-columns: 1fr;
        text-align: center;
    }
}
