/* Music Player Enhancements for Nabdi Poetry App */

/* Modal Volume Controls */
.modal-volume-toggle {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: #5D4037;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.modal-volume-toggle:hover {
    background: rgba(93, 64, 55, 0.1);
    transform: scale(1.1);
}

.modal-volume-toggle:active {
    transform: scale(0.95);
}

.modal-volume-slider {
    width: 80px;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: linear-gradient(to right, #D7C1A9 0%, #D7C1A9 50%, #E0E0E0 50%, #E0E0E0 100%);
    border-radius: 2px;
    outline: none;
    transition: all 0.3s ease;
    cursor: pointer;
}

.modal-volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    background: #CE8040;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.modal-volume-slider::-webkit-slider-thumb:hover {
    background: #B87030;
    transform: scale(1.2);
}

.modal-volume-slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    background: #CE8040;
    border-radius: 50%;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.modal-volume-slider::-moz-range-thumb:hover {
    background: #B87030;
    transform: scale(1.2);
}

/* Update poem modal audio container to accommodate new controls */
.poem-modal-audio {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    padding: 0 16px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .modal-volume-slider {
        width: 60px;
    }
    
    .poem-modal-audio {
        gap: 8px;
        padding: 0 12px;
    }
}

@media (max-width: 480px) {
    .modal-volume-slider {
        display: none; /* Hide slider on very small screens, keep toggle */
    }
}

/* Audio loading state */
.audio-loading {
    opacity: 0.6;
    pointer-events: none;
}

.audio-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border: 2px solid #D7C1A9;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Audio error state */
.audio-error .audio-time {
    color: #f44336;
    font-size: 12px;
}

/* Fade animations for smooth transitions */
@keyframes fadeInAudio {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.poem-modal-audio.active {
    animation: fadeInAudio 0.4s ease-out;
}

/* Volume icon states */
#modalVolumeIcon path,
#modalVolumeIcon polygon,
#modalVolumeIcon line {
    transition: all 0.2s ease;
}

.modal-volume-toggle:hover #modalVolumeIcon {
    stroke: #CE8040;
}

/* Progress bar enhancements */
.audio-progress-container {
    position: relative;
    flex: 1;
    height: 4px;
    background: rgba(93, 64, 55, 0.2);
    border-radius: 2px;
    cursor: pointer;
    overflow: hidden;
}

.audio-progress {
    height: 100%;
    background: linear-gradient(90deg, #CE8040, #D4A574);
    border-radius: 2px;
    transition: width 0.1s linear;
    position: relative;
}

.audio-progress::after {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 8px;
    height: 8px;
    background: #CE8040;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.audio-progress-container:hover .audio-progress::after {
    opacity: 1;
}

/* Audio time display */
.audio-time {
    font-size: 13px;
    color: #8D6E63;
    font-family: 'Courier New', monospace;
    min-width: 40px;
    text-align: center;
    user-select: none;
}

/* Play/Pause button enhancements */
.audio-toggle {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: #5D4037;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    position: relative;
}

.audio-toggle:hover {
    background: rgba(93, 64, 55, 0.1);
    transform: scale(1.1);
}

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

.audio-toggle svg {
    transition: all 0.2s ease;
}

/* Pulsing animation when playing */
.audio-toggle.playing::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: rgba(206, 128, 64, 0.2);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.5;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.3);
        opacity: 0;
    }
}

/* Bottom ribbon enhancements */
.poem-modal-bottom-ribbon {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    background: rgba(250, 248, 245, 0.98);
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(93, 64, 55, 0.1);
    position: sticky;
    bottom: 0;
    z-index: 10;
}

/* Accessibility improvements */
.audio-toggle:focus,
.modal-volume-toggle:focus,
.modal-volume-slider:focus {
    outline: 2px solid #CE8040;
    outline-offset: 2px;
}

/* Dark mode support (optional) */
@media (prefers-color-scheme: dark) {
    .poem-modal-bottom-ribbon {
        background: rgba(45, 35, 30, 0.98);
        border-top-color: rgba(215, 193, 169, 0.2);
    }
    
    .audio-toggle,
    .modal-volume-toggle {
        color: #D7C1A9;
    }
    
    .audio-time {
        color: #B7AFA3;
    }
    
    .audio-progress-container {
        background: rgba(215, 193, 169, 0.2);
    }
}

/* Smooth transitions for all interactive elements */
* {
    -webkit-tap-highlight-color: transparent;
}

button {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}
