/**
 * Audio Player Styles (Podcasts)
 * ===============================
 */

/* Overlay */
.audio-player-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(20px);
    z-index: var(--z-modal);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all var(--duration-normal) var(--ease-default);
}

.audio-player-overlay.open {
    opacity: 1;
    visibility: visible;
}

.audio-player-overlay.closing {
    opacity: 0;
}

/* Container */
.audio-player-container {
    width: 100%;
    max-width: 440px;
    padding: var(--space-8);
    text-align: center;
    position: relative;
    animation: audioSlideUp var(--duration-normal) var(--ease-bounce);
}

@keyframes audioSlideUp {
    from {
        opacity: 0;
        transform: translateY(40px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Close Button */
.audio-player-close {
    position: absolute;
    top: 0;
    right: 0;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--radius-full);
    transition: all var(--duration-fast) var(--ease-default);
}

.audio-player-close svg {
    width: 24px;
    height: 24px;
}

.audio-player-close:hover {
    background: var(--bg-elevated);
    color: var(--text-primary);
}

/* Artwork */
.audio-player-artwork {
    margin-bottom: var(--space-6);
}

.audio-player-artwork-inner {
    position: relative;
    width: 280px;
    height: 280px;
    margin: 0 auto;
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow:
        0 20px 60px -10px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(212, 175, 125, 0.2);
}

.audio-player-artwork-inner img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.audio-player-artwork-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        180deg,
        transparent 0%,
        rgba(0, 0, 0, 0.3) 100%
    );
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: var(--space-4);
}

/* Audio Waves Animation */
.audio-waves {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    height: 30px;
}

.audio-waves span {
    width: 4px;
    height: 8px;
    background: var(--accent-primary);
    border-radius: 2px;
    transition: height 0.1s ease;
}

.audio-waves.playing span {
    animation: audioWave 0.5s ease-in-out infinite alternate;
}

.audio-waves.playing span:nth-child(1) { animation-delay: 0s; }
.audio-waves.playing span:nth-child(2) { animation-delay: 0.1s; }
.audio-waves.playing span:nth-child(3) { animation-delay: 0.2s; }
.audio-waves.playing span:nth-child(4) { animation-delay: 0.3s; }
.audio-waves.playing span:nth-child(5) { animation-delay: 0.4s; }

@keyframes audioWave {
    0% { height: 8px; }
    100% { height: 24px; }
}

/* Info */
.audio-player-info {
    margin-bottom: var(--space-6);
}

.audio-player-collection {
    font-size: var(--text-sm);
    color: var(--accent-primary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: var(--space-2);
}

.audio-player-title {
    font-size: var(--text-xl);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-1);
}

.audio-player-title-arabic {
    font-family: var(--font-arabic);
    font-size: var(--text-lg);
    color: var(--text-secondary);
    direction: rtl;
}

/* Progress Bar */
.audio-player-progress {
    margin-bottom: var(--space-6);
}

.audio-progress-bar {
    position: relative;
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-full);
    cursor: pointer;
    margin-bottom: var(--space-2);
}

.audio-progress-fill {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, var(--accent-primary), var(--ochre));
    border-radius: var(--radius-full);
    transition: width 0.1s linear;
}

.audio-progress-handle {
    position: absolute;
    top: 50%;
    left: 0;
    width: 14px;
    height: 14px;
    background: var(--text-primary);
    border-radius: var(--radius-full);
    transform: translate(-50%, -50%);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    opacity: 0;
    transition: opacity var(--duration-fast) var(--ease-default);
}

.audio-progress-bar:hover .audio-progress-handle {
    opacity: 1;
}

.audio-time {
    display: flex;
    justify-content: space-between;
    font-size: var(--text-xs);
    color: var(--text-tertiary);
    font-variant-numeric: tabular-nums;
}

/* Controls */
.audio-player-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-6);
    margin-bottom: var(--space-6);
}

.audio-control-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-default);
    position: relative;
}

.audio-control-secondary {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-full);
}

.audio-control-secondary svg {
    width: 24px;
    height: 24px;
}

.audio-control-secondary .skip-text {
    position: absolute;
    font-size: 9px;
    font-weight: 700;
    color: var(--text-primary);
}

.audio-control-secondary:hover {
    background: var(--bg-elevated);
    transform: scale(1.1);
}

.audio-control-main {
    width: 72px;
    height: 72px;
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--ochre) 100%);
    border-radius: var(--radius-full);
    color: var(--bg-primary);
    box-shadow:
        0 8px 24px rgba(212, 175, 125, 0.3),
        0 0 0 4px rgba(212, 175, 125, 0.1);
}

.audio-control-main svg {
    width: 32px;
    height: 32px;
}

.audio-control-main:hover {
    transform: scale(1.05);
    box-shadow:
        0 12px 32px rgba(212, 175, 125, 0.4),
        0 0 0 4px rgba(212, 175, 125, 0.2);
}

.audio-control-main:active {
    transform: scale(0.98);
}

/* Extras Row */
.audio-player-extras {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-4);
    margin-bottom: var(--space-6);
}

.audio-extra-left {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.audio-extra-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--radius-md);
    transition: all var(--duration-fast) var(--ease-default);
}

.audio-extra-btn svg {
    width: 20px;
    height: 20px;
}

.audio-extra-btn:hover {
    background: var(--bg-elevated);
    color: var(--text-primary);
}

.audio-speed-btn {
    width: auto;
    padding: 0 var(--space-3);
    font-size: var(--text-sm);
    font-weight: 600;
}

.audio-volume-slider {
    width: 80px;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--bg-tertiary);
    border-radius: var(--radius-full);
    cursor: pointer;
}

.audio-volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    background: var(--text-primary);
    border-radius: var(--radius-full);
    cursor: pointer;
}

.audio-volume-slider::-moz-range-thumb {
    width: 12px;
    height: 12px;
    background: var(--text-primary);
    border-radius: var(--radius-full);
    border: none;
    cursor: pointer;
}

/* Description */
.audio-player-description {
    text-align: left;
    padding: var(--space-4);
    background: var(--bg-elevated);
    border-radius: var(--radius-lg);
    max-height: 150px;
    overflow-y: auto;
}

.audio-player-description h3 {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-2);
}

.audio-player-description p {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    line-height: var(--leading-relaxed);
}

/* Error State */
.audio-error {
    color: var(--terracotta);
    font-size: var(--text-sm);
    margin-top: var(--space-2);
}

/* Light Theme Adjustments */
[data-theme="light"] .audio-player-overlay {
    background: rgba(255, 255, 255, 0.95);
}

[data-theme="light"] .audio-player-artwork-inner {
    box-shadow:
        0 20px 60px -10px rgba(0, 0, 0, 0.2),
        0 0 0 1px rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .audio-control-main {
    color: white;
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .audio-player-container {
        padding: var(--space-4);
        max-width: 100%;
    }

    .audio-player-artwork-inner {
        width: 220px;
        height: 220px;
    }

    .audio-player-title {
        font-size: var(--text-lg);
    }

    .audio-control-main {
        width: 64px;
        height: 64px;
    }

    .audio-control-main svg {
        width: 28px;
        height: 28px;
    }

    .audio-control-secondary {
        width: 44px;
        height: 44px;
    }

    .audio-volume-slider {
        width: 60px;
    }
}
