/**
 * Auditory Comprehension Exercise Widget - Styles
 * Responsive design for both sentence selection and word identification modes
 */

/* ============================================================================
   ROOT CONTAINER
   ============================================================================ */

.auditory-comprehension-root {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* When using exercise layout wrapper */
.exercise-layout-wrapper .auditory-comprehension-root,
.auditory-comprehension-root .exercise-layout-wrapper {
    max-width: 100%;
    padding: 0;
}

/* ============================================================================
   LOADING & ERROR STATES
   ============================================================================ */

.auditory-comprehension-root .loading-state,
.auditory-comprehension-root .error-state,
.auditory-comprehension-root .no-data-state {
    text-align: center;
    padding: 60px 20px;
    color: #6b7280;
    font-size: 16px;
}

.auditory-comprehension-root .error-state {
    color: #dc2626;
}

.auditory-comprehension-root .error-state button {
    margin-top: 20px;
    padding: 10px 24px;
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
}

.auditory-comprehension-root .error-state button:hover {
    background: #2563eb;
}

/* ============================================================================
   EXERCISE CONTENT AREA
   ============================================================================ */

.auditory-comprehension-root .exercise-content {
    background: #ffffff;
    border-radius: 12px;
    padding: 32px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* ============================================================================
   AUDIO PLAYER
   ============================================================================ */

.auditory-comprehension-root .audio-player {
    text-align: center;
    margin-bottom: 40px;
    padding: 40px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
}

.auditory-comprehension-root .play-button {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 16px 32px;
    background: white;
    color: #667eea;
    border: none;
    border-radius: 50px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.auditory-comprehension-root .play-button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.auditory-comprehension-root .play-button:active:not(:disabled) {
    transform: translateY(0);
}

.auditory-comprehension-root .play-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.auditory-comprehension-root .play-icon {
    font-size: 24px;
    line-height: 1;
}

.auditory-comprehension-root .play-text {
    font-size: 16px;
}

.auditory-comprehension-root .no-audio-warning {
    text-align: center;
    padding: 20px;
    background: #fef3c7;
    color: #92400e;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
}

/* ============================================================================
   SENTENCE CHOICES (Text-based mode)
   ============================================================================ */

.auditory-comprehension-root .sentence-choices {
    display: grid;
    gap: 16px;
    margin-bottom: 32px;
}

.auditory-comprehension-root .choice-item {
    width: 100%;
    padding: 20px 24px;
    background: #f9fafb;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    text-align: left;
    font-size: 16px;
    line-height: 1.6;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #1f2937;
}

.auditory-comprehension-root .choice-item:hover:not(:disabled) {
    background: #f3f4f6;
    border-color: #9ca3af;
    transform: translateX(4px);
}

.auditory-comprehension-root .choice-item.selected {
    background: #dbeafe;
    border-color: #3b82f6;
    font-weight: 500;
}

.auditory-comprehension-root .choice-item.correct {
    background: #d1fae5;
    border-color: #10b981;
    color: #065f46;
}

.auditory-comprehension-root .choice-item.incorrect {
    background: #fee2e2;
    border-color: #ef4444;
    color: #991b1b;
}

.auditory-comprehension-root .choice-item:disabled {
    cursor: not-allowed;
}

/* ============================================================================
   IMAGE CHOICES (Image-based mode)
   ============================================================================ */

.auditory-comprehension-root .image-choices {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.auditory-comprehension-root .image-choice-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px;
    background: #f9fafb;
    border: 3px solid #e5e7eb;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.auditory-comprehension-root .image-choice-item:hover:not(:disabled) {
    background: #f3f4f6;
    border-color: #9ca3af;
    transform: translateY(-4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.auditory-comprehension-root .image-choice-item.selected {
    background: #dbeafe;
    border-color: #3b82f6;
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.3);
}

.auditory-comprehension-root .image-choice-item.correct {
    background: #d1fae5;
    border-color: #10b981;
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.3);
}

.auditory-comprehension-root .image-choice-item.incorrect {
    background: #fee2e2;
    border-color: #ef4444;
    box-shadow: 0 4px 16px rgba(239, 68, 68, 0.3);
}

.auditory-comprehension-root .image-choice-item:disabled {
    cursor: not-allowed;
}

.auditory-comprehension-root .choice-image {
    width: 100%;
    height: 180px;
    object-fit: contain;
    border-radius: 8px;
    margin-bottom: 12px;
}

.auditory-comprehension-root .choice-label {
    font-size: 16px;
    font-weight: 500;
    color: #1f2937;
    text-align: center;
}

/* ============================================================================
   FEEDBACK OVERLAY
   ============================================================================ */

.auditory-comprehension-root .feedback-overlay {
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 24px;
    text-align: center;
    animation: fadeIn 0.3s ease;
}

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

.auditory-comprehension-root .feedback-overlay.correct {
    background: #d1fae5;
    border: 2px solid #10b981;
}

.auditory-comprehension-root .feedback-overlay.incorrect {
    background: #fee2e2;
    border: 2px solid #ef4444;
}

.auditory-comprehension-root .feedback-message {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 8px;
}

.auditory-comprehension-root .feedback-overlay.correct .feedback-message {
    color: #065f46;
}

.auditory-comprehension-root .feedback-overlay.incorrect .feedback-message {
    color: #991b1b;
}

.auditory-comprehension-root .correct-answer {
    font-size: 14px;
    color: #6b7280;
    margin-top: 8px;
}

.auditory-comprehension-root .auto-advance-indicator {
    margin-top: 12px;
    font-size: 13px;
    color: #6b7280;
    font-style: italic;
    animation: pulse 1.5s ease-in-out infinite;
}

.auditory-comprehension-root .feedback-overlay.correct .auto-advance-indicator {
    color: #047857;
}

.auditory-comprehension-root .feedback-overlay.incorrect .auto-advance-indicator {
    color: #b91c1c;
}

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

/* ============================================================================
   NAVIGATION
   ============================================================================ */

.auditory-comprehension-root .exercise-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding-top: 24px;
    border-top: 1px solid #e5e7eb;
}

.auditory-comprehension-root .progress-info {
    font-size: 14px;
    color: #6b7280;
    font-weight: 500;
}

.auditory-comprehension-root .nav-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.auditory-comprehension-root .prev-btn {
    background: #f3f4f6;
    color: #374151;
}

.auditory-comprehension-root .prev-btn:hover {
    background: #e5e7eb;
}

.auditory-comprehension-root .submit-btn,
.auditory-comprehension-root .next-btn,
.auditory-comprehension-root .finish-btn {
    background: #3b82f6;
    color: white;
}

.auditory-comprehension-root .submit-btn:hover:not(:disabled),
.auditory-comprehension-root .next-btn:hover:not(:disabled),
.auditory-comprehension-root .finish-btn:hover:not(:disabled) {
    background: #2563eb;
}

.auditory-comprehension-root .submit-btn:disabled {
    background: #9ca3af;
    cursor: not-allowed;
    opacity: 0.5;
}

.auditory-comprehension-root .finish-btn {
    background: #10b981;
}

.auditory-comprehension-root .finish-btn:hover {
    background: #059669;
}

/* ============================================================================
   COMPLETION SCREEN
   ============================================================================ */

.auditory-comprehension-root .completion-screen {
    text-align: center;
    padding: 60px 20px;
}

.auditory-comprehension-root .completion-screen h2 {
    font-size: 32px;
    color: #1f2937;
    margin-bottom: 32px;
}

.auditory-comprehension-root .final-score {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 40px;
    border-radius: 16px;
    margin-bottom: 32px;
}

.auditory-comprehension-root .score-percentage {
    font-size: 72px;
    font-weight: 700;
    margin-bottom: 12px;
}

.auditory-comprehension-root .score-detail {
    font-size: 18px;
    opacity: 0.9;
}

.auditory-comprehension-root .restart-btn {
    padding: 16px 32px;
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.auditory-comprehension-root .restart-btn:hover {
    background: #2563eb;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

/* ============================================================================
   PREVIEW MODE (Elementor Editor)
   ============================================================================ */

.auditory-comprehension-wrapper.preview-mode {
    background: #f9fafb;
    border: 2px dashed #d1d5db;
    border-radius: 8px;
    padding: 20px;
}

.auditory-comprehension-wrapper.preview-mode .exercise-preview-content {
    margin-top: 24px;
}

.auditory-comprehension-wrapper.preview-mode .audio-player-preview {
    text-align: center;
    margin-bottom: 24px;
    padding: 30px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
}

.auditory-comprehension-wrapper.preview-mode .audio-player-preview .play-button {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 24px;
    background: white;
    color: #667eea;
    border: none;
    border-radius: 50px;
    font-size: 16px;
    font-weight: 600;
}

.auditory-comprehension-wrapper.preview-mode .choices-preview {
    display: grid;
    gap: 12px;
}

.auditory-comprehension-wrapper.preview-mode .choice-item {
    padding: 16px 20px;
    background: #f3f4f6;
    border: 2px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
}

.auditory-comprehension-wrapper.preview-mode .image-choices-preview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
}

.auditory-comprehension-wrapper.preview-mode .image-choice {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f3f4f6;
    border: 2px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    color: #6b7280;
}

/* ============================================================================
   RESPONSIVE DESIGN - TABLET
   ============================================================================ */

@media (max-width: 768px) {
    .auditory-comprehension-root .exercise-content {
        padding: 24px 16px;
    }

    .auditory-comprehension-root .audio-player {
        padding: 30px 16px;
        margin-bottom: 32px;
    }

    .auditory-comprehension-root .play-button {
        padding: 14px 24px;
        font-size: 16px;
    }

    .auditory-comprehension-root .play-icon {
        font-size: 20px;
    }

    .auditory-comprehension-root .choice-item {
        padding: 16px 20px;
        font-size: 15px;
    }

    .auditory-comprehension-root .image-choices {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }

    .auditory-comprehension-root .choice-image {
        height: 140px;
    }

    .auditory-comprehension-root .exercise-navigation {
        flex-wrap: wrap;
    }

    .auditory-comprehension-root .progress-info {
        width: 100%;
        text-align: center;
        order: -1;
        margin-bottom: 12px;
    }

    .auditory-comprehension-root .completion-screen h2 {
        font-size: 24px;
    }

    .auditory-comprehension-root .score-percentage {
        font-size: 56px;
    }
}

/* ============================================================================
   RESPONSIVE DESIGN - MOBILE
   ============================================================================ */

@media (max-width: 480px) {
    .auditory-comprehension-root .exercise-content {
        padding: 20px 12px;
        border-radius: 8px;
    }

    .auditory-comprehension-root .audio-player {
        padding: 24px 12px;
        margin-bottom: 24px;
    }

    .auditory-comprehension-root .play-button {
        padding: 12px 20px;
        font-size: 14px;
        gap: 8px;
    }

    .auditory-comprehension-root .play-text {
        font-size: 14px;
    }

    .auditory-comprehension-root .choice-item {
        padding: 14px 16px;
        font-size: 14px;
    }

    .auditory-comprehension-root .image-choices {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .auditory-comprehension-root .image-choice-item {
        padding: 12px;
    }

    .auditory-comprehension-root .choice-image {
        height: 200px;
    }

    .auditory-comprehension-root .choice-label {
        font-size: 14px;
    }

    .auditory-comprehension-root .nav-btn {
        padding: 10px 16px;
        font-size: 13px;
    }

    .auditory-comprehension-root .feedback-message {
        font-size: 18px;
    }

    .auditory-comprehension-root .score-percentage {
        font-size: 48px;
    }

    .auditory-comprehension-root .score-detail {
        font-size: 16px;
    }
}

/* ============================================================================
   ACCESSIBILITY
   ============================================================================ */

.auditory-comprehension-root button:focus-visible,
.auditory-comprehension-root .choice-item:focus-visible,
.auditory-comprehension-root .image-choice-item:focus-visible {
    outline: 3px solid #3b82f6;
    outline-offset: 2px;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .auditory-comprehension-root * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .auditory-comprehension-root .choice-item,
    .auditory-comprehension-root .image-choice-item {
        border-width: 3px;
    }
}

/* ============================================================================
   PRINT STYLES
   ============================================================================ */

@media print {
    .auditory-comprehension-root .audio-player,
    .auditory-comprehension-root .exercise-navigation {
        display: none;
    }

    .auditory-comprehension-root .choice-item.correct::after {
        content: " ✓";
        color: #10b981;
        font-weight: bold;
    }
}

/* Skip button styling */
.auditory-comprehension-root .skip-btn {
    background: #6b7280;
    color: white;
}

.auditory-comprehension-root .skip-btn:hover:not(:disabled) {
    background: #4b5563;
}