/**
 * LemlinkQuiz Frontend Styles
 */

/* Quiz Container */
.lemlinkquiz-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Enhanced styling for quizzes within lessons */
.lesson-survey-section .lemlinkquiz-container {
    background: #ffffff;
    border: 1px solid #e3f2fd;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(33, 150, 243, 0.08);
    padding: 35px;
    margin: 0;
    max-width: none;
    border-left: 4px solid #2196F3;
}

.lesson-survey-section .quiz-header {
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e3f2fd;
}

.lesson-survey-section .quiz-header h2 {
    color: #1976D2;
    font-size: 24px;
    margin-bottom: 10px;
}

.lesson-survey-section .quiz-description {
    color: #555;
    font-size: 15px;
}

.lesson-survey-section .quiz-question {
    background: #f8fafe;
    border: 1px solid #e1f5fe;
    border-radius: 8px;
    padding: 25px;
    margin-bottom: 25px;
}

.lesson-survey-section .question-number {
    background: #1976D2;
    color: white;
    width: 32px;
    height: 32px;
    font-size: 14px;
    font-weight: 700;
}

.lesson-survey-section .answer-option {
    background: #ffffff;
    border: 2px solid #e1f5fe;
    border-radius: 6px;
    padding: 15px 18px;
    margin-bottom: 10px;
    transition: all 0.3s ease;
}

.lesson-survey-section .answer-option:hover {
    border-color: #1976D2;
    background: #f0f8ff;
    transform: translateX(3px);
}

.lesson-survey-section .text-answer {
    border: 2px solid #e1f5fe;
    border-radius: 6px;
    padding: 15px;
    font-size: 16px;
    background: #ffffff;
}

.lesson-survey-section .text-answer:focus {
    border-color: #1976D2;
    box-shadow: 0 0 0 3px rgba(25, 118, 210, 0.1);
}

.lesson-survey-section .quiz-footer {
    border-top: 2px solid #e3f2fd;
    padding-top: 25px;
    margin-top: 30px;
}

.lesson-survey-section .lemlinkquiz-submit {
    background: #1976D2;
    padding: 15px 35px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 6px;
    border: none;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 3px 12px rgba(25, 118, 210, 0.2);
}

.lesson-survey-section .lemlinkquiz-submit:hover:not(:disabled) {
    background: #1565C0;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(25, 118, 210, 0.3);
}

.lesson-survey-section .lemlinkquiz-submit:disabled {
    background: #e0e0e0;
    color: #999;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.lesson-survey-section .pass-info {
    color: #666;
    font-size: 14px;
    margin-top: 12px;
}

.lesson-survey-section .quiz-results {
    background: #f0f8ff;
    border-radius: 8px;
    padding: 30px;
    margin-top: 20px;
}

.lesson-survey-section .quiz-results .score.passed {
    color: #4CAF50;
}

.lesson-survey-section .quiz-results .score.failed {
    color: #f44336;
}

/* Quiz Header */
.quiz-header {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #f0f0f1;
}

.quiz-header h2 {
    margin: 0 0 15px 0;
    color: #1d2327;
    font-size: 28px;
}

.quiz-description {
    color: #646970;
    font-size: 16px;
    line-height: 1.6;
}

/* Timer */
.quiz-timer {
    margin-top: 20px;
    padding: 10px 15px;
    background: #f0f0f1;
    border-radius: 4px;
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.timer-display {
    color: #d63638;
    font-family: monospace;
    font-size: 20px;
}

/* Questions */
.quiz-questions {
    margin-bottom: 30px;
}

.quiz-question {
    margin-bottom: 30px;
    padding: 20px;
    background: #f6f7f7;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
}

.question-header {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.question-number {
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    background: #2271b1;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.question-text {
    flex: 1;
    font-size: 16px;
    line-height: 1.5;
}

.question-text .required {
    color: #d63638;
    font-weight: bold;
}

/* Answer Options */
.question-answers {
    margin-left: 40px;
}

.answer-option {
    display: block;
    margin-bottom: 12px;
    padding: 12px 15px;
    background: white;
    border: 2px solid #dcdcde;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.answer-option:hover {
    border-color: #2271b1;
    background: #f0f8ff;
}

.answer-option input[type="radio"] {
    margin-right: 10px;
}

.answer-option input[type="radio"]:checked + span {
    font-weight: 600;
}

/* Text Answer */
.text-answer {
    width: 100%;
    padding: 10px;
    border: 2px solid #dcdcde;
    border-radius: 4px;
    font-size: 15px;
    resize: vertical;
}

.text-answer:focus {
    border-color: #2271b1;
    outline: none;
}

/* Quiz Footer */
.quiz-footer {
    text-align: center;
    padding-top: 20px;
    border-top: 2px solid #f0f0f1;
}

.lemlinkquiz-submit {
    padding: 12px 30px;
    background: #2271b1;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.lemlinkquiz-submit:hover:not(:disabled) {
    background: #1e5a8e;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.lemlinkquiz-submit:disabled {
    background: #dcdcde;
    cursor: not-allowed;
    opacity: 0.6;
}

.pass-info {
    margin-top: 15px;
    color: #646970;
    font-size: 14px;
}

/* Results */
.quiz-results {
    text-align: center;
    padding: 40px 20px;
}

.quiz-results h3 {
    margin-bottom: 20px;
    color: #1d2327;
}

.results-content {
    margin-bottom: 30px;
    font-size: 18px;
}

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

.results-content .score.passed {
    color: #00a32a;
}

.results-content .score.failed {
    color: #d63638;
}

.results-content .survey-complete {
    font-size: 36px;
    font-weight: 700;
    margin: 20px 0;
    color: #2271b1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

/* Quiz Results Actions */
.quiz-results-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
}

.retake-quiz {
    padding: 10px 25px;
    background: #f0f0f1;
    color: #1d2327;
    border: 1px solid #dcdcde;
    border-radius: 4px;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-block;
}

.retake-quiz:hover {
    background: #e0e0e0;
}

.return-to-course {
    padding: 10px 25px;
    background: #2271b1;
    color: white !important;
    border: 1px solid #2271b1;
    border-radius: 4px;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-block;
    font-weight: 600;
}

.return-to-course:hover {
    background: #1e5a8e;
    border-color: #1e5a8e;
    color: white !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* Answer Feedback */
.answer-option.correct-answer {
    background: #d4edda;
    border-color: #28a745;
    position: relative;
}

.answer-option.correct-answer::after {
    content: '\2713';
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #28a745;
    font-size: 24px;
    font-weight: bold;
}

.answer-option.incorrect-answer {
    background: #f8d7da;
    border-color: #dc3545;
    position: relative;
}

.answer-option.incorrect-answer::after {
    content: '\2717';
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #dc3545;
    font-size: 24px;
    font-weight: bold;
}

.answer-option.show-correct-answer {
    border-color: #28a745;
    border-style: dashed;
    opacity: 0.8;
}

.answer-feedback {
    margin-top: 15px;
    padding: 12px;
    background: #e8f4f8;
    border-left: 4px solid #2271b1;
    border-radius: 4px;
    font-style: italic;
    color: #1d2327;
}

/* Question Explanation for Immediate Marking */
.question-explanation {
    margin-top: 20px;
    padding: 15px;
    background: #f0f8ff;
    border: 1px solid #bee5eb;
    border-radius: 6px;
    animation: slideDown 0.3s ease-out;
}

.question-explanation .explanation-content {
    color: #004085;
    font-size: 15px;
    line-height: 1.6;
}

.question-explanation .explanation-content::before {
    content: '\1F4A1 ';
    font-size: 18px;
    margin-right: 5px;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Disabled inputs in marked questions */
.quiz-question input:disabled {
    cursor: not-allowed;
    opacity: 0.7;
}

.quiz-question input:disabled + span {
    opacity: 0.9;
}

.manual-grading-notice {
    margin-top: 10px;
    padding: 8px 12px;
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 4px;
    color: #856404;
    font-size: 14px;
}

/* Retry Feedback Styles */
.retry-feedback {
    margin-top: 20px;
}

.retry-message {
    padding: 15px 20px;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    animation: slideDown 0.3s ease-out;
}

.retry-message.incorrect {
    background: #fff3cd;
    border: 2px solid #ffc107;
    color: #856404;
}

.retry-message small {
    display: block;
    font-weight: normal;
    font-size: 14px;
    margin-top: 5px;
    opacity: 0.9;
}

/* Fireworks Animation */
.fireworks-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
}

.firework-burst {
    position: absolute;
    width: 10px;
    height: 10px;
}

.firework-particle {
    position: absolute;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    top: 0;
    left: 0;
    animation: firework-explode 1s ease-out forwards;
}

.firework-particle:nth-child(1) { transform: rotate(0deg); }
.firework-particle:nth-child(2) { transform: rotate(30deg); }
.firework-particle:nth-child(3) { transform: rotate(60deg); }
.firework-particle:nth-child(4) { transform: rotate(90deg); }
.firework-particle:nth-child(5) { transform: rotate(120deg); }
.firework-particle:nth-child(6) { transform: rotate(150deg); }
.firework-particle:nth-child(7) { transform: rotate(180deg); }
.firework-particle:nth-child(8) { transform: rotate(210deg); }
.firework-particle:nth-child(9) { transform: rotate(240deg); }
.firework-particle:nth-child(10) { transform: rotate(270deg); }
.firework-particle:nth-child(11) { transform: rotate(300deg); }
.firework-particle:nth-child(12) { transform: rotate(330deg); }

@keyframes firework-explode {
    0% {
        opacity: 1;
        transform: translateX(0) translateY(0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateX(50px) translateY(-50px) scale(0);
    }
}

/* Start Screen Styles */
.quiz-start-screen {
    text-align: center;
    padding: 40px 20px;
    background: #f8f9fa;
    border-radius: 8px;
    margin: 20px 0;
}

.start-content {
    max-width: 500px;
    margin: 0 auto;
}

.start-info {
    font-size: 18px;
    margin: 15px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: #1d2327;
}

.info-icon {
    font-size: 24px;
}

.quiz-start-button {
    margin-top: 30px;
    padding: 16px 40px;
    background: #2271b1;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(34, 113, 177, 0.2);
}

.quiz-start-button:hover {
    background: #1e5a8e;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(34, 113, 177, 0.3);
}

.quiz-start-button:active {
    transform: translateY(0);
}

/* Enhanced lesson survey section start screen */
.lesson-survey-section .quiz-start-screen {
    background: #f0f8ff;
    border: 2px solid #e3f2fd;
}

.lesson-survey-section .quiz-start-button {
    background: #1976D2;
    box-shadow: 0 4px 12px rgba(25, 118, 210, 0.2);
}

.lesson-survey-section .quiz-start-button:hover {
    background: #1565C0;
    box-shadow: 0 6px 20px rgba(25, 118, 210, 0.3);
}

/* One-at-a-time Mode Styles */
.quiz-progress {
    margin-bottom: 30px;
    text-align: center;
}

.progress-text {
    font-size: 16px;
    font-weight: 600;
    color: #646970;
    margin-bottom: 10px;
}

.progress-text .current-question,
.progress-text .total-questions {
    color: #2271b1;
    font-weight: 700;
}

.progress-bar {
    width: 100%;
    height: 20px;
    background: #f0f0f1;
    border-radius: 10px;
    overflow: hidden;
    margin: 0 auto;
    max-width: 400px;
}

.progress-fill {
    height: 100%;
    background: #2271b1;
    border-radius: 10px;
    transition: width 0.4s ease;
    position: relative;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(
        45deg,
        rgba(255, 255, 255, 0.2) 25%,
        transparent 25%,
        transparent 50%,
        rgba(255, 255, 255, 0.2) 50%,
        rgba(255, 255, 255, 0.2) 75%,
        transparent 75%,
        transparent
    );
    background-size: 40px 40px;
    animation: move-stripes 1s linear infinite;
}

@keyframes move-stripes {
    0% {
        background-position: 0 0;
    }
    100% {
        background-position: 40px 0;
    }
}

/* Navigation Buttons */
.quiz-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    margin-top: 20px;
}

.quiz-navigation button {
    padding: 10px 25px;
    font-size: 15px;
    font-weight: 600;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

.quiz-prev {
    background: #f0f0f1;
    color: #1d2327;
    border: 1px solid #dcdcde;
}

.quiz-prev:hover {
    background: #e0e0e0;
    transform: translateX(-2px);
}

.quiz-next {
    background: #2271b1;
    color: white;
    margin-left: auto;
}

.quiz-next:hover {
    background: #1e5a8e;
    transform: translateX(2px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Hide questions in one-at-a-time mode (initial state handled by PHP) */
.lemlinkquiz-container[data-display-mode="one_at_time"] .quiz-question {
    transition: opacity 0.3s ease;
}

/* Enhanced lesson survey section for one-at-a-time mode */
.lesson-survey-section .quiz-progress {
    margin-bottom: 25px;
}

.lesson-survey-section .progress-bar {
    background: #e3f2fd;
}

.lesson-survey-section .progress-fill {
    background: #1976D2;
}

.lesson-survey-section .quiz-navigation {
    margin-top: 25px;
}

.lesson-survey-section .quiz-prev {
    background: #f5f5f5;
    border-color: #e1f5fe;
}

.lesson-survey-section .quiz-prev:hover {
    background: #e8e8e8;
}

.lesson-survey-section .quiz-next {
    background: #1976D2;
}

.lesson-survey-section .quiz-next:hover {
    background: #1565C0;
}

/* Immediate marking in lesson survey section */
.lesson-survey-section .question-explanation {
    background: #e3f2fd;
    border-color: #1976D2;
}

.lesson-survey-section .question-explanation .explanation-content {
    color: #0d47a1;
}

/* Responsive */
@media (max-width: 600px) {
    .lemlinkquiz-container {
        padding: 15px;
    }
    
    .quiz-header h2 {
        font-size: 24px;
    }
    
    .question-header {
        flex-direction: column;
    }
    
    .question-answers {
        margin-left: 0;
    }
    
    .answer-option {
        padding: 10px 12px;
    }
    
    .answer-option.correct-answer::after,
    .answer-option.incorrect-answer::after {
        font-size: 18px;
        right: 10px;
    }
    
    /* One-at-a-time mode responsive */
    .quiz-navigation {
        flex-wrap: wrap;
    }
    
    .quiz-navigation button {
        flex: 1;
        min-width: 120px;
    }
    
    .quiz-next {
        margin-left: 0;
    }
    
    .progress-bar {
        max-width: 100%;
    }
    
    /* Start screen responsive */
    .quiz-start-screen {
        padding: 30px 15px;
    }
    
    .start-info {
        font-size: 16px;
        flex-direction: column;
        gap: 5px;
    }
    
    .quiz-start-button {
        padding: 14px 30px;
        font-size: 16px;
    }
}