/* Rosho Foundation Audio Styles v06 */

/* Audio Status and Controls */
.audio-status {
    background: linear-gradient(135deg, #f8fafc, #e2e8f0);
    border: 2px solid #cbd5e1;
    border-radius: 12px;
    padding: 15px;
    margin: 10px 0;
    text-align: center;
    font-size: 14px;
    color: #475569;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.audio-status.active {
    background: linear-gradient(135deg, #ecfdf5, #d1fae5);
    border-color: #10b981;
    color: #047857;
    animation: audioPulse 2s ease-in-out infinite;
}

@keyframes audioPulse {
    0%, 100% { transform: scale(1); box-shadow: 0 2px 4px rgba(0,0,0,0.05); }
    50% { transform: scale(1.02); box-shadow: 0 4px 8px rgba(16,185,129,0.15); }
}

/* Voice Input Button Enhancements */
.voice-input-btn {
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 2px solid #e74c3c;
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.3);
}

.voice-input-btn:hover {
    background: linear-gradient(135deg, #c0392b, #a93226);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(231, 76, 60, 0.4);
}

.voice-input-btn.recording {
    background: linear-gradient(135deg, #e74c3c, #ff6b6b);
    animation: recordingPulse 1.5s ease-in-out infinite;
    box-shadow: 0 0 20px rgba(231, 76, 60, 0.6);
}

.voice-input-btn.recording::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 8px;
    height: 8px;
    background: #fff;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    animation: recordingDot 1s ease-in-out infinite;
}

@keyframes recordingPulse {
    0%, 100% { 
        transform: scale(1) translateY(-2px); 
        box-shadow: 0 6px 16px rgba(231, 76, 60, 0.4);
    }
    50% { 
        transform: scale(1.05) translateY(-2px); 
        box-shadow: 0 8px 20px rgba(231, 76, 60, 0.6);
    }
}

@keyframes recordingDot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Audio Control Buttons Container */
.audio-controls-container {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    margin: 10px 0;
    flex-wrap: wrap;
}

/* Audio Control Buttons */
.audio-control-btn {
    padding: 10px 16px;
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 2px 6px rgba(99, 102, 241, 0.25);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0;
}

.audio-control-btn:hover {
    background: linear-gradient(135deg, #4f46e5, #3730a3);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
}

.audio-control-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(99, 102, 241, 0.25);
}

.audio-control-btn.muted {
    background: linear-gradient(135deg, #6b7280, #4b5563);
}

.audio-control-btn.downloading {
    background: linear-gradient(135deg, #10b981, #059669);
    animation: downloadProgress 2s ease-in-out;
}

@keyframes downloadProgress {
    0% { background-position: -100% 0; }
    100% { background-position: 100% 0; }
}

/* Audio Player Enhancements */
#response-audio-player {
    background: linear-gradient(135deg, #f8fafc, #e2e8f0);
    border: 2px solid #cbd5e1;
    border-radius: 12px;
    padding: 15px;
    margin-top: 15px;
    transition: all 0.3s ease;
}

#response-audio-player.playing {
    background: linear-gradient(135deg, #ecfdf5, #d1fae5);
    border-color: #10b981;
}

#response-audio {
    width: 100%;
    height: 50px;
    border-radius: 8px;
    outline: none;
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

/* Age-Specific Audio Indicators */
.audio-age-indicator {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    margin: 4px;
    border: 2px solid;
    transition: all 0.3s ease;
}

.audio-age-indicator.age-5-8 {
    background: #ffe4f1;
    border-color: #ff1744;
    color: #ff1744;
}

.audio-age-indicator.age-9-12 {
    background: #e0f7f5;
    border-color: #00acc1;
    color: #00acc1;
}

.audio-age-indicator.age-13-16 {
    background: #e3f2fd;
    border-color: #1976d2;
    color: #1976d2;
}

.audio-age-indicator.age-17-21 {
    background: #fff3e0;
    border-color: #f57c00;
    color: #f57c00;
}

.audio-age-indicator.age-22-35 {
    background: #e8f5e8;
    border-color: #388e3c;
    color: #388e3c;
}

.audio-age-indicator.age-36-55 {
    background: #f3e5f5;
    border-color: #7b1fa2;
    color: #7b1fa2;
}

.audio-age-indicator.age-56-plus {
    background: #efebe9;
    border-color: #5d4037;
    color: #5d4037;
}

/* Loading and Processing States */
.audio-loading {
    position: relative;
    opacity: 0.7;
}

.audio-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #e2e8f0;
    border-top-color: #10b981;
    border-radius: 50%;
    animation: audioSpin 1s linear infinite;
}

@keyframes audioSpin {
    to { transform: rotate(360deg); }
}

/* Audio Waveform Animation (Visual Only) */
.audio-waveform {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
    height: 30px;
    margin: 10px 0;
}

.audio-waveform .bar {
    width: 3px;
    background: #10b981;
    border-radius: 2px;
    animation: waveform 1.5s ease-in-out infinite;
}

.audio-waveform .bar:nth-child(1) { animation-delay: 0.1s; height: 10px; }
.audio-waveform .bar:nth-child(2) { animation-delay: 0.2s; height: 20px; }
.audio-waveform .bar:nth-child(3) { animation-delay: 0.3s; height: 15px; }
.audio-waveform .bar:nth-child(4) { animation-delay: 0.4s; height: 25px; }
.audio-waveform .bar:nth-child(5) { animation-delay: 0.5s; height: 12px; }

@keyframes waveform {
    0%, 100% { transform: scaleY(1); opacity: 0.7; }
    50% { transform: scaleY(1.5); opacity: 1; }
}

/* Responsive Design */
@media (max-width: 768px) {
    .audio-control-btn {
        padding: 8px 12px;
        font-size: 12px;
        margin: 0 3px;
    }
    
    .voice-input-btn {
        min-width: 70px;
        padding: 10px;
        font-size: 13px;
    }
    
    .audio-status {
        padding: 12px;
        font-size: 13px;
    }
    
    #response-audio {
        height: 45px;
    }
}

@media (max-width: 480px) {
    .audio-controls {
        flex-direction: column;
        gap: 8px;
    }
    
    .audio-control-btn {
        width: 100%;
        justify-content: center;
    }
    
    .input-container {
        flex-direction: column;
        gap: 10px;
    }
    
    .voice-input-btn {
        width: 100%;
        margin-left: 0;
    }
}

/* Accessibility Enhancements */
.audio-control-btn:focus,
.voice-input-btn:focus {
    outline: 2px solid #4f46e5;
    outline-offset: 2px;
}

.audio-status[aria-live="polite"] {
    /* Screen reader announcements */
    position: relative;
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .voice-input-btn.recording,
    .audio-status.active,
    .audio-waveform .bar,
    .audio-loading::after {
        animation: none;
    }
    
    .audio-control-btn:hover,
    .voice-input-btn:hover {
        transform: none;
    }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .audio-status {
        border-width: 3px;
    }
    
    .audio-control-btn,
    .voice-input-btn {
        border: 2px solid currentColor;
    }
}
