/* =================================================
   THIS IS WHERE GLOBAL STYLES & RESET ARE LOCATED
   ================================================= */

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

:root {
    --primary-color: #6366f1;
    --primary-dark: #4f46e5;
    --secondary-color: #8b5cf6;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --border-color: #334155;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.4);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 100%);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
}

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

/* ==============================================
   THIS IS THE HEADER AREA
   ============================================== */

.app-header {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 25px 30px;
    margin-bottom: 30px;
    box-shadow: var(--shadow);
}

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

.logo {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo i {
    font-size: 2.5rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo h1 {
    font-size: 1.8rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    background: linear-gradient(135deg, var(--warning-color), #f97316);
    border-radius: 25px;
    font-size: 1.2rem;
    font-weight: 700;
    color: white;
    box-shadow: var(--shadow);
}

.stat-badge i {
    font-size: 1.5rem;
}

/* =================================================
   THIS IS WHERE SCREENS AREA ARE LOCATED
   ================================================= */

.screen {
    display: none;
    animation: fadeIn 0.5s ease;
}

.screen.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==============================================
   THIS IS THE HOME SCREEN AREA
   ============================================== */

.welcome-card {
    background: var(--bg-secondary);
    border-radius: 16px;
    padding: 50px;
    text-align: center;
    box-shadow: var(--shadow-lg);
}

.welcome-icon {
    width: 120px;
    height: 120px;
    margin: 0 auto 30px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4rem;
    color: white;
    box-shadow: var(--shadow-lg);
}

.welcome-card h2 {
    font-size: 2.5rem;
    margin-bottom: 15px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.welcome-card > p {
    color: var(--text-secondary);
    font-size: 1.2rem;
    margin-bottom: 40px;
}

.quiz-options {
    display: grid;
    gap: 25px;
    margin-bottom: 40px;
    text-align: left;
}

.option-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.option-group label {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 1.1rem;
}

.select-input {
    padding: 15px 20px;
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.select-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.start-btn {
    padding: 18px 50px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border: none;
    border-radius: 12px;
    color: white;
    font-size: 1.3rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    box-shadow: var(--shadow-lg);
}

.start-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 35px rgba(99, 102, 241, 0.4);
}

.start-btn:active {
    transform: translateY(-1px);
}

/* ====================================================
   THIS IS THE QUIZ SCREEN AREA
   ==================================================== */

.quiz-container {
    background: var(--bg-secondary);
    border-radius: 16px;
    padding: 30px;
    box-shadow: var(--shadow-lg);
}

.quiz-header {
    margin-bottom: 30px;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.question-counter {
    color: var(--text-secondary);
}

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

.progress-bar {
    height: 12px;
    background: var(--bg-tertiary);
    border-radius: 20px;
    overflow: hidden;
    margin-bottom: 15px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    border-radius: 20px;
    transition: width 0.3s ease;
    width: 0%;
}

.timer-container {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--bg-tertiary);
    border-radius: 25px;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--warning-color);
    width: fit-content;
}

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

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.question-card {
    background: var(--bg-tertiary);
    border-radius: 12px;
    padding: 30px;
    margin-bottom: 25px;
    min-height: 300px;
}

.difficulty-badge {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 20px;
}

.difficulty-badge.easy {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success-color);
}

.difficulty-badge.medium {
    background: rgba(245, 158, 11, 0.2);
    color: var(--warning-color);
}

.difficulty-badge.hard {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger-color);
}

#questionText {
    font-size: 1.5rem;
    color: var(--text-primary);
    margin-bottom: 30px;
    line-height: 1.8;
}

.answers-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.answer-btn {
    padding: 20px 25px;
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 1.1rem;
    text-align: left;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 15px;
}

.answer-btn:hover:not(.correct):not(.wrong):not(.disabled) {
    border-color: var(--primary-color);
    background: rgba(99, 102, 241, 0.1);
    transform: translateX(10px);
}

.answer-btn .answer-letter {
    width: 40px;
    height: 40px;
    background: var(--primary-color);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    flex-shrink: 0;
}

.answer-btn.correct {
    border-color: var(--success-color);
    background: rgba(16, 185, 129, 0.1);
    cursor: default;
}

.answer-btn.correct .answer-letter {
    background: var(--success-color);
}

.answer-btn.wrong {
    border-color: var(--danger-color);
    background: rgba(239, 68, 68, 0.1);
    cursor: default;
}

.answer-btn.wrong .answer-letter {
    background: var(--danger-color);
}

.answer-btn.disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.quiz-actions {
    display: flex;
    justify-content: center;
}

.action-btn {
    padding: 12px 30px;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

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

.quit-btn:hover {
    background: #dc2626;
    transform: translateY(-2px);
}

/* ====================================================
   THIS IS RESULTS SCREEN AREA
   ==================================================== */

.results-card {
    background: var(--bg-secondary);
    border-radius: 16px;
    padding: 50px;
    text-align: center;
    box-shadow: var(--shadow-lg);
}

.results-icon {
    width: 150px;
    height: 150px;
    margin: 0 auto 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 5rem;
    box-shadow: var(--shadow-lg);
    animation: scaleIn 0.5s ease;
}

@keyframes scaleIn {
    from {
        transform: scale(0);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.results-icon.excellent {
    background: linear-gradient(135deg, var(--success-color), #059669);
    color: white;
}

.results-icon.good {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
}

.results-icon.average {
    background: linear-gradient(135deg, var(--warning-color), #f97316);
    color: white;
}

.results-icon.poor {
    background: linear-gradient(135deg, var(--danger-color), #dc2626);
    color: white;
}

.results-card h2 {
    font-size: 2.5rem;
    margin-bottom: 15px;
    color: var(--text-primary);
}

.results-card > p {
    color: var(--text-secondary);
    font-size: 1.2rem;
    margin-bottom: 40px;
}

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

.stat-card {
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 25px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.stat-card i {
    font-size: 2.5rem;
    color: var(--primary-color);
}

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

.stat-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 5px;
}

.stat-value {
    color: var(--text-primary);
    font-size: 1.8rem;
    font-weight: 700;
}

.results-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.play-again-btn {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
}

.play-again-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.home-btn {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
}

.home-btn:hover {
    border-color: var(--primary-color);
}

/* ====================================================
   THIS IS LOADING SCREEN AREA
   =================================================== */

.loading-container {
    background: var(--bg-secondary);
    border-radius: 16px;
    padding: 80px 50px;
    text-align: center;
    box-shadow: var(--shadow-lg);
}

.spinner {
    width: 80px;
    height: 80px;
    margin: 0 auto 30px;
    border: 6px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading-container p {
    color: var(--text-secondary);
    font-size: 1.2rem;
}

/* ===================================================
   THIS IS FOOTER AREA
   =================================================== */

.app-footer {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 20px 30px;
    margin-top: 30px;
    text-align: center;
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.app-footer p {
    color: var(--text-secondary);
}

.app-footer i.fa-heart {
    color: var(--danger-color);
}

.back-link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.back-link:hover {
    color: var(--secondary-color);
    transform: translateX(-5px);
}

/* ===================================================
   THIS IS RESPONSIVE DESIGN AREA
   =================================================== */

@media (max-width: 768px) {
    .welcome-card,
    .results-card {
        padding: 30px 20px;
    }

    .welcome-card h2,
    .results-card h2 {
        font-size: 2rem;
    }

    .logo h1 {
        font-size: 1.3rem;
    }

    .quiz-container {
        padding: 20px;
    }

    #questionText {
        font-size: 1.2rem;
    }

    .answer-btn {
        padding: 15px 20px;
        font-size: 1rem;
    }

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

    .app-footer {
        flex-direction: column;
        text-align: center;
    }
}
