/* ==========================================================================
   🚀 NEXTEDU - ELITE QUIZ ENGINE CSS (v3.0)
   ========================================================================== */

/* --- 📦 MAIN CONTAINER --- */
.quiz-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.quiz-container {
    width: 100%;
    max-width: 800px;
    margin: auto;
    background: var(--card-bg, rgba(30, 41, 59, 0.85));
    border: 1px solid var(--card-border, rgba(255, 255, 255, 0.1));
    border-radius: 24px;
    padding: 30px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 20px 50px rgba(0,0,0,0.3);
    position: relative;
    overflow: hidden;
    animation: fadeUp 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: transform, opacity;
}

[data-theme="light"] .quiz-container {
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 15px 40px rgba(0,0,0,0.1);
}

/* --- 🌟 HEADER (Timer, Mode, XP) --- */
.quiz-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--card-border);
}

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

.mode-indicator {
    background: rgba(var(--primary-rgb, 245, 158, 11), 0.15);
    color: var(--primary-color, #F59E0B);
    padding: 6px 14px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid rgba(var(--primary-rgb, 245, 158, 11), 0.3);
}

.prime-hud-pill {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 50%, #ec4899 100%);
    color: #000000;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.76rem;
    font-weight: 900;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 0 15px rgba(245, 158, 11, 0.45);
    letter-spacing: 0.5px;
    animation: primeHudPulse 2.5s infinite ease-in-out;
}

@keyframes primeHudPulse {
    0%, 100% { transform: scale(1); box-shadow: 0 0 12px rgba(245, 158, 11, 0.4); }
    50% { transform: scale(1.04); box-shadow: 0 0 22px rgba(236, 72, 153, 0.65); }
}

.timer-box {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0,0,0,0.2);
    padding: 6px 15px;
    border-radius: 12px;
    letter-spacing: 1px;
}
[data-theme="light"] .timer-box { background: rgba(0,0,0,0.05); }

.xp-display {
    color: #fbbf24;
    font-weight: 900;
    font-size: 1.3rem;
    display: flex;
    align-items: baseline;
    gap: 5px;
    text-shadow: 0 2px 10px rgba(251, 191, 36, 0.3);
}
.xp-display small { font-size: 0.75rem; opacity: 0.8; }

/* --- 📊 PROGRESS BAR --- */
.progress-section {
    margin-bottom: 30px;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.progress-count b {
    color: var(--text-main);
    font-size: 1.1rem;
}

.progress-bar-container {
    width: 100%;
    height: 8px;
    background: rgba(255,255,255,0.1);
    border-radius: 10px;
    overflow: hidden;
}
[data-theme="light"] .progress-bar-container { background: rgba(0,0,0,0.1); }

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color, #F59E0B), #EC4899);
    width: 0%;
    border-radius: 10px;
    transition: width 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.5);
}

/* --- ❓ QUESTION AREA --- */
.question-card {
    background: rgba(0,0,0,0.15);
    border: 1px solid var(--card-border);
    padding: 30px;
    border-radius: 20px;
    margin-bottom: 30px;
    box-shadow: inset 0 2px 10px rgba(0,0,0,0.1);
}
[data-theme="light"] .question-card { background: rgba(0,0,0,0.02); }

#question-text {
    margin: 0;
    font-size: 1.4rem;
    line-height: 1.6;
    color: var(--text-main);
    font-weight: 600;
}

/* --- 🔘 OPTIONS GRID --- */
.options-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 35px;
}

.option-btn {
    background: var(--input-bg, rgba(255,255,255,0.03));
    border: 2px solid var(--card-border);
    border-radius: 16px;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    cursor: pointer;
    transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275), background-color 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
    text-align: left;
    color: var(--text-main);
    min-height: 70px;
    will-change: transform;
}

.opt-label {
    background: rgba(255,255,255,0.1);
    color: var(--text-muted);
    width: 35px;
    height: 35px;
    min-width: 35px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 10px;
    font-weight: 800;
    font-size: 1rem;
    transition: 0.3s;
}
[data-theme="light"] .opt-label { background: rgba(0,0,0,0.05); }

.opt-txt {
    font-size: 1.05rem;
    font-weight: 500;
    line-height: 1.4;
    word-break: break-word;
    overflow-wrap: break-word;
}

.option-btn:hover {
    background: rgba(var(--primary-rgb, 245, 158, 11), 0.05);
    border-color: rgba(var(--primary-rgb, 245, 158, 11), 0.5);
    transform: translate3d(0, -3px, 0);
}

.option-btn:hover .opt-label {
    background: var(--primary-color);
    color: #000;
}

/* Selected State */
.option-btn.selected {
    background: rgba(var(--primary-rgb, 245, 158, 11), 0.15);
    border-color: var(--primary-color);
    box-shadow: 0 5px 20px rgba(var(--primary-rgb, 245, 158, 11), 0.2);
    transform: translate3d(0, 0, 0) scale(1.02);
}
.option-btn.selected .opt-label {
    background: var(--primary-color);
    color: #000;
    box-shadow: 0 0 10px rgba(var(--primary-rgb, 245, 158, 11), 0.5);
}

/* ✅ Correct Option (Instant Green Feedback) */
.option-btn.correct {
    background: rgba(16, 185, 129, 0.15) !important;
    border-color: #10b981 !important;
    box-shadow: 0 5px 22px rgba(16, 185, 129, 0.3), inset 0 0 12px rgba(16, 185, 129, 0.12) !important;
    animation: popCorrect 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transform: scale(1.01);
}
.option-btn.correct .opt-label {
    background: #10b981 !important;
    color: #ffffff !important;
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.6) !important;
    font-size: 1.05rem;
}

/* ❌ Wrong Option (Instant Red Feedback) */
.option-btn.wrong {
    background: rgba(239, 68, 68, 0.15) !important;
    border-color: #ef4444 !important;
    box-shadow: 0 5px 22px rgba(239, 68, 68, 0.3), inset 0 0 12px rgba(239, 68, 68, 0.12) !important;
    animation: shakeWrong 0.4s ease-in-out;
}
.option-btn.wrong .opt-label {
    background: #ef4444 !important;
    color: #ffffff !important;
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.6) !important;
    font-size: 1.05rem;
}

/* 🔒 Lock & Dim State When Answered */
.options-grid.answered {
    pointer-events: none;
}
.options-grid.answered .option-btn:not(.correct):not(.wrong) {
    opacity: 0.45;
    filter: grayscale(0.2);
    cursor: default;
}

@keyframes shakeWrong {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-7px); }
    40% { transform: translateX(7px); }
    60% { transform: translateX(-5px); }
    80% { transform: translateX(5px); }
}

@keyframes popCorrect {
    0% { transform: scale(0.96); }
    50% { transform: scale(1.03); }
    100% { transform: scale(1.01); }
}

/* --- 🔽 FOOTER BUTTONS --- */
.quiz-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--card-border);
    padding-top: 20px;
}

.btn-exit {
    background: transparent;
    color: var(--error, #ef4444);
    border: 2px solid rgba(239, 68, 68, 0.3);
    padding: 12px 25px;
    border-radius: 14px;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}
.btn-exit:hover {
    background: var(--error);
    color: white;
    box-shadow: 0 5px 15px rgba(239, 68, 68, 0.3);
}

.btn-next {
    background: linear-gradient(135deg, var(--primary-color, #F59E0B), #EC4899);
    color: white;
    border: none;
    padding: 14px 30px;
    border-radius: 14px;
    font-weight: 700;
    font-size: 1.1rem;
    cursor: pointer;
    transition: transform 0.2s cubic-bezier(0.25, 0.8, 0.25, 1), background-color 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 8px 20px rgba(245, 158, 11, 0.3);
    will-change: transform;
}

.btn-next:hover:not(:disabled) {
    transform: translate3d(0, -2px, 0);
    box-shadow: 0 12px 25px rgba(245, 158, 11, 0.5);
}

.btn-next:disabled {
    background: rgba(255,255,255,0.1);
    color: var(--text-muted);
    box-shadow: none;
    cursor: not-allowed;
}
[data-theme="light"] .btn-next:disabled { background: rgba(0,0,0,0.1); }

/* ⏭️ Skip Button State (Active when question is unattempted) */
.btn-next.btn-skip {
    background: rgba(255, 255, 255, 0.07);
    color: var(--text-main);
    border: 1.5px solid var(--card-border);
    box-shadow: none;
}
[data-theme="light"] .btn-next.btn-skip {
    background: rgba(0, 0, 0, 0.05);
    border: 1.5px solid rgba(0, 0, 0, 0.12);
    color: var(--text-main);
}
.btn-next.btn-skip:hover:not(:disabled) {
    background: rgba(var(--primary-rgb, 245, 158, 11), 0.15);
    border-color: var(--primary-color);
    color: var(--primary-color);
    box-shadow: 0 6px 18px rgba(var(--primary-rgb, 245, 158, 11), 0.25);
    transform: translate3d(0, -2px, 0);
}

/* --- 🏆 RESULT SCREEN --- */
.status-screen {
    text-align: center;
    padding: 20px 0;
    animation: fadeIn 0.5s ease;
}

.success-icon-wrapper {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: rgba(251, 191, 36, 0.1);
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 auto 20px;
    position: relative;
}

.success-icon-wrapper::before {
    content: ''; position: absolute; inset: -10px;
    border-radius: 50%; border: 2px dashed rgba(251, 191, 36, 0.5);
    animation: rotate 10s linear infinite;
}

@keyframes rotate { 100% { transform: rotate(360deg); } }

.success-icon {
    font-size: 3rem;
    color: #fbbf24;
    filter: drop-shadow(0 5px 15px rgba(251, 191, 36, 0.5));
    animation: popIn 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.status-screen h1 { font-size: 2.2rem; color: var(--text-main); margin-bottom: 5px; }
.result-msg { color: var(--text-muted); font-size: 1.1rem; margin-bottom: 30px; }

/* Stats Grid */
.stats-container {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-bottom: 35px;
}

.stat-box {
    background: rgba(0,0,0,0.15);
    border: 1px solid var(--card-border);
    padding: 20px 10px;
    border-radius: 16px;
}
[data-theme="light"] .stat-box { background: rgba(0,0,0,0.03); }

.stat-box label { display: block; color: var(--text-muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 8px; font-weight: 600; }
.stat-box .val { font-size: 1.5rem; font-weight: 800; color: var(--text-main); font-family: 'Orbitron', sans-serif; }
.stat-box.highlight { background: rgba(245, 158, 11, 0.1); border-color: rgba(245, 158, 11, 0.3); }
.stat-box.highlight .val { color: #fbbf24; text-shadow: 0 0 10px rgba(251, 191, 36, 0.4); }

.btn-finish {
    background: var(--card-bg);
    color: var(--text-main);
    border: 2px solid var(--card-border);
    padding: 15px 40px;
    border-radius: 14px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
    width: 100%;
}
.btn-finish:hover {
    background: var(--text-main);
    color: var(--bg-color);
}

/* AI Chat Modal styles are managed cleanly in assets/css/ask_ai.css */

/* Base Loader Styles */
.spinner {
    width: 50px; height: 50px;
    border: 4px solid rgba(245, 158, 11, 0.2);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}
@keyframes spin { 100% { transform: rotate(360deg); } }

/* --- 📱 MOBILE RESPONSIVENESS --- */
@media screen and (max-width: 768px) {
    .quiz-page {
        padding: 15px !important;
        align-items: center !important;
    }
    
    .quiz-container {
        padding: 24px 20px;
        border-radius: 24px;
        border: 1px solid var(--card-border, rgba(255, 255, 255, 0.1));
        width: 100% !important;
        max-width: 100% !important;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
        margin: auto;
    }
    
    .quiz-header {
        flex-direction: column;
        gap: 14px;
        align-items: stretch;
        padding-bottom: 18px;
    }
    
    .header-left {
        width: 100%;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    
    .header-right {
        width: 100%;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    
    .timer-box {
        font-size: 1.05rem;
        padding: 5px 12px;
    }
    
    .mode-indicator {
        padding: 5px 12px;
        font-size: 0.8rem;
    }
    
    .xp-display {
        font-size: 1.15rem;
    }
    
    #question-text {
        font-size: 1.18rem;
        line-height: 1.5;
    }
    
    .question-card {
        padding: 22px 18px;
        margin-bottom: 24px;
        border-radius: 16px;
    }
    
    .options-grid {
        grid-template-columns: 1fr;
        gap: 12px;
        margin-bottom: 25px;
    }
    
    .option-btn {
        padding: 12px 16px;
        min-height: 58px;
        border-radius: 14px;
    }
    
    .opt-label {
        width: 30px;
        height: 30px;
        min-width: 30px;
        font-size: 0.9rem;
    }
    
    .opt-txt {
        font-size: 0.98rem;
    }
    
    .quiz-footer {
        flex-direction: column-reverse;
        gap: 12px;
        padding-top: 18px;
    }
    
    .btn-exit, .btn-next {
        width: 100%;
        justify-content: center;
        padding: 12px 20px;
        border-radius: 12px;
        font-size: 0.95rem;
    }
    
    .stats-container {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
    
    .status-screen h1 {
        font-size: 1.65rem;
    }
    
    .mistake-item {
        padding: 12px;
        border-radius: 10px;
    }
    
    .mistake-q {
        font-size: 0.92rem;
    }
    
    .ask-ai-btn {
        width: 100%;
        justify-content: center;
        margin-top: 10px;
    }
}

/* --- PREMIUM LIMIT STRIPE --- */
.limit-stripe-container {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 10px 14px;
    margin: 15px 0;
    transition: background-color 0.25s ease, border-color 0.25s ease;
}
.limit-stripe-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 6px;
}
.limit-stripe-info i {
    color: var(--primary-color);
}
.limit-stripe-bar {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 99px;
    overflow: hidden;
}
.limit-stripe-fill {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), #818cf8);
    border-radius: 99px;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}
