/**
 * Evaluations Frontend CSS
 */

:root {
    /* Charte IFCIA (remplace l'ancien bleu-mauve var(--ev-primary) des questionnaires) */
    --ev-primary: #e91e8c;
    --ev-primary-dark: #be185d;
    --ev-primary-tint: #fce7f3;
}

/* Logo IFCIA en tete de questionnaire */
.ev-form-logo { text-align: center; margin-bottom: 14px; }
.ev-form-logo img { max-height: 48px; width: auto; display: inline-block; }

/* Form Wrapper */
.ev-form-wrapper {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

.ev-preview-notice {
    background: #fef3c7;
    color: #92400e;
    padding: 10px 15px;
    border-radius: 6px;
    margin-bottom: 20px;
    text-align: center;
    font-size: 14px;
}

/* Form Header */
.ev-form-header {
    margin-bottom: 30px;
    text-align: center;
}

.ev-form-header h2 {
    font-size: 28px;
    margin-bottom: 10px;
    color: #1f2937;
}

.ev-form-description {
    color: #6b7280;
    font-size: 16px;
    line-height: 1.6;
}

/* Timer */
.ev-timer {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #fee2e2;
    color: #991b1b;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 16px;
    font-weight: 600;
    margin-top: 15px;
}

.ev-timer.ev-warning {
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Questions */
.ev-question {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 20px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.ev-question:hover {
    border-color: #d1d5db;
}

.ev-question.ev-error {
    border-color: #dc2626;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

.ev-question-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 15px;
}

.ev-question-number {
    background: var(--ev-primary);
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
    flex-shrink: 0;
}

.ev-question-title {
    font-size: 18px;
    font-weight: 600;
    color: #1f2937;
    line-height: 1.4;
}

.ev-required {
    color: #dc2626;
    margin-left: 3px;
}

.ev-question-description {
    color: #6b7280;
    font-size: 14px;
    margin-bottom: 15px;
    padding-left: 44px;
}

.ev-question-image {
    margin-bottom: 20px;
    padding-left: 44px;
}

.ev-question-image img {
    max-width: 100%;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.ev-question-input {
    padding-left: 44px;
}

/* Options (Radio/Checkbox) */
.ev-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: #f9fafb;
    border: 2px solid transparent;
    border-radius: 8px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.ev-option:hover {
    background: #f3f4f6;
}

.ev-option input {
    width: 20px;
    height: 20px;
    margin: 0;
    cursor: pointer;
}

.ev-option.selected {
    background: var(--ev-primary-tint);
    border-color: var(--ev-primary);
}

.ev-option-text {
    flex: 1;
    font-size: 15px;
    color: #374151;
}

.ev-option-image img {
    max-width: 80px;
    max-height: 60px;
    border-radius: 4px;
}

/* Select */
.ev-select {
    width: 100%;
    padding: 12px 16px;
    font-size: 15px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    transition: border-color 0.2s;
}

.ev-select:focus {
    outline: none;
    border-color: var(--ev-primary);
}

/* Text Inputs */
.ev-input,
.ev-textarea {
    width: 100%;
    padding: 12px 16px;
    font-size: 15px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    transition: border-color 0.2s;
}

.ev-input:focus,
.ev-textarea:focus {
    outline: none;
    border-color: var(--ev-primary);
}

.ev-textarea {
    resize: vertical;
    min-height: 100px;
}

/* Scale */
.ev-scale {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.ev-scale-label {
    font-size: 13px;
    color: #6b7280;
    min-width: 100px;
}

.ev-scale-label-min {
    text-align: right;
}

.ev-scale-options {
    display: flex;
    gap: 8px;
}

.ev-scale-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
}

.ev-scale-option input {
    display: none;
}

.ev-scale-option span {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f3f4f6;
    border: 2px solid transparent;
    border-radius: 50%;
    font-weight: 600;
    color: #6b7280;
    transition: all 0.2s;
}

.ev-scale-option:hover span {
    background: #e5e7eb;
}

.ev-scale-option input:checked + span {
    background: var(--ev-primary);
    color: #fff;
    border-color: var(--ev-primary);
}

/* Rating Stars */
.ev-rating {
    display: flex;
    gap: 5px;
}

.ev-rating-star {
    cursor: pointer;
}

.ev-rating-star input {
    display: none;
}

.ev-star {
    font-size: 36px;
    color: #d1d5db;
    transition: color 0.2s;
}

.ev-rating-star:hover .ev-star,
.ev-rating-star.active .ev-star {
    color: #fbbf24;
}

/* Score Input */
.ev-score-input {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ev-input-score {
    width: 100px;
    text-align: center;
    font-size: 20px;
    font-weight: 600;
}

.ev-score-max {
    font-size: 18px;
    color: #6b7280;
}

/* Form Actions */
.ev-form-actions {
    margin-top: 30px;
    text-align: center;
}

/* Buttons */
.ev-btn {
    display: inline-block;
    padding: 10px 20px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    background: #e5e7eb;
    color: #374151;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

.ev-btn:hover {
    background: #d1d5db;
}

.ev-btn-primary {
    background: var(--ev-primary);
    color: #fff;
}

.ev-btn-primary:hover {
    background: var(--ev-primary-dark);
}

.ev-btn-large {
    padding: 14px 32px;
    font-size: 17px;
}

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

.ev-results-header h2 {
    font-size: 28px;
    color: #1f2937;
    margin-bottom: 10px;
}

.ev-results-header p {
    color: #6b7280;
    font-size: 16px;
}

.ev-results-score {
    margin: 40px 0;
}

.ev-score-circle {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
}

.ev-score-circle.ev-passed {
    background: linear-gradient(135deg, #10b981, #059669);
}

.ev-score-circle.ev-failed {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

.ev-score-value {
    font-size: 42px;
    font-weight: bold;
    color: #fff;
}

.ev-result-message {
    font-size: 18px;
    font-weight: 500;
}

.ev-result-message.ev-success {
    color: #059669;
}

.ev-result-message.ev-failure {
    color: #dc2626;
}

.ev-results-message {
    color: #64748b;
    font-size: 16px;
    margin: 10px 0;
}

.ev-results-thankyou {
    font-size: 24px;
    font-weight: 600;
    color: #10b981;
    margin: 20px 0;
}

.ev-results-actions {
    margin-top: 30px;
}

/* Error Messages */
.ev-error-message {
    color: #dc2626;
    font-size: 13px;
    margin-top: 8px;
    display: none;
}

.ev-question.ev-error .ev-error-message {
    display: block;
}

/* Loading */
.ev-loading {
    position: relative;
    pointer-events: none;
}

.ev-loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Responsive */
@media (max-width: 640px) {
    .ev-form-wrapper {
        padding: 15px;
    }
    
    .ev-question {
        padding: 20px 15px;
    }
    
    .ev-question-description,
    .ev-question-image,
    .ev-question-input {
        padding-left: 0;
    }
    
    .ev-scale {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .ev-scale-label {
        text-align: left;
        min-width: auto;
    }
    
    .ev-scale-options {
        flex-wrap: wrap;
    }
}

/* Confirmation Modal */
body.ev-modal-open {
    overflow: hidden;
}

.ev-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999999;
    padding: 20px;
}

.ev-modal {
    background: #fff;
    border-radius: 12px;
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.ev-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid #e5e7eb;
}

.ev-modal-header h3 {
    margin: 0;
    font-size: 18px;
    color: #1f2937;
}

.ev-modal-close {
    background: none;
    border: none;
    font-size: 28px;
    color: #9ca3af;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.ev-modal-close:hover {
    color: #1f2937;
}

.ev-modal-body {
    padding: 25px;
    overflow-y: auto;
    flex: 1;
}

.ev-modal-notice {
    background: #fef3c7;
    color: #92400e;
    padding: 12px 16px;
    border-radius: 8px;
    margin: 0 0 20px;
    font-size: 14px;
}

.ev-answers-summary {
    max-height: 400px;
    overflow-y: auto;
}

.ev-summary-item {
    padding: 12px 0;
    border-bottom: 1px solid #f3f4f6;
}

.ev-summary-item:last-child {
    border-bottom: none;
}

.ev-summary-question {
    color: #374151;
    font-size: 14px;
    margin-bottom: 6px;
}

.ev-summary-answer {
    color: #1f2937;
    font-size: 15px;
    padding-left: 20px;
    background: #f9fafb;
    padding: 8px 12px;
    border-radius: 6px;
}

.ev-summary-answer em {
    color: #9ca3af;
}

.ev-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 20px 25px;
    border-top: 1px solid #e5e7eb;
    background: #f9fafb;
    border-radius: 0 0 12px 12px;
}

/* Results Page Styles */
.ev-results-wrapper {
    max-width: 700px;
    margin: 0 auto;
    padding: 40px 20px;
    text-align: center;
}

.ev-results-icon {
    font-size: 64px;
    margin-bottom: 20px;
}

.ev-results-title {
    font-size: 28px;
    color: #1f2937;
    margin-bottom: 10px;
}

.ev-results-message {
    font-size: 16px;
    color: #6b7280;
    margin-bottom: 30px;
}

.ev-results-score-box {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border: 2px solid #22c55e;
    border-radius: 16px;
    padding: 30px;
    margin-bottom: 30px;
}

.ev-results-score-box.failed {
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    border-color: #ef4444;
}

.ev-results-score-value {
    font-size: 56px;
    font-weight: 700;
    color: #16a34a;
    margin-bottom: 10px;
}

.ev-results-score-box.failed .ev-results-score-value {
    color: #dc2626;
}

.ev-results-score-label {
    font-size: 14px;
    color: #6b7280;
}

.ev-results-pass-info {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px dashed rgba(0,0,0,0.1);
    font-size: 14px;
}

.ev-results-pass-info.success {
    color: #16a34a;
}

.ev-results-pass-info.failure {
    color: #dc2626;
}

.ev-results-details {
    text-align: left;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 30px;
}

.ev-results-details-header {
    background: #f9fafb;
    padding: 15px 20px;
    border-bottom: 1px solid #e5e7eb;
    font-weight: 600;
    color: #374151;
}

.ev-result-item {
    padding: 15px 20px;
    border-bottom: 1px solid #f3f4f6;
}

.ev-result-item:last-child {
    border-bottom: none;
}

.ev-result-question {
    font-size: 14px;
    color: #374151;
    margin-bottom: 8px;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.ev-result-question-number {
    background: #e5e7eb;
    color: #374151;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
}

.ev-result-answer {
    padding-left: 32px;
    font-size: 14px;
}

.ev-result-answer.correct {
    color: #16a34a;
}

.ev-result-answer.correct::before {
    content: '✓ ';
}

.ev-result-answer.incorrect {
    color: #dc2626;
}

.ev-result-answer.incorrect::before {
    content: '✗ ';
}

.ev-result-correct-answer {
    padding-left: 32px;
    margin-top: 8px;
    font-size: 13px;
    color: #16a34a;
    background: #f0fdf4;
    padding: 8px 12px 8px 32px;
    border-radius: 6px;
}

.ev-result-correct-answer::before {
    content: '→ Bonne réponse : ';
    font-weight: 600;
}

/* ==========================================================================
   GAMIFIED QUIZ MODE
   ========================================================================== */

.ev-quiz-gamified {
    --quiz-primary: #6366f1;
    --quiz-primary-dark: #4f46e5;
    --quiz-success: #10b981;
    --quiz-error: #ef4444;
    --quiz-warning: #f59e0b;
    --quiz-bg: #f8fafc;
    --quiz-card: #ffffff;
    --quiz-text: #1e293b;
    --quiz-text-light: #64748b;
    
    position: relative;
    max-width: 800px;
    margin: 0 auto;
    padding: 24px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Header */
.ev-quiz-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid #e2e8f0;
}

.ev-quiz-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--quiz-text);
}

.ev-quiz-stats {
    display: flex;
    align-items: center;
    gap: 20px;
}

.ev-quiz-score {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: linear-gradient(135deg, var(--quiz-primary), var(--quiz-primary-dark));
    color: white;
    padding: 8px 20px;
    border-radius: 12px;
    min-width: 80px;
}

.ev-quiz-score-label {
    font-size: 11px;
    text-transform: uppercase;
    opacity: 0.9;
}

.ev-quiz-score-value {
    font-size: 28px;
    font-weight: 800;
    line-height: 1;
}

.ev-quiz-streak {
    display: flex;
    align-items: center;
    gap: 4px;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 700;
    animation: ev-streak-pulse 0.5s ease;
}

@keyframes ev-streak-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.ev-streak-fire {
    font-size: 20px;
    animation: ev-fire-dance 0.3s ease infinite alternate;
}

@keyframes ev-fire-dance {
    from { transform: rotate(-5deg); }
    to { transform: rotate(5deg); }
}

.ev-quiz-timer {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 18px;
    font-weight: 600;
    color: var(--quiz-text);
    padding: 8px 16px;
    background: #f1f5f9;
    border-radius: 8px;
}

.ev-quiz-timer.ev-timer-warning {
    background: #fef3c7;
    color: #b45309;
    animation: ev-timer-blink 1s ease infinite;
}

.ev-quiz-timer.ev-timer-danger {
    background: #fee2e2;
    color: #dc2626;
    animation: ev-timer-blink 0.5s ease infinite;
}

@keyframes ev-timer-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Progress Bar */
.ev-quiz-progress {
    margin-bottom: 32px;
}

.ev-quiz-progress-bar {
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.ev-quiz-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--quiz-primary), #8b5cf6);
    border-radius: 4px;
    transition: width 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.ev-quiz-progress-text {
    text-align: center;
    font-size: 14px;
    color: var(--quiz-text-light);
}

.ev-current-question {
    font-weight: 700;
    color: var(--quiz-primary);
}

/* Question Slides */
.ev-quiz-slide {
    animation: ev-slide-in 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes ev-slide-in {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.ev-quiz-slide.ev-slide-out {
    animation: ev-slide-out 0.3s ease forwards;
}

@keyframes ev-slide-out {
    to {
        opacity: 0;
        transform: translateX(-30px);
    }
}

/* Question Card */
.ev-quiz-question-card {
    background: var(--quiz-card);
    border-radius: 20px;
    padding: 32px;
    margin-bottom: 24px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    text-align: center;
}

.ev-quiz-question-image {
    margin-bottom: 20px;
}

.ev-quiz-question-image img {
    max-width: 100%;
    max-height: 250px;
    border-radius: 12px;
    object-fit: contain;
}

.ev-quiz-question-title {
    font-size: 22px;
    font-weight: 600;
    color: var(--quiz-text);
    margin: 0 0 12px;
    line-height: 1.4;
}

.ev-quiz-question-desc {
    color: var(--quiz-text-light);
    margin: 0;
    font-size: 15px;
}

/* Answer Buttons */
.ev-quiz-answers {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ev-quiz-answer {
    display: flex;
    align-items: center;
    gap: 16px;
    width: 100%;
    padding: 16px 20px;
    background: var(--quiz-card);
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    font-size: 16px;
    color: var(--quiz-text);
}

.ev-quiz-answer:hover:not(:disabled) {
    border-color: var(--quiz-primary);
    background: #f8fafc;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.15);
}

.ev-quiz-answer:disabled {
    cursor: not-allowed;
}

.ev-answer-letter {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: #f1f5f9;
    border-radius: 8px;
    font-weight: 700;
    color: var(--quiz-text-light);
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.ev-quiz-answer:hover:not(:disabled) .ev-answer-letter {
    background: var(--quiz-primary);
    color: white;
}

.ev-answer-image {
    flex-shrink: 0;
}

.ev-answer-image img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 8px;
}

.ev-answer-text {
    flex: 1;
}

.ev-answer-icon {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    opacity: 0;
    transition: all 0.3s ease;
}

/* Answer States */
.ev-quiz-answer.ev-selected {
    border-color: var(--quiz-primary);
    background: #eef2ff;
}

.ev-quiz-answer.ev-selected .ev-answer-letter {
    background: var(--quiz-primary);
    color: white;
}

.ev-quiz-answer.ev-correct {
    border-color: var(--quiz-success);
    background: #ecfdf5;
    animation: ev-answer-correct 0.5s ease;
}

.ev-quiz-answer.ev-correct .ev-answer-letter {
    background: var(--quiz-success);
    color: white;
}

.ev-quiz-answer.ev-correct .ev-answer-icon {
    opacity: 1;
}

.ev-quiz-answer.ev-correct .ev-answer-icon::before {
    content: '✓';
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: var(--quiz-success);
    color: white;
    border-radius: 50%;
    font-weight: bold;
}

@keyframes ev-answer-correct {
    0%, 100% { transform: scale(1); }
    25% { transform: scale(1.02); }
    50% { transform: scale(0.98); }
}

.ev-quiz-answer.ev-wrong {
    border-color: var(--quiz-error);
    background: #fef2f2;
    animation: ev-answer-wrong 0.4s ease;
}

.ev-quiz-answer.ev-wrong .ev-answer-letter {
    background: var(--quiz-error);
    color: white;
}

.ev-quiz-answer.ev-wrong .ev-answer-icon {
    opacity: 1;
}

.ev-quiz-answer.ev-wrong .ev-answer-icon::before {
    content: '✗';
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: var(--quiz-error);
    color: white;
    border-radius: 50%;
    font-weight: bold;
}

@keyframes ev-answer-wrong {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-8px); }
    75% { transform: translateX(8px); }
}

.ev-quiz-answer.ev-reveal-correct {
    border-color: var(--quiz-success);
    background: #ecfdf5;
}

.ev-quiz-answer.ev-reveal-correct .ev-answer-letter {
    background: var(--quiz-success);
    color: white;
}

/* Feedback */
.ev-quiz-feedback {
    margin-top: 20px;
    padding: 16px 24px;
    border-radius: 12px;
    text-align: center;
    animation: ev-feedback-in 0.3s ease;
}

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

.ev-quiz-feedback.ev-feedback-correct {
    background: linear-gradient(135deg, #ecfdf5, #d1fae5);
    border: 1px solid #a7f3d0;
}

.ev-quiz-feedback.ev-feedback-correct .ev-feedback-content {
    color: #065f46;
}

.ev-quiz-feedback.ev-feedback-wrong {
    background: linear-gradient(135deg, #fef2f2, #fee2e2);
    border: 1px solid #fecaca;
}

.ev-quiz-feedback.ev-feedback-wrong .ev-feedback-content {
    color: #991b1b;
}

.ev-feedback-emoji {
    font-size: 32px;
    display: block;
    margin-bottom: 8px;
}

.ev-feedback-text {
    font-weight: 600;
    font-size: 18px;
}

.ev-feedback-explanation {
    font-size: 14px;
    margin-top: 8px;
    opacity: 0.8;
}

/* Navigation Buttons */
.ev-quiz-nav {
    display: flex;
    justify-content: center;
    margin-top: 24px;
}

.ev-quiz-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 32px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ev-quiz-btn-next {
    background: linear-gradient(135deg, var(--quiz-primary), var(--quiz-primary-dark));
    color: white;
}

.ev-quiz-btn-next:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.3);
}

.ev-quiz-btn-finish {
    background: linear-gradient(135deg, var(--quiz-success), #059669);
    color: white;
    animation: ev-finish-pulse 2s ease infinite;
}

@keyframes ev-finish-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); }
    50% { box-shadow: 0 0 0 12px rgba(16, 185, 129, 0); }
}

.ev-quiz-btn-secondary {
    background: #f1f5f9;
    color: var(--quiz-text);
}

.ev-quiz-btn-secondary:hover {
    background: #e2e8f0;
}

/* Results Screen */
.ev-quiz-results {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--quiz-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: ev-results-in 0.5s ease;
    z-index: 10;
}

@keyframes ev-results-in {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.ev-quiz-results-content {
    text-align: center;
    padding: 40px;
}

.ev-results-title {
    font-size: 32px;
    font-weight: 800;
    color: var(--quiz-text);
    margin: 0 0 32px;
}

/* Score Circle */
.ev-results-score-circle {
    position: relative;
    width: 180px;
    height: 180px;
    margin: 0 auto 32px;
}

.ev-results-score-circle svg {
    transform: rotate(-90deg);
    width: 100%;
    height: 100%;
}

.ev-score-bg {
    fill: none;
    stroke: #e2e8f0;
    stroke-width: 8;
}

.ev-score-fill {
    fill: none;
    stroke: var(--quiz-primary);
    stroke-width: 8;
    stroke-linecap: round;
    stroke-dasharray: 283;
    stroke-dashoffset: 283;
    transition: stroke-dashoffset 1.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.ev-results-score-circle.ev-passed .ev-score-fill {
    stroke: var(--quiz-success);
}

.ev-results-score-circle.ev-failed .ev-score-fill {
    stroke: var(--quiz-error);
}

.ev-score-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 42px;
    font-weight: 800;
    color: var(--quiz-text);
}

.ev-score-percent {
    font-size: 48px;
}

/* Results Stats */
.ev-results-details {
    display: flex;
    justify-content: center;
    gap: 32px;
    margin-bottom: 24px;
}

.ev-results-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.ev-stat-icon {
    font-size: 24px;
}

.ev-stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--quiz-text);
}

.ev-stat-label {
    font-size: 13px;
    color: var(--quiz-text-light);
}

.ev-results-message {
    font-size: 18px;
    color: var(--quiz-text-light);
    margin-bottom: 32px;
    padding: 16px 24px;
    background: #f1f5f9;
    border-radius: 12px;
    display: inline-block;
}

.ev-results-actions {
    display: flex;
    justify-content: center;
    gap: 16px;
}

/* Confetti Canvas */
#ev-confetti-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
}

/* Score Popup Animation */
.ev-score-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 64px;
    font-weight: 800;
    color: var(--quiz-success);
    text-shadow: 0 4px 20px rgba(16, 185, 129, 0.5);
    animation: ev-score-popup 1s ease forwards;
    z-index: 1000;
    pointer-events: none;
}

.ev-score-popup.ev-wrong {
    color: var(--quiz-error);
    text-shadow: 0 4px 20px rgba(239, 68, 68, 0.5);
}

@keyframes ev-score-popup {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.5);
    }
    30% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.2);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -100%) scale(1);
    }
}

/* Responsive */
@media (max-width: 640px) {
    .ev-quiz-gamified {
        padding: 16px;
    }
    
    .ev-quiz-header {
        flex-direction: column;
        gap: 16px;
        text-align: center;
    }
    
    .ev-quiz-title {
        font-size: 20px;
    }
    
    .ev-quiz-stats {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .ev-quiz-question-card {
        padding: 20px;
    }
    
    .ev-quiz-question-title {
        font-size: 18px;
    }
    
    .ev-quiz-answer {
        padding: 12px 16px;
        font-size: 15px;
    }
    
    .ev-answer-letter {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }
    
    .ev-results-details {
        flex-direction: column;
        gap: 16px;
    }
    
    .ev-results-title {
        font-size: 24px;
    }
    
    .ev-results-score-circle {
        width: 150px;
        height: 150px;
    }
    
    .ev-score-text {
        font-size: 32px;
    }
    
    .ev-score-percent {
        font-size: 36px;
    }
}

/* ==========================================================================
   QUIZ GAMIFIED - MOBILE OPTIMIZATIONS & SOUNDS
   ========================================================================== */

/* Sound Toggle Button */
.ev-sound-toggle {
    position: absolute;
    top: 0;
    right: 0;
    width: 40px;
    height: 40px;
    border: none;
    background: #f1f5f9;
    border-radius: 8px;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ev-sound-toggle:hover {
    background: #e2e8f0;
}

.ev-sound-toggle:active {
    transform: scale(0.95);
}

/* Score bump animation */
.ev-quiz-score-value.ev-score-bump {
    animation: ev-score-bump 0.3s ease;
}

@keyframes ev-score-bump {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.3); }
}

/* Enhanced streak animations */
.ev-quiz-streak.ev-streak-hot {
    animation: ev-streak-pulse 0.5s ease infinite;
}

.ev-quiz-streak.ev-streak-fire {
    background: linear-gradient(135deg, #ef4444, #f59e0b);
    animation: ev-streak-fire-pulse 0.3s ease infinite;
}

@keyframes ev-streak-fire-pulse {
    0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
    50% { transform: scale(1.05); box-shadow: 0 0 20px 5px rgba(239, 68, 68, 0.3); }
}

/* Time Up Modal */
.ev-quiz-timeup-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    animation: ev-modal-fade-in 0.3s ease;
}

@keyframes ev-modal-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.ev-timeup-content {
    background: white;
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    max-width: 400px;
    margin: 20px;
    animation: ev-modal-scale-in 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes ev-modal-scale-in {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.ev-timeup-icon {
    font-size: 64px;
    display: block;
    margin-bottom: 16px;
    animation: ev-timeup-shake 0.5s ease;
}

@keyframes ev-timeup-shake {
    0%, 100% { transform: rotate(0); }
    25% { transform: rotate(-10deg); }
    75% { transform: rotate(10deg); }
}

.ev-timeup-content h3 {
    font-size: 24px;
    margin: 0 0 8px;
    color: #1e293b;
}

.ev-timeup-content p {
    color: #64748b;
    margin: 0 0 24px;
}

.ev-timeup-btn {
    width: 100%;
}

/* MOBILE OPTIMIZATIONS */
@media (max-width: 768px) {
    .ev-quiz-gamified {
        padding: 12px;
        min-height: 100vh;
        min-height: 100dvh; /* Dynamic viewport height for mobile browsers */
    }
    
    /* Header mobile */
    .ev-quiz-header {
        flex-direction: column;
        gap: 12px;
        text-align: center;
        padding-bottom: 12px;
        position: relative;
    }
    
    .ev-quiz-title {
        font-size: 18px;
        padding-right: 0;
    }
    
    .ev-quiz-stats {
        flex-wrap: wrap;
        justify-content: center;
        gap: 10px;
    }
    
    .ev-quiz-score {
        padding: 6px 16px;
        min-width: 70px;
    }
    
    .ev-quiz-score-value {
        font-size: 24px;
    }
    
    .ev-quiz-streak {
        padding: 6px 12px;
    }
    
    .ev-quiz-timer {
        padding: 6px 12px;
        font-size: 16px;
    }
    
    .ev-sound-toggle {
        position: absolute;
        top: -4px;
        right: -4px;
        width: 36px;
        height: 36px;
        font-size: 18px;
    }
    
    /* Progress mobile */
    .ev-quiz-progress {
        margin-bottom: 20px;
    }
    
    .ev-quiz-progress-bar {
        height: 6px;
    }
    
    /* Question card mobile */
    .ev-quiz-question-card {
        padding: 20px 16px;
        border-radius: 16px;
        margin-bottom: 16px;
    }
    
    .ev-quiz-question-image img {
        max-height: 180px;
    }
    
    .ev-quiz-question-title {
        font-size: 17px;
        line-height: 1.5;
    }
    
    .ev-quiz-question-desc {
        font-size: 14px;
    }
    
    /* Answer buttons mobile - larger touch targets */
    .ev-quiz-answers {
        gap: 10px;
    }
    
    .ev-quiz-answer {
        padding: 14px 16px;
        min-height: 56px; /* Minimum touch target size */
        border-radius: 14px;
        font-size: 15px;
        gap: 12px;
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
    }
    
    .ev-quiz-answer:active:not(:disabled) {
        transform: scale(0.98);
        background: #f1f5f9;
    }
    
    .ev-answer-letter {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }
    
    .ev-answer-image img {
        width: 50px;
        height: 50px;
    }
    
    .ev-answer-icon {
        width: 24px;
        height: 24px;
    }
    
    .ev-answer-icon::before {
        width: 24px !important;
        height: 24px !important;
        font-size: 14px !important;
    }
    
    /* Feedback mobile */
    .ev-quiz-feedback {
        padding: 14px 16px;
        border-radius: 14px;
        margin-top: 16px;
    }
    
    .ev-feedback-emoji {
        font-size: 28px;
    }
    
    .ev-feedback-text {
        font-size: 16px;
    }
    
    /* Navigation mobile */
    .ev-quiz-nav {
        margin-top: 20px;
        padding-bottom: 20px; /* Extra space for bottom nav bars on phones */
    }
    
    .ev-quiz-btn {
        padding: 16px 24px;
        font-size: 16px;
        width: 100%;
        border-radius: 14px;
        min-height: 54px;
    }
    
    /* Results mobile */
    .ev-quiz-results-content {
        padding: 24px 16px;
    }
    
    .ev-results-title {
        font-size: 24px;
        margin-bottom: 24px;
    }
    
    .ev-results-score-circle {
        width: 140px;
        height: 140px;
        margin-bottom: 24px;
    }
    
    .ev-score-text {
        font-size: 28px;
    }
    
    .ev-score-percent {
        font-size: 32px;
    }
    
    .ev-results-details {
        gap: 20px;
        margin-bottom: 20px;
    }
    
    .ev-stat-icon {
        font-size: 20px;
    }
    
    .ev-stat-value {
        font-size: 24px;
    }
    
    .ev-stat-label {
        font-size: 12px;
    }
    
    .ev-results-message {
        font-size: 15px;
        padding: 14px 16px;
        margin-bottom: 24px;
    }
    
    .ev-results-actions {
        flex-direction: column;
    }
    
    .ev-results-actions .ev-quiz-btn {
        width: 100%;
    }
}

/* Extra small screens */
@media (max-width: 380px) {
    .ev-quiz-title {
        font-size: 16px;
    }
    
    .ev-quiz-score {
        min-width: 60px;
        padding: 4px 12px;
    }
    
    .ev-quiz-score-value {
        font-size: 20px;
    }
    
    .ev-quiz-question-title {
        font-size: 16px;
    }
    
    .ev-quiz-answer {
        padding: 12px 14px;
        font-size: 14px;
    }
    
    .ev-answer-letter {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }
}

/* Landscape mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .ev-quiz-gamified {
        padding: 8px 16px;
    }
    
    .ev-quiz-header {
        flex-direction: row;
        justify-content: space-between;
    }
    
    .ev-quiz-question-card {
        padding: 16px;
    }
    
    .ev-quiz-question-image {
        float: left;
        margin-right: 16px;
        margin-bottom: 8px;
    }
    
    .ev-quiz-question-image img {
        max-height: 120px;
        max-width: 150px;
    }
    
    .ev-quiz-answers {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
    }
    
    .ev-results-score-circle {
        width: 120px;
        height: 120px;
    }
    
    .ev-results-details {
        flex-direction: row;
    }
}

/* Safe area insets for notched phones */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .ev-quiz-nav {
        padding-bottom: calc(20px + env(safe-area-inset-bottom));
    }
    
    .ev-quiz-results-content {
        padding-bottom: calc(24px + env(safe-area-inset-bottom));
    }
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    .ev-quiz-slide,
    .ev-quiz-answer,
    .ev-quiz-feedback,
    .ev-score-popup,
    .ev-quiz-streak,
    .ev-streak-fire {
        animation: none !important;
        transition: none !important;
    }
    
    .ev-score-fill {
        transition: stroke-dashoffset 0.1s ease !important;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .ev-quiz-gamified {
        --quiz-bg: #0f172a;
        --quiz-card: #1e293b;
        --quiz-text: #f1f5f9;
        --quiz-text-light: #94a3b8;
    }
    
    .ev-quiz-gamified {
        background: var(--quiz-bg);
    }
    
    .ev-quiz-question-card,
    .ev-quiz-answer {
        background: var(--quiz-card);
        border-color: #334155;
    }
    
    .ev-quiz-question-title,
    .ev-quiz-answer {
        color: var(--quiz-text);
    }
    
    .ev-answer-letter {
        background: #334155;
        color: #94a3b8;
    }
    
    .ev-quiz-progress-bar {
        background: #334155;
    }
    
    .ev-sound-toggle {
        background: #334155;
        color: var(--quiz-text);
    }
    
    .ev-quiz-timer {
        background: #334155;
        color: var(--quiz-text);
    }
}
