/* Quiz Popup */
.quiz-popup {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 650px;
    max-height: 90vh;
    background: linear-gradient(to bottom, #ffffff, #f5f5f5);
    border-radius: 16px;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.35);
    z-index: 1000;
    overflow: scroll;
    animation: slideIn 0.4s ease-out;
}

.quiz-popup.active {
    display: block;
}

@keyframes slideIn {
    from {
        transform: translate(-50%, -50%) scale(0.9);
        opacity: 0;
    }
    to {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

.quiz-header {
    background: linear-gradient(135deg, #ef7f1b, #be6618);
    padding: 25px 30px;
    color: white;
    position: relative;
}

.close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: black;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    transition: all 0.2s;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.quiz-title {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 8px;
}

.quiz-subtitle {
    font-size: 14px;
    opacity: 0.9;
}

.progress-bar {
    height: 6px;
    background: rgba(255, 255, 255, 0.3);
    margin-top: 15px;
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: #27ae60;
    width: 0%;
    transition: width 0.3s ease;
}

.quiz-body {
    padding: 30px;
    /* max-height: calc(90vh - 160px); */
    overflow-y: auto;
}

.question-counter {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
}

.question-number {
    font-size: 14px;
    color: #7f8c8d;
    font-weight: 600;
}

.question-score {
    font-size: 14px;
    color: #27ae60;
    font-weight: 600;
}

.question-text {
    font-size: 18px;
    color: #2c3e50;
    font-weight: 600;
    margin-bottom: 25px;
    line-height: 1.6;
}

.options-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.option-btn {
    background: white;
    border: 2px solid #dee2e6;
    padding: 16px 20px;
    border-radius: 10px;
    font-size: 16px;
    color: #2c3e50;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
    position: relative;
    overflow: hidden;
}

.option-btn::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 4px;
    background: #ef7f1b;
    transform: scaleY(0);
    transition: transform 0.2s;
}

.option-btn:hover {
    border-color: #ef7f1b;
    background: #f8f9fa;
    transform: translateX(4px);
}

.option-btn:hover::before {
    transform: scaleY(1);
}

.option-btn.selected {
    border-color: #ef7f1b;
    background: #ffd5af;
    font-weight: 600;
}

.option-btn.selected::before {
    transform: scaleY(1);
}

.option-btn.correct {
    border-color: #27ae60;
    background: #d4edda;
    color: #155724;
}

.option-btn.wrong {
    border-color: #e74c3c;
    background: #f8d7da;
    color: #721c24;
}

.option-btn:disabled {
    cursor: not-allowed;
    opacity: 0.7;
}

.quiz-footer {
    padding: 20px 30px;
    background: #f8f9fa;
    border-top: 1px solid #dee2e6;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.btn-next {
    background: linear-gradient(to bottom, #ef7f1b, #be6618);
    color: white;
    border: none;
    padding: 12px 30px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-next:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.4);
}

.btn-next:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-submit {
    background: linear-gradient(to bottom, #27ae60, #229954);
}

.btn-submit:hover:not(:disabled) {
    box-shadow: 0 4px 12px rgba(39, 174, 96, 0.4);
}

/* Results Screen */
.results-screen {
    display: none;
    text-align: center;
    padding: 40px 30px;
}

.results-screen.active {
    display: block;
}

.result-icon {
    width: 100px;
    height: 100px;
    margin: 0 auto 25px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 50px;
    animation: scaleIn 0.5s ease-out;
}

@keyframes scaleIn {
    from {
        transform: scale(0) rotate(-180deg);
    }
    to {
        transform: scale(1) rotate(0);
    }
}

.result-icon.pass {
    background: linear-gradient(135deg, #27ae60, #2ecc71);
}

.result-icon.fail {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
}

.result-title {
    font-size: 28px;
    color: #2c3e50;
    font-weight: 700;
    margin-bottom: 15px;
}

.result-score {
    font-size: 48px;
    font-weight: 700;
    margin: 20px 0;
}

.result-score.pass {
    color: #27ae60;
}

.result-score.fail {
    color: #e74c3c;
}

.coins-earned {
    background: linear-gradient(135deg, #f39c12, #e67e22);
    color: white;
    padding: 20px;
    border-radius: 12px;
    margin: 25px 0;
    font-size: 24px;
    font-weight: 600;
    cursor: pointer;
}

.result-message {
    color: #7f8c8d;
    font-size: 16px;
    margin-bottom: 30px;
    line-height: 1.6;
}

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

.btn-retry {
    background: linear-gradient(to bottom, #ef7f1b, #be6618);
    color: white;
    border: none;
    padding: 14px 35px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-close {
    background: white;
    color: #ef7f1b;
    border: 2px solid #ef7f1b;
    padding: 14px 35px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.loading-spinner {
    display: none;
    text-align: center;
    padding: 40px;
}

.loading-spinner.active {
    display: block;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

/* Answer Review */
.answer-review {
    margin-top: 30px;
    text-align: left;
}

.review-title {
    font-size: 18px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 20px;
}

.review-item {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    border-left: 4px solid #dee2e6;
}

.review-item.correct {
    border-left-color: #27ae60;
    background: #d4edda;
}

.review-item.incorrect {
    border-left-color: #e74c3c;
    background: #f8d7da;
}

.review-question {
    font-size: 14px;
    color: #2c3e50;
    font-weight: 600;
    margin-bottom: 10px;
}

.review-answer {
    font-size: 13px;
    color: #7f8c8d;
}

.review-answer strong {
    color: #2c3e50;
}