/* ============================================================ */
/* quiz_styles.css - Quiz Specific UI Refinements               */
/* ============================================================ */

.quiz-page-container {
    width: 90%;
    max-width: 900px;
    margin: 3rem auto;
    padding: 0 1rem 4rem 1rem;
    text-align: center;
    min-height: 60vh;
    /* Make sure it has a significant minimum height on its own */
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* --- High-Fidelity Design Elements --- */
.glass-card {
    background: rgba(10, 15, 40, 0.4);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(0, 255, 255, 0.15);
    border-radius: 24px;
    padding: 3rem 2rem;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5), inset 0 0 20px rgba(0, 255, 255, 0.05);
    width: 100%;
    margin: 0 auto;
    position: relative;
    overflow: hidden;
}

.glass-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(0, 255, 255, 0.5), transparent);
}

.neon-pill-btn {
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple));
    color: white;
    font-size: 1.2rem;
    font-weight: 700;
    padding: 1rem 3rem;
    border-radius: 50px;
    /* Pill shape */
    border: none;
    cursor: pointer;
    box-shadow: 0 0 20px rgba(6, 182, 212, 0.5);
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin: 1.5rem 0;
}

.neon-pill-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 30px rgba(6, 182, 212, 0.8), 0 0 10px rgba(168, 85, 247, 0.5);
}

.neon-pill-btn:active {
    transform: translateY(1px) scale(0.96);
    box-shadow: 0 0 15px rgba(6, 182, 212, 0.4);
}

/* --- Timer --- */
.neon-timer {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--accent-cyan);
    background: rgba(0, 0, 0, 0.3);
    border: 2px solid var(--accent-cyan);
    padding: 1rem 3rem;
    border-radius: 12px;
    display: inline-block;
    letter-spacing: 4px;
    text-shadow: 0 0 10px var(--accent-cyan), 0 0 20px var(--accent-cyan);
    box-shadow: 0 0 15px rgba(6, 182, 212, 0.3), inset 0 0 10px rgba(6, 182, 212, 0.2);
    animation: neonPulse 2s infinite alternate;
}

@keyframes neonPulse {
    from {
        box-shadow: 0 0 10px rgba(6, 182, 212, 0.2), inset 0 0 5px rgba(6, 182, 212, 0.1);
        text-shadow: 0 0 5px var(--accent-cyan);
    }

    to {
        box-shadow: 0 0 25px rgba(6, 182, 212, 0.6), inset 0 0 15px rgba(6, 182, 212, 0.4);
        text-shadow: 0 0 15px var(--accent-cyan), 0 0 30px var(--accent-cyan);
    }
}

/* --- Question Area --- */
.question {
    font-size: 1.6rem;
    font-weight: 600;
    line-height: 1.5;
    margin-bottom: 2.5rem;
    color: var(--text-primary);
    text-align: left;
    padding-left: 1rem;
    border-left: 4px solid var(--accent-cyan);
}

.options {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    text-align: left;
}

.options li {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    padding: 1.2rem 1.8rem;
    border-radius: var(--radius-lg);
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.options li::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: transparent;
    transition: background 0.3s ease;
}

.options li:hover {
    transform: translateX(8px) scale(1.01);
    background: rgba(30, 41, 59, 0.9);
    /* Deep slate hover */
    border-color: var(--accent-cyan);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3), inset 0 0 0 1px rgba(6, 182, 212, 0.2);
}

.options li:hover::before {
    background: linear-gradient(to bottom, var(--accent-cyan), var(--accent-purple));
    box-shadow: 0 0 10px var(--accent-cyan);
}

.options li:active {
    transform: translateX(4px) scale(0.98);
}

/* Selected States */
.options li.correct {
    background: rgba(16, 185, 129, 0.4);
    /* Stronger green background */
    border-color: #10b981;
    /* Solid green border */
    color: #ffffff;
    font-weight: 700;
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.4), inset 0 0 10px rgba(16, 185, 129, 0.2);
    transform: scale(1.02);
}

.options li.incorrect {
    background: rgba(244, 63, 94, 0.4);
    /* Stronger red background */
    border-color: #f43f5e;
    /* Solid red border */
    color: #ffffff;
    font-weight: 700;
    box-shadow: 0 0 15px rgba(244, 63, 94, 0.4), inset 0 0 10px rgba(244, 63, 94, 0.2);
    transform: scale(0.98);
}

.options.disabled li {
    pointer-events: none;
    opacity: 0.6;
}

.options.disabled li.correct,
.options.disabled li.incorrect {
    opacity: 1;
    transform: scale(1.02);
    /* Pop out the selected/correct items slightly */
}

/* --- Loading & Error States --- */
.loading-state {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    padding: 5rem 0;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(6, 182, 212, 0.1);
    /* Cyan */
    border-top: 4px solid var(--accent-cyan);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    box-shadow: 0 0 15px var(--glow-cyan);
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* --- Loading Skeletons --- */
.skeleton-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding: 1rem 0;
}

.skeleton {
    background: linear-gradient(-90deg, rgba(30, 41, 59, 0.4) 0%, rgba(51, 65, 85, 0.6) 50%, rgba(30, 41, 59, 0.4) 100%);
    background-size: 400% 400%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: var(--radius-lg);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.skeleton-text {
    height: 3rem;
    width: 80%;
    margin-bottom: 2rem;
}

.skeleton-option {
    height: 4rem;
    width: 100%;
}

@keyframes shimmer {
    0% {
        background-position: 100% 0;
    }

    100% {
        background-position: 0 0;
    }
}

.error-state {
    display: none;
    background: rgba(244, 63, 94, 0.05);
    border: 1px solid rgba(244, 63, 94, 0.2);
    padding: 3rem;
    border-radius: var(--radius-lg);
    text-align: center;
    max-width: 500px;
    margin: 2rem auto;
}

.error-state h3 {
    color: var(--accent-red);
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

/* --- Progress Bar --- */
.progress-container {
    width: 100%;
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-pill);
    height: 8px;
    margin-bottom: 1rem;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-cyan), var(--accent-purple));
    width: 0%;
    transition: width 0.4s ease;
    border-radius: var(--radius-pill);
    box-shadow: 0 0 10px var(--glow-cyan);
}

.progress-text {
    font-size: 1rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* --- Sticky Quiz Header --- */
.sticky-quiz-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(10, 15, 40, 0.85);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    padding: 1rem 0;
    margin-bottom: 2rem;
    border-bottom: 1px solid rgba(0, 255, 255, 0.15);
    display: none;
    /* Shown by JS when quiz starts */
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    /* Negative margin to stretch across the card */
    margin-left: -2rem;
    margin-right: -2rem;
    width: calc(100% + 4rem);
}

/* --- Next Button --- */
.next-btn {
    display: none;
    margin: 2rem auto 0;
    width: 100%;
    max-width: 300px;
    padding: 1.2rem;
    border-radius: var(--radius-pill);
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
    color: white;
    font-size: 1.2rem;
    font-weight: 700;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(6, 182, 212, 0.4);
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.next-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(6, 182, 212, 0.6);
}

/* --- Review Section --- */
.review-section {
    margin-top: 3rem;
    text-align: left;
    border-top: 1px solid var(--glass-border);
    padding-top: 2rem;
}

.review-section h3 {
    font-size: 1.8rem;
    margin-bottom: 2rem;
    color: var(--text-primary);
    text-align: center;
}

.review-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.review-item {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--glass-border);
    border-left: 4px solid var(--glass-border);
    border-radius: 12px;
    padding: 1.5rem;
}

.review-item.correct {
    border-left-color: #10b981;
}

.review-item.incorrect {
    border-left-color: #f43f5e;
}

.review-question {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.review-answer {
    font-size: 1rem;
    margin-bottom: 0.5rem;
    padding: 0.8rem;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.2);
}

.review-answer span {
    font-weight: 600;
}

.review-answer.your-answer {
    color: var(--text-secondary);
}

.review-answer.correct-answer {
    color: #10b981;
    background: rgba(16, 185, 129, 0.1);
}

.review-item.incorrect .your-answer {
    color: #f43f5e;
    background: rgba(244, 63, 94, 0.1);
}

/* --- Score Section --- */
.score-container {
    display: none;
    animation: fadeInUpScore 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes fadeInUpScore {
    from {
        opacity: 0;
        transform: translateY(50px) scale(0.9);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.score-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 4rem 2rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--glass-border);
    box-shadow: 0 0 40px rgba(6, 182, 212, 0.15), inset 0 0 20px rgba(168, 85, 247, 0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* --- Circular Score Chart --- */
.circular-chart {
    position: relative;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    /* --score is set by JS (0 to 100) */
    background: conic-gradient(var(--accent-cyan) calc(var(--score) * 1%), rgba(255, 255, 255, 0.1) 0);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 2rem;
    box-shadow: 0 0 30px rgba(6, 182, 212, 0.3);
    transition: background 1.5s ease-out;
}

.circular-chart::before {
    content: "";
    position: absolute;
    width: 170px;
    height: 170px;
    background: var(--bg-darker);
    border-radius: 50%;
    z-index: 1;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.5);
}

.circular-score-text {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

#score-heading {
    font-size: 3.5rem;
    font-weight: 800;
    margin-bottom: 0;
    line-height: 1;
}

#score {
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-size: 1.2em;
    filter: drop-shadow(0 0 10px var(--glow-cyan));
}

@media (max-width: 600px) {
    .quiz-page-container {
        width: 95%;
        margin: 1.5rem auto;
        padding: 0 0.5rem 2rem 0.5rem;
    }

    #timer-display {
        font-size: 1.5rem;
        padding: 0.8rem 1.5rem;
        margin-bottom: 1.5rem;
    }

    .question {
        font-size: 1.2rem;
        margin-bottom: 1.5rem;
    }

    .options li {
        padding: 1rem 1.2rem;
        font-size: 1rem;
    }

    .score-card {
        padding: 2.5rem 1.5rem;
        border-radius: var(--radius-lg);
    }

    #score-heading {
        font-size: 2.2rem;
    }

    #score {
        font-size: 1.1em;
    }
}

/* --- Custom Modals --- */
.custom-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(3, 0, 20, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.custom-modal-box {
    background: rgba(15, 23, 42, 0.85);
    border: 1px solid rgba(0, 255, 255, 0.3);
    border-radius: var(--radius-lg);
    padding: 3rem 2rem;
    max-width: 450px;
    width: 90%;
    text-align: center;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8), inset 0 0 20px rgba(6, 182, 212, 0.1);
    animation: slideUpModal 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.custom-modal-title {
    color: #f43f5e;
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 1rem;
    text-shadow: 0 0 15px rgba(244, 63, 94, 0.4);
}

.custom-modal-message {
    color: var(--text-secondary);
    font-size: 1.1rem;
    margin-bottom: 2.5rem;
    line-height: 1.6;
}

.custom-modal-btn {
    background: linear-gradient(135deg, #f43f5e, #be123c);
    color: white;
    border: none;
    padding: 1rem 3rem;
    font-size: 1.2rem;
    font-weight: 700;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 0 15px rgba(244, 63, 94, 0.5);
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.custom-modal-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 25px rgba(244, 63, 94, 0.8);
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUpModal {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}