/* ================== RESET ================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ================== BIẾN MÀU ================== */
:root {
    --primary-color: #8B4513;     
    --secondary-color: #A0522D;   
    --accent-color: #DAA520;     
    --text-color: #333333;        
    --light-bg: #F5F5F5;         
    --white: #FFFFFF;             
    --correct-color: #27ae60;
    --wrong-color: #e74c3c;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: var(--text-color);
    background-color: var(--light-bg);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ===== NAVBAR ===== */
.navbar {
    background: linear-gradient(135deg, #f78a1d, #ffea96);
    color: var(--text-color);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--shadow);
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    font-family: "Playwrite GB J", cursive;
    font-optical-sizing: auto;
    font-style: normal;
}

.logo:hover {
    opacity: 0.85;
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 2rem;
    flex: 1;
    justify-content: center;
}

.nav-links li {
    position: relative;
}

.nav-links a {
    color: var(--text-color);
    text-decoration: none;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    display: block;
    transition: var(--transition);
}

.nav-links a:hover,
.nav-links a.active {
    background-color: var(--accent-color);
    color: var(--text-color);
}

/* Dropdown */
.dropdown {
    display: none;
    position: absolute;
    top: 35px;
    left: 0;
    background-color: #ffffff;
    min-width: 180px;
    box-shadow: 0px 8px 16px rgba(0, 0, 0, 0.15);
    border-radius: 6px;
    overflow: hidden;
    z-index: 1000;
    list-style: none;
}

.dropdown::before {
    content: "";
    position: absolute;
    top: -20px;
    left: 0;
    width: 100%;
    height: 20px;
}

.nav-links > li:hover > .dropdown,
.dropdown:hover {
    display: block;
}

.dropdown > li {
    border-bottom: 1px solid #f0f0f0;
}

.dropdown > li:last-child {
    border-bottom: none;
}

.dropdown > li > a {
    display: block;
    padding: 12px 20px;
    color: #333333 !important;
    background-color: #ffffff;
    transition: var(--transition);
}

.dropdown > li > a:hover {
    background-color: var(--accent-color);
    color: var(--text-color) !important;
}

.auth-buttons {
    display: flex;
    gap: 1rem;
}

/* ===== NÚT CHUNG ===== */
.btn {
    padding: 0.6rem 1.5rem;
    text-decoration: none;
    border-radius: 4px;
    font-weight: 600;
    transition: var(--transition);
    border: none;
    cursor: pointer;
    display: inline-block;
    text-align: center;
}

.btn-login {
    background-color: transparent;
    color: var(--text-color);
    border: 2px solid var(--text-color);
}

.btn-login:hover {
    background-color: var(--text-color);
    color: var(--white);
}

.btn-register {
    background-color: var(--accent-color);
    color: var(--primary-color);
}

.btn-register:hover {
    background-color: #FFC700;
}

.btn-primary {
    background-color: var(--primary-color);
    color: var(--white);
    padding: 1rem 2rem;
    font-size: 1rem;
}

.btn-primary:hover {
    background-color: var(--secondary-color);
}

.btn-secondary {
    background-color: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
    padding: 0.8rem 1.5rem;
}

.btn-secondary:hover {
    background-color: var(--primary-color);
    color: var(--white);
}

/* ===== QUIZ CONTAINER ===== */
.quiz-container {
    min-height: calc(100vh - 200px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

.screen {
    display: none;
    width: 100%;
    max-width: 800px;
    animation: fadeIn 0.4s ease-in;
}

.screen.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(15px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ===== MÀN HÌNH CHÍNH ===== */
.home-content {
    background: var(--white);
    border-radius: 12px;
    padding: 2.5rem 2rem;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
    text-align: center;
}

.home-content h1 {
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.home-content > p {
    font-size: 1rem;
    color: #666;
    margin-bottom: 1.5rem;
}


.difficulty-selection,
.category-selection {
    margin-bottom: 2rem;
    text-align: left;
}

.difficulty-selection h2,
.category-selection h2 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.difficulty-buttons {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.category-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 0.75rem;
}

.difficulty-btn {
    padding: 1.2rem;
    border: 2px solid #ddd;
    background-color: var(--white);
    border-radius: 10px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    text-align: center;
}

.category-btn {
    padding: 0.8rem;
    border: 2px solid #ddd;
    background-color: var(--white);
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-color);
}

.difficulty-btn:hover,
.difficulty-btn.active,
.category-btn:hover,
.category-btn.active {
    border-color: var(--primary-color);
    background-color: rgba(139, 69, 19, 0.08);
}

.difficulty-icon {
    font-size: 1.3rem;
}

.difficulty-name {
    font-size: 0.95rem;
    font-weight: 600;
}

.difficulty-desc {
    font-size: 0.8rem;
    color: #999;
}

.btn-start {
    width: 100%;
    padding: 1rem;
    font-size: 1rem;
    margin-top: 0.5rem;
}

/* ===== MÀN HÌNH QUIZ ===== */
.quiz-header {
    background: var(--white);
    padding: 1.2rem 1.5rem;
    border-radius: 12px 12px 0 0;
    display: grid;
    grid-template-columns: 1fr 2fr 1fr;
    gap: 1rem;
    align-items: center;
}

.quiz-progress,
.quiz-score {
    text-align: center;
    font-weight: 600;
    color: var(--primary-color);
}

.progress-bar {
    height: 8px;
    background-color: #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    width: 0%;
    transition: width 0.3s ease;
}

.quiz-content {
    background: var(--white);
    padding: 2.5rem 2rem;
    min-height: 420px;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.question-container {
    text-align: center;
}

.question-container h2 {
    font-size: 1.4rem;
    color: var(--primary-color);
    line-height: 1.6;
}

.answers-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.8rem;
}

.answer-btn {
    padding: 1.2rem 1.5rem;
    border: 2px solid #ddd;
    background-color: var(--light-bg);
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    font-size: 1rem;
    text-align: left;
    color: var(--text-color);
    font-weight: 500;
}

.answer-btn:hover:not(:disabled) {
    border-color: var(--primary-color);
    background-color: rgba(139, 69, 19, 0.05);
}

/* Đáp án đúng */
.answer-btn.correct {
    border-color: var(--correct-color);
    background-color: rgba(39, 174, 96, 0.12);
    color: var(--correct-color);
    font-weight: 600;
}

/* Đáp án sai */
.answer-btn.wrong {
    border-color: var(--wrong-color);
    background-color: rgba(231, 76, 60, 0.12);
    color: var(--wrong-color);
    font-weight: 600;
}

.answer-btn:disabled {
    cursor: not-allowed;
}

.quiz-footer {
    background: var(--white);
    padding: 1.2rem 1.5rem;
    border-radius: 0 0 12px 12px;
    text-align: right;
    border-top: 1px solid #eee;
}

/* ===== MÀN HÌNH KẾT QUẢ ===== */
.results-content {
    background: var(--white);
    border-radius: 12px;
    padding: 2.5rem 2rem;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

.results-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.results-header h1 {
    font-size: 2rem;
    color: var(--primary-color);
}

.score-display {
    text-align: center;
    margin: 1.5rem 0;
    padding: 2rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 12px;
    color: var(--white);
}

.final-score {
    font-size: 3.5rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.score-text {
    font-size: 1.3rem;
    font-weight: 600;
}

.results-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin: 1.5rem 0;
}

.stat-item {
    background-color: var(--light-bg);
    padding: 1.2rem;
    border-radius: 8px;
    text-align: center;
}

.stat-label {
    display: block;
    color: #999;
    font-size: 0.85rem;
    margin-bottom: 0.4rem;
    text-transform: uppercase;
}

.stat-value {
    display: block;
    font-size: 1.8rem;
    font-weight: bold;
    color: var(--primary-color);
}

.results-details {
    margin: 1.5rem 0;
    max-height: 350px;
    overflow-y: auto;
    padding: 1rem;
    background-color: var(--light-bg);
    border-radius: 8px;
}

.result-item {
    padding: 1rem;
    margin-bottom: 0.8rem;
    background-color: var(--white);
    border-left: 4px solid #ddd;
    border-radius: 5px;
}

.result-item.correct {
    border-left-color: var(--correct-color);
}

.result-item.wrong {
    border-left-color: var(--wrong-color);
}

.result-question {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

.result-answer {
    font-size: 0.9rem;
    color: #555;
    line-height: 1.6;
}

.results-buttons {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
    justify-content: center;
}

.results-buttons .btn {
    flex: 1;
    padding: 1rem;
    max-width: 250px;
}

/* ===== FOOTER ===== */
.footer {
    background: linear-gradient(135deg, #f78a1d, #ffea96);
    color: var(--text-color);
    padding: 2.5rem 0 1rem;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 2rem;
    margin-bottom: 1.5rem;
}

.footer-section h4 {
    margin-bottom: 0.8rem;
    color: var(--primary-color);
}

.footer-section p {
    opacity: 0.9;
}

.footer-section ul {
    list-style: none;
}

.footer-section a {
    color: rgba(0, 0, 0, 0.7);
    text-decoration: none;
    display: block;
    padding: 0.3rem 0;
    transition: var(--transition);
}

.footer-section a:hover {
    color: var(--accent-color);
    padding-left: 5px;
}

.contact-item {
    display: flex;
    gap: 10px;
    margin-bottom: 1rem;
    align-items: flex-start;
}

.contact-text {
    display: flex;
    flex-direction: column;
}

.contact-text strong {
    font-size: 0.9rem;
    display: block;
    margin-bottom: 3px;
}

.contact-text a {
    color: rgba(0, 0, 0, 0.7);
    text-decoration: none;
    font-size: 0.95rem;
}

.contact-text a:hover {
    color: var(--accent-color);
}

.social-links {
    display: flex;
    flex-direction: column;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .home-content {
        padding: 1.5rem 1rem;
    }

    .home-content h1 {
        font-size: 1.6rem;
    }

    .difficulty-buttons {
        grid-template-columns: 1fr;
    }

    .quiz-header {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }

    .question-container h2 {
        font-size: 1.1rem;
    }

    .results-stats {
        grid-template-columns: 1fr;
    }

    .results-buttons {
        flex-direction: column;
        align-items: center;
    }

    .results-buttons .btn {
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    .navbar .container {
        flex-direction: column;
        gap: 0.8rem;
    }

    .nav-links {
        flex-wrap: wrap;
        gap: 0.5rem;
        justify-content: center;
    }

    .auth-buttons {
        flex-direction: row;
    }

    .answer-btn {
        padding: 1rem;
        font-size: 0.9rem;
    }

    .final-score {
        font-size: 2.5rem;
    }
}