/* Quiz Overlay System - Med detaljerad resultatvy */
.quiz-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.3s ease;
}

.quiz-overlay.show {
    display: flex !important;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.quiz-container {
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    border: 2px solid rgba(102, 126, 234, 0.3);
    border-radius: 20px;
    max-width: 700px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.quiz-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 25px 30px;
    border-bottom: 2px solid rgba(102, 126, 234, 0.2);
    background: rgba(102, 126, 234, 0.05);
}

.quiz-header h3 {
    font-size: 24px;
    font-weight: 700;
    color: white;
    margin: 0;
}

.quiz-close {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    font-size: 28px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.quiz-close:hover {
    background: rgba(229, 9, 20, 0.8);
    transform: rotate(90deg);
}

.quiz-body {
    padding: 30px;
}

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

.progress-bar {
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    border-radius: 10px;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.progress-text {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 500;
}

.quiz-question-container {
    margin-bottom: 30px;
}

#quizQuestion {
    font-size: 20px;
    font-weight: 600;
    color: white;
    margin-bottom: 25px;
    line-height: 1.4;
}

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

.quiz-option {
    position: relative;
}

.quiz-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.quiz-option label {
    display: block;
    padding: 16px 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 16px;
    color: rgba(255, 255, 255, 0.9);
}

.quiz-option input[type="radio"]:checked + label {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.2), rgba(118, 75, 162, 0.2));
    border-color: #667eea;
    color: white;
    font-weight: 600;
}

.quiz-option label:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.quiz-controls {
    display: flex;
    gap: 15px;
    justify-content: space-between;
}

.quiz-btn {
    flex: 1;
    padding: 14px 24px;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.quiz-btn-primary {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.quiz-btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.4);
}

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

.quiz-btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.9);
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.quiz-btn-secondary:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
}

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

/* Quiz Results */
.quiz-results {
    padding: 30px 25px;
    text-align: center;
}

.results-content h3 {
    font-size: 24px;
    font-weight: 700;
    color: white;
    margin-bottom: 15px;
}

.score-display {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 8px;
    margin-bottom: 8px;
}

.score-number {
    font-size: 48px;
    font-weight: 800;
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.score-total {
    font-size: 20px;
    color: rgba(255, 255, 255, 0.6);
}

.score-percentage {
    font-size: 28px;
    font-weight: 700;
    color: white;
    margin-bottom: 10px;
}

.score-message {
    font-size: 16px;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 20px;
    line-height: 1.4;
}

/* NY: Answer Review Styling - HUVUDFOKUS! */
.answer-review {
    margin: 20px 0;
    text-align: left;
    max-height: 500px;  /* ✅ Mycket större! */
    overflow-y: auto;
    padding: 20px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    border: 2px solid rgba(102, 126, 234, 0.2);
}

.answer-review h4 {
    font-size: 20px;
    font-weight: 600;
    color: white;
    margin-bottom: 18px;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.review-item {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 18px;
    margin-bottom: 16px;
    transition: all 0.3s;
}

.review-item:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(102, 126, 234, 0.3);
    transform: translateX(3px);
}

.review-question {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.question-number {
    font-size: 13px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.6);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.question-status {
    padding: 5px 12px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 600;
}

.question-status.correct {
    background: rgba(34, 197, 94, 0.2);
    color: #22c55e;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.question-status.incorrect {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.review-question-text {
    font-size: 15px;
    font-weight: 600;
    color: white;
    margin-bottom: 12px;
    line-height: 1.4;
}

.review-answers {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.review-answer-option {
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s;
}

.review-answer-option.correct-answer {
    background: rgba(34, 197, 94, 0.15);
    border-color: rgba(34, 197, 94, 0.4);
}

.review-answer-option.wrong-answer {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.4);
}

.answer-text {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.9);
    flex: 1;
}

.answer-label {
    font-size: 13px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 12px;
    white-space: nowrap;
}

.correct-answer .answer-label {
    background: rgba(34, 197, 94, 0.2);
    color: #22c55e;
}

.wrong-answer .answer-label {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

/* ✨ EXPLANATION STYLING - Snygg förklaringsruta */
.explanation {
    margin-top: 15px;
    padding: 16px 20px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
    border-left: 4px solid #667eea;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.85);
    position: relative;
    overflow: hidden;
}

.explanation::before {
    content: "💡";
    position: absolute;
    top: 12px;
    left: -30px;
    font-size: 32px;
    opacity: 0.2;
}

.explanation::after {
    content: "Förklaring";
    display: block;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #667eea;
    margin-bottom: 8px;
    opacity: 0.8;
}

/* Scrollbar styling för answer-review */
.answer-review::-webkit-scrollbar {
    width: 8px;
}

.answer-review::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
}

.answer-review::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 10px;
}

.answer-review::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #764ba2, #667eea);
}

.results-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 20px;
}

.results-actions .quiz-btn {
    flex: 0 0 auto;
    min-width: 150px;
    padding: 12px 20px;
    font-size: 14px;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .quiz-container {
        max-height: 95vh;
        margin: 10px;
    }

    .quiz-header {
        padding: 20px;
    }

    .quiz-header h3 {
        font-size: 20px;
    }

    .quiz-body {
        padding: 20px;
    }

    #quizQuestion {
        font-size: 18px;
    }

    .quiz-option label {
        padding: 14px 16px;
        font-size: 15px;
    }

    .score-number {
        font-size: 56px;
    }

    .score-percentage {
        font-size: 32px;
    }

    .results-actions {
        flex-direction: column;
    }

    .results-actions .quiz-btn {
        width: 100%;
    }

    .answer-review {
        padding: 15px;
        max-height: 300px;
    }

    .review-item {
        padding: 15px;
    }

    .review-question-text {
        font-size: 15px;
    }

    .review-answer-option {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .answer-label {
        align-self: flex-end;
    }
}

/* Dölj quiz-knappar på kurslistan */
.quiz-button {
    display: none !important;
}

/* Smooth animations för review items */
.review-item {
    animation: slideInReview 0.4s ease;
    animation-fill-mode: both;
}

.review-item:nth-child(1) { animation-delay: 0.1s; }
.review-item:nth-child(2) { animation-delay: 0.15s; }
.review-item:nth-child(3) { animation-delay: 0.2s; }
.review-item:nth-child(4) { animation-delay: 0.25s; }
.review-item:nth-child(5) { animation-delay: 0.3s; }
.review-item:nth-child(6) { animation-delay: 0.35s; }

@keyframes slideInReview {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Tooltip för answer labels */
.answer-label {
    position: relative;
}

/* Highlight effect när man hovrar över svar */
.review-answer-option:hover {
    transform: translateX(5px);
    background: rgba(255, 255, 255, 0.1);
}

.review-answer-option.correct-answer:hover {
    background: rgba(34, 197, 94, 0.2);
}

.review-answer-option.wrong-answer:hover {
    background: rgba(239, 68, 68, 0.2);
}