/* Global Styles */
:root {
    --primary-color: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary-color: #3b82f6;
    --accent-color: #60a5fa;
    --background: #f8fafc;
    --surface: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --success: #22c55e;
    --error: #ef4444;
    --warning: #f59e0b;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--background);
    min-height: 100vh;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.3s;
}

a:hover {
    color: var(--primary-dark);
}

img {
    max-width: 100%;
    height: auto;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header & Navigation */
header {
    background: var(--surface);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
}

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

.logo svg {
    width: 32px;
    height: 32px;
}

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

.nav-links a {
    color: var(--text-primary);
    font-weight: 500;
    padding: 0.5rem 0;
    border-bottom: 2px solid transparent;
    transition: all 0.3s;
}

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

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
}

.mobile-menu-btn span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--text-primary);
    margin: 5px 0;
    transition: all 0.3s;
}

/* Dropdown Menu */
.dropdown {
    position: relative;
}

.dropdown-content {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--surface);
    min-width: 200px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    border-radius: 8px;
    padding: 0.5rem 0;
    z-index: 100;
}

.dropdown:hover .dropdown-content {
    display: block;
}

.dropdown-content a {
    display: block;
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    transition: background 0.3s;
}

.dropdown-content a:hover {
    background: var(--background);
}

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

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

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

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

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

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

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

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

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

/* Cards */
.card {
    background: var(--surface);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    transition: all 0.3s;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

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

.card p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.card-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

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

.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: var(--accent-color);
    color: white;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* Section Headers */
.section-header {
    text-align: center;
    margin: 3rem 0 2rem;
}

.section-header h2 {
    font-size: 2rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.section-header p {
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto;
}

/* Test Specific Styles */
.test-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 20px;
}

.test-header {
    background: var(--surface);
    padding: 1.5rem;
    border-radius: 12px;
    margin-bottom: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

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

.timer.warning {
    color: var(--error);
    animation: pulse 1s infinite;
}

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

.question-container {
    background: var(--surface);
    padding: 2rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
}

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

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

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

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

.option:hover {
    border-color: var(--primary-color);
    background: rgba(37, 99, 235, 0.05);
}

.option.selected {
    border-color: var(--primary-color);
    background: rgba(37, 99, 235, 0.1);
}

.option.correct {
    border-color: var(--success);
    background: rgba(34, 197, 94, 0.1);
}

.option.incorrect {
    border-color: var(--error);
    background: rgba(239, 68, 68, 0.1);
}

.option-letter {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--background);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    margin-right: 1rem;
    flex-shrink: 0;
}

.option.selected .option-letter {
    background: var(--primary-color);
    color: white;
}

.option.correct .option-letter {
    background: var(--success);
    color: white;
}

.option.incorrect .option-letter {
    background: var(--error);
    color: white;
}

.navigation-buttons {
    display: flex;
    justify-content: space-between;
    margin-top: 1.5rem;
    gap: 1rem;
}

.explanation {
    margin-top: 1.5rem;
    padding: 1rem;
    background: rgba(37, 99, 235, 0.05);
    border-left: 4px solid var(--primary-color);
    border-radius: 0 8px 8px 0;
}

.explanation h4 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.explanation.correct {
    background: rgba(34, 197, 94, 0.1);
    border-left-color: var(--success);
}

.explanation.incorrect {
    background: rgba(239, 68, 68, 0.1);
    border-left-color: var(--error);
}

/* Progress Bar */
.progress-bar {
    height: 6px;
    background: var(--border-color);
    border-radius: 3px;
    margin-bottom: 2rem;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--primary-color);
    transition: width 0.3s;
}

/* Results */
.results-container {
    text-align: center;
    padding: 3rem;
    background: var(--surface);
    border-radius: 12px;
}

.score-circle {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    margin: 0 auto 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    font-weight: 700;
}

.score-circle.excellent {
    background: linear-gradient(135deg, var(--success), #16a34a);
    color: white;
}

.score-circle.good {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
}

.score-circle.needs-work {
    background: linear-gradient(135deg, var(--warning), #d97706);
    color: white;
}

.score-circle poor {
    background: linear-gradient(135deg, var(--error), #dc2626);
    color: white;
}

.score-label {
    font-size: 0.875rem;
    opacity: 0.9;
}

.results-stats {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin: 2rem 0;
    flex-wrap: wrap;
}

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

.stat-value,
.stat-num {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Quiz Results Header */
.results-header {
    padding: 2rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    text-align: center;
}
.results-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}
.results-topic {
    color: rgba(255,255,255,0.8);
    margin-bottom: 1rem;
}
.results-score-big {
    font-size: 4rem;
    font-weight: 700;
    line-height: 1;
}
.results-percent {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0.5rem 0;
}
.results-grade {
    font-size: 1.25rem;
}
.grade-excellent { background: linear-gradient(135deg, #22c55e, #16a34a); color: white; }
.grade-great { background: linear-gradient(135deg, #2563eb, #1d4ed8); color: white; }
.grade-good { background: linear-gradient(135deg, #f59e0b, #d97706); color: white; }
.grade-practice { background: linear-gradient(135deg, #ef4444, #dc2626); color: white; }

/* Results Actions */
.results-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 1.5rem;
}

/* Results Breakdown */
.results-breakdown {
    margin-top: 2rem;
    text-align: left;
}
.results-breakdown h3 {
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border-color);
}
.result-item {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 0.75rem;
    border-left: 4px solid;
}
.result-correct {
    background: rgba(34, 197, 94, 0.08);
    border-left-color: var(--success);
}
.result-incorrect {
    background: rgba(239, 68, 68, 0.08);
    border-left-color: var(--error);
}
.result-q {
    font-weight: 600;
    margin-bottom: 0.25rem;
}
.result-status {
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
}
.result-detail {
    font-size: 0.875rem;
    color: var(--text-secondary);
}
.result-explanation {
    margin-top: 0.5rem;
    padding: 0.75rem;
    background: var(--background);
    border-radius: 6px;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Question Box */
.question-box {
    background: var(--surface);
    padding: 2rem;
    border-radius: 12px;
}
.question-actions {
    margin-top: 1.5rem;
}

/* Explanation Box */
.explanation-box {
    margin-top: 1rem;
    padding: 1rem;
    border-radius: 8px;
    text-align: left;
}
.explanation-correct {
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid var(--success);
}
.explanation-incorrect {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--error);
}
.explanation-header {
    font-weight: 600;
    margin-bottom: 0.5rem;
}
.explanation-text {
    font-size: 0.95rem;
    white-space: pre-line;
    line-height: 1.6;
}

/* Article Styles */
.article-content {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 20px;
}

.article-header {
    margin-bottom: 2rem;
}

.article-header h1 {
    font-size: 2.25rem;
    margin-bottom: 1rem;
    line-height: 1.3;
}

.article-meta {
    display: flex;
    gap: 1.5rem;
    color: var(--text-secondary);
    flex-wrap: wrap;
}

.article-body {
    font-size: 1.1rem;
    line-height: 1.9;
}

.article-body h2 {
    font-size: 1.75rem;
    margin: 2.5rem 0 1rem;
    color: var(--text-primary);
}

.article-body h3 {
    font-size: 1.35rem;
    margin: 2rem 0 0.75rem;
    color: var(--text-primary);
}

.article-body p {
    margin-bottom: 1.5rem;
}

.article-body ul,
.article-body ol {
    margin-bottom: 1.5rem;
    padding-left: 1.5rem;
}

.article-body li {
    margin-bottom: 0.5rem;
}

.article-body img {
    border-radius: 8px;
    margin: 2rem 0;
}

.math-formula {
    background: var(--background);
    padding: 1rem 1.5rem;
    border-radius: 8px;
    margin: 1.5rem 0;
    overflow-x: auto;
    text-align: center;
    font-size: 1.1rem;
}

blockquote {
    border-left: 4px solid var(--primary-color);
    padding-left: 1.5rem;
    margin: 2rem 0;
    font-style: italic;
    color: var(--text-secondary);
}

.related-articles {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
}

.related-articles h3 {
    margin-bottom: 1.5rem;
}

/* Contact Form */
.contact-form {
    max-width: 600px;
    margin: 0 auto;
}

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

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-group textarea {
    min-height: 150px;
    resize: vertical;
}

/* Footer */
footer {
    background: var(--text-primary);
    color: white;
    padding: 3rem 0 1rem;
    margin-top: 4rem;
}

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

.footer-section h4 {
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.footer-section ul {
    list-style: none;
}

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

.footer-section a {
    color: rgba(255,255,255,0.7);
}

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

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.6);
    font-size: 0.875rem;
}

/* 404 Page */
.error-page {
    text-align: center;
    padding: 6rem 0;
}

.error-code {
    font-size: 8rem;
    font-weight: 700;
    color: var(--primary-color);
    line-height: 1;
}

.error-page h1 {
    font-size: 2rem;
    margin: 1rem 0;
}

.error-page p {
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

/* Privacy & Terms Pages */
.legal-content {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 20px;
}

.legal-content h1 {
    font-size: 2.25rem;
    margin-bottom: 0.5rem;
}

.legal-content .last-updated {
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.legal-content h2 {
    font-size: 1.5rem;
    margin: 2rem 0 1rem;
}

.legal-content p {
    margin-bottom: 1rem;
}

.legal-content ul {
    margin-bottom: 1rem;
    padding-left: 1.5rem;
}

/* Test List Filters */
.filters {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 0.5rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 20px;
    background: var(--surface);
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.875rem;
}

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

/* Category Tabs */
.category-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
}

.category-tab {
    padding: 0.75rem 1.5rem;
    border: none;
    background: var(--background);
    border-radius: 8px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.3s;
    font-weight: 500;
}

.category-tab:hover {
    background: var(--border-color);
}

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

/* About Page Styles */
.about-hero {
    text-align: center;
    padding: 4rem 0;
}

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

.about-hero p {
    font-size: 1.25rem;
    color: var(--text-secondary);
    max-width: 700px;
    margin: 0 auto;
}

.values-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.value-card {
    text-align: center;
    padding: 2rem;
}

.value-card .icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 1rem;
    background: var(--accent-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.value-card .icon svg {
    width: 32px;
    height: 32px;
    color: white;
}

/* Breadcrumb */
.breadcrumb {
    padding: 1rem 0;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.breadcrumb a {
    color: var(--primary-color);
}

.breadcrumb span {
    margin: 0 0.5rem;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin: 2rem 0;
}

.pagination button {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    background: var(--surface);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s;
}

.pagination button:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.pagination button.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* Mobile Styles */
@media (max-width: 768px) {
    .nav-links {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--surface);
        flex-direction: column;
        padding: 1rem;
        box-shadow: 0 4px 6px rgba(0,0,0,0.1);
        gap: 1rem;
    }

    .nav-links.active {
        display: flex;
    }

    .mobile-menu-btn {
        display: block;
    }

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

    .hero p {
        font-size: 1rem;
    }

    .section-header h2 {
        font-size: 1.5rem;
    }

    .card-grid {
        grid-template-columns: 1fr;
    }

    .test-header {
        flex-direction: column;
        text-align: center;
    }

    .question-container {
        padding: 1.5rem;
    }

    .article-header h1 {
        font-size: 1.75rem;
    }

    .article-body {
        font-size: 1rem;
    }

    .results-stats {
        gap: 1rem;
    }

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

    .dropdown-content {
        position: static;
        box-shadow: none;
        padding-left: 1rem;
    }

    .dropdown:hover .dropdown-content {
        display: none;
    }

    .dropdown.active .dropdown-content {
        display: block;
    }
}

/* Loading State */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 200px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* MathJax adjustments */
.MathJax {
    font-size: 1.1em !important;
}
