/**
 * ============================================
 * UNIVERSAL AUDIO PLAYER - CSS Styles
 * ============================================
 * Unified styles for:
 * - Hadith Audio
 * - Library Audio
 * - Quran Audio
 * - Any other audio content
 */

/* ============================================ */
/* AUDIO BUTTON BASE STYLES                     */
/* ============================================ */

.universal-audio-btn,
.hadith-audio-btn,
.library-audio-btn,
.quran-audio-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
    z-index: 10;
}

.universal-audio-btn:hover,
.hadith-audio-btn:hover,
.library-audio-btn:hover,
.quran-audio-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.5);
}

.universal-audio-btn:active,
.hadith-audio-btn:active,
.library-audio-btn:active,
.quran-audio-btn:active {
    transform: scale(0.95);
}

.universal-audio-btn.playing,
.hadith-audio-btn.playing,
.library-audio-btn.playing,
.quran-audio-btn.playing {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    animation: audioPulse 1.5s infinite;
}

.universal-audio-btn svg,
.hadith-audio-btn svg,
.library-audio-btn svg,
.quran-audio-btn svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

@keyframes audioPulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(240, 147, 251, 0.7);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(240, 147, 251, 0);
    }
}


/* ============================================ */
/* HADITH AUDIO BUTTON (Positioned)            */
/* ============================================ */

.rows .hadith-audio-btn {
    position: absolute;
    right: 10px;
    top: 10px;
}

.rows {
    position: relative;
}


/* ============================================ */
/* LIBRARY AUDIO BUTTON                         */
/* ============================================ */

.library-audio-btn {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    box-shadow: 0 2px 8px rgba(17, 153, 142, 0.3);
}

.library-audio-btn:hover {
    box-shadow: 0 4px 15px rgba(17, 153, 142, 0.5);
}

.library-audio-btn.playing {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

/* Library chapter breadcrumb audio button positioning */
.library-chapter-breadcrumb .library-audio-btn {
    width: 28px;
    height: 28px;
    margin-left: 10px;
}

.library-chapter-breadcrumb .library-audio-btn svg {
    width: 14px;
    height: 14px;
}


/* ============================================ */
/* QURAN AUDIO BUTTON                           */
/* ============================================ */

.quran-audio-btn {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    box-shadow: 0 2px 8px rgba(240, 147, 251, 0.3);
}

.quran-audio-btn:hover {
    box-shadow: 0 4px 15px rgba(240, 147, 251, 0.5);
}


/* ============================================ */
/* GLOBAL AUDIO PLAYER (Fixed at bottom)       */
/* ============================================ */

#global-audio-player {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%) !important;
    padding: 12px 20px !important;
    display: none;
    align-items: center !important;
    gap: 15px !important;
    z-index: 99999 !important;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3) !important;
    border-top: 1px solid rgba(255, 255, 255, 0.1) !important;
    flex-wrap: wrap !important;
    visibility: visible !important;
    opacity: 1 !important;
    transform: none !important;
    height: auto !important;
    min-height: 60px !important;
}

#global-audio-player.active {
    display: flex !important;
}


/* ============================================ */
/* PLAYER INFO                                  */
/* ============================================ */

.audio-player-info {
    display: flex;
    flex-direction: column;
    min-width: 120px;
    max-width: 200px;
}

.audio-player-info .audio-title {
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.audio-player-info .audio-subtitle {
    color: rgba(255, 255, 255, 0.6);
    font-size: 11px;
}


/* ============================================ */
/* PLAY/PAUSE BUTTON                            */
/* ============================================ */

.audio-play-pause-btn {
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.audio-play-pause-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.5);
}

.audio-play-pause-btn svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.audio-play-pause-btn .pause-icon {
    display: none;
}


/* ============================================ */
/* PROGRESS BAR                                 */
/* ============================================ */

.audio-progress-container {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 150px;
}

.audio-time {
    color: rgba(255, 255, 255, 0.8);
    font-size: 11px;
    font-family: 'Roboto Mono', monospace;
    min-width: 40px;
    text-align: center;
}

.audio-progress-bar {
    flex: 1;
    height: 6px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.audio-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    border-radius: 3px;
    width: 0%;
    transition: width 0.1s linear;
}

.audio-progress-bar:hover .audio-progress-fill {
    background: linear-gradient(90deg, #f093fb, #f5576c);
}


/* ============================================ */
/* SPEED CONTROL                                */
/* ============================================ */

.audio-speed-control {
    display: flex;
    align-items: center;
    gap: 5px;
}

.audio-speed-control label {
    color: rgba(255, 255, 255, 0.6);
    font-size: 11px;
}

.audio-speed-select {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    color: #fff;
    padding: 4px 8px;
    font-size: 12px;
    cursor: pointer;
    outline: none;
}

.audio-speed-select:hover {
    background: rgba(255, 255, 255, 0.2);
}

.audio-speed-select option {
    background: #1a1a2e;
    color: #fff;
}


/* ============================================ */
/* VOLUME CONTROL                               */
/* ============================================ */

.audio-volume-control {
    display: flex;
    align-items: center;
    gap: 8px;
}

.audio-volume-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.audio-volume-btn:hover {
    color: #fff;
}

.audio-volume-btn svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.audio-volume-btn .volume-muted-icon {
    display: none;
}

.audio-volume-slider {
    width: 80px;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    cursor: pointer;
}

.audio-volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    background: #667eea;
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.2s;
}

.audio-volume-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.audio-volume-slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    background: #667eea;
    border-radius: 50%;
    cursor: pointer;
    border: none;
}


/* ============================================ */
/* CLOSE BUTTON                                 */
/* ============================================ */

.audio-close-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    border-radius: 50%;
}

.audio-close-btn:hover {
    color: #f5576c;
    background: rgba(245, 87, 108, 0.1);
}

.audio-close-btn svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}


/* ============================================ */
/* LOADING STATE                                */
/* ============================================ */

.audio-loading {
    position: relative;
}

.audio-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: audioSpin 0.8s linear infinite;
}

@keyframes audioSpin {
    to {
        transform: rotate(360deg);
    }
}


/* ============================================ */
/* ERROR STATE                                  */
/* ============================================ */

.audio-error {
    color: #f5576c;
    font-size: 12px;
    padding: 5px 10px;
    background: rgba(245, 87, 108, 0.1);
    border-radius: 4px;
}


/* ============================================ */
/* RESPONSIVE DESIGN                            */
/* ============================================ */

@media (max-width: 768px) {
    #global-audio-player {
        padding: 10px 15px !important;
        gap: 10px !important;
    }
    
    .audio-player-info {
        display: none;
    }
    
    .audio-progress-container {
        order: 2;
        width: 100%;
        min-width: unset;
    }
    
    .audio-play-pause-btn {
        width: 40px;
        height: 40px;
    }
    
    .audio-volume-slider {
        width: 60px;
    }
    
    .audio-speed-control label {
        display: none;
    }
    
    /* Smaller audio buttons on mobile */
    .universal-audio-btn,
    .hadith-audio-btn,
    .library-audio-btn,
    .quran-audio-btn {
        width: 32px;
        height: 32px;
    }
    
    .universal-audio-btn svg,
    .hadith-audio-btn svg,
    .library-audio-btn svg,
    .quran-audio-btn svg {
        width: 16px;
        height: 16px;
    }
}

@media (max-width: 480px) {
    .audio-volume-control {
        display: none;
    }
    
    .audio-speed-select {
        padding: 3px 5px;
        font-size: 11px;
    }
}
