/**
 * Walt Opie Enhanced Audio Player Styles
 * Meditation-focused design with earth tones and smooth interactions
 */

.walt-enhanced-audio-player {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    max-width: 100%;
    margin: 0 auto;
    user-select: none;
    position: relative;
}

/* Progress Bar Styling */
.progress-bar-container {
    position: relative;
    background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
    border-radius: 8px;
    overflow: visible;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.06);
}

.progress-bar-container:hover {
    height: 12px !important;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1), 0 2px 8px rgba(0, 0, 0, 0.1);
}

.progress-bar {
    background: linear-gradient(135deg, var(--primary, #8B4513) 0%, var(--secondary, #2E8B57) 100%);
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(139, 69, 19, 0.3);
    transition: width 0.1s ease-out;
    position: relative;
}

.progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 100%;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.2) 0%, transparent 50%);
    border-radius: 8px;
    pointer-events: none;
}

.progress-handle {
    width: 16px;
    height: 16px;
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border: 3px solid var(--primary, #8B4513);
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2), 0 1px 3px rgba(0, 0, 0, 0.1);
    cursor: grab;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10;
}

.progress-handle:active {
    cursor: grabbing;
    transform: translate(-50%, -50%) scale(1.2);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3), 0 2px 6px rgba(0, 0, 0, 0.15);
}

.progress-bar-container:hover .progress-handle {
    opacity: 1 !important;
    transform: translate(-50%, -50%) scale(1.1);
}

/* Control Button Styling */
.play-pause-btn {
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(139, 69, 19, 0.3), 0 2px 6px rgba(139, 69, 19, 0.2);
    transform: scale(1);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.play-pause-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.6s;
}

.play-pause-btn:hover::before {
    left: 100%;
}

.play-pause-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(139, 69, 19, 0.4), 0 3px 8px rgba(139, 69, 19, 0.25);
}

.play-pause-btn:active {
    transform: scale(0.95);
}

.skip-backward-btn, .skip-forward-btn {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.skip-backward-btn::after, .skip-forward-btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: var(--primary, #8B4513);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: all 0.3s ease;
    opacity: 0.1;
    z-index: -1;
}

.skip-backward-btn:hover::after, .skip-forward-btn:hover::after {
    width: 100%;
    height: 100%;
}

.skip-backward-btn:hover, .skip-forward-btn:hover {
    background-color: rgba(139, 69, 19, 0.1);
    transform: scale(1.1);
}

/* Volume Slider Styling */
.volume-slider {
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    border-radius: 6px;
    outline: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border: 2px solid var(--primary, #8B4513);
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
}

.volume-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3);
}

.volume-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border: 2px solid var(--primary, #8B4513);
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
}

.volume-slider::-moz-range-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3);
}

/* Speed Control Styling */
.speed-control {
    border-radius: 8px;
    background: linear-gradient(135deg, #ffffff 0%, #f9fafb 100%);
    border: 1px solid #d1d5db;
    transition: all 0.2s ease;
    font-weight: 500;
}

.speed-control:hover {
    border-color: var(--primary, #8B4513);
    box-shadow: 0 0 0 3px rgba(139, 69, 19, 0.1);
}

.speed-control:focus {
    border-color: var(--primary, #8B4513);
    box-shadow: 0 0 0 3px rgba(139, 69, 19, 0.2);
}

/* Loading Indicator */
.loading-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary, #8B4513);
}

.loading-indicator svg {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Error Message Styling */
.error-message {
    background: linear-gradient(135deg, #fef2f2 0%, #fecaca 100%);
    border: 1px solid #f87171;
    border-radius: 12px;
    animation: slideIn 0.3s ease-out;
}

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

/* Time Display Styling */
.current-time, .duration {
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.5px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.talk-title {
    background: linear-gradient(135deg, var(--primary, #8B4513), var(--secondary, #2E8B57));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 600;
}

/* Volume Display */
.volume-display {
    font-variant-numeric: tabular-nums;
    min-width: 2rem;
    font-weight: 500;
}

/* Responsive Design */
@media (max-width: 640px) {
    .walt-enhanced-audio-player {
        padding: 1rem;
    }
    
    .controls-container {
        flex-wrap: wrap;
        gap: 0.75rem;
    }
    
    .play-pause-btn {
        padding: 0.75rem;
    }
    
    .play-pause-btn svg {
        width: 1.5rem;
        height: 1.5rem;
    }
    
    .skip-backward-btn, .skip-forward-btn {
        padding: 0.625rem;
    }
    
    .skip-backward-btn svg, .skip-forward-btn svg {
        width: 1.25rem;
        height: 1.25rem;
    }
    
    .volume-container {
        margin-top: 1rem;
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .volume-slider {
        width: 100%;
        max-width: 200px;
    }
    
    .additional-controls {
        flex-direction: column;
        gap: 1rem;
        align-items: center;
    }
}

/* Focus States for Accessibility */
.play-pause-btn:focus,
.skip-backward-btn:focus,
.skip-forward-btn:focus {
    outline: 2px solid var(--primary, #8B4513);
    outline-offset: 2px;
}

.volume-slider:focus {
    outline: 2px solid var(--primary, #8B4513);
    outline-offset: 2px;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .progress-bar-container {
        border: 2px solid #000;
    }
    
    .progress-bar {
        background: #000;
    }
    
    .progress-handle {
        border-color: #000;
        border-width: 3px;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .walt-enhanced-audio-player *,
    .walt-enhanced-audio-player *::before,
    .walt-enhanced-audio-player *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Print Styles */
@media print {
    .walt-enhanced-audio-player {
        display: none;
    }
}