/* ═══════════════════════════════════════════════════════════════════════════════
   14. REPRODUCTOR DE AUDIO PERSONALIZADO
   Player de audio con controles de velocidad, progreso y descarga
   ═══════════════════════════════════════════════════════════════════════════════ */

.custom-audio-player {
    background: linear-gradient(135deg, #1f2937 0%, #374151 100%);
    border-radius: 12px;
    padding: 16px;
    margin: 8px 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    border: 1px solid #4b5563;
}

.audio-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.play-pause-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #00a884 0%, #00d4aa 100%);
    border: none;
    color: white;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 168, 132, 0.3);
}

.play-pause-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 168, 132, 0.4);
}

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

.audio-progress {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.progress-bar {
    height: 6px;
    background-color: #4b5563;
    border-radius: 3px;
    position: relative;
    cursor: pointer;
    transition: height 0.2s ease;
}

.progress-bar:hover {
    height: 8px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #00a884 0%, #00d4aa 100%);
    border-radius: 3px;
    width: 0%;
    transition: width 0.1s ease;
}

.progress-handle {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 14px;
    height: 14px;
    background: #00a884;
    border-radius: 50%;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

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

.time-display {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: #9ca3af;
    font-family: 'Courier New', monospace;
}

.speed-control {
    position: relative;
}

.speed-btn {
    background: #374151;
    border: 1px solid #4b5563;
    border-radius: 6px;
    color: #e5e7eb;
    padding: 6px 10px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 40px;
}

.speed-btn:hover {
    background: #4b5563;
    border-color: #6b7280;
}

.speed-menu {
    position: absolute;
    bottom: 100%;
    right: 0;
    background: #1f2937;
    border: 1px solid #374151;
    border-radius: 8px;
    padding: 4px 0;
    margin-bottom: 8px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 1000;
}

.speed-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.speed-option {
    padding: 8px 16px;
    font-size: 12px;
    color: #e5e7eb;
    cursor: pointer;
    transition: background-color 0.2s ease;
    white-space: nowrap;
}

.speed-option:hover {
    background-color: #374151;
}

.speed-option.active {
    background-color: #00a884;
    color: white;
}

.download-btn {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    background: #374151;
    border: 1px solid #4b5563;
    color: #9ca3af;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.download-btn:hover {
    background: #4b5563;
    color: #e5e7eb;
    border-color: #6b7280;
}

/* Responsive para móviles */
@media (max-width: 480px) {
    .custom-audio-player {
        padding: 12px;
    }
    
    .audio-controls {
        gap: 8px;
    }
    
    .play-pause-btn {
        width: 40px;
        height: 40px;
        font-size: 14px;
    }
    
    .time-display {
        font-size: 10px;
    }
    
    .speed-btn, .download-btn {
        padding: 4px 6px;
        font-size: 11px;
    }
}

/* Estado de carga del audio */
.custom-audio-player .media-loading {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px;
    background: linear-gradient(135deg, #1f2937 0%, #374151 100%);
    border-radius: 12px;
    border: 1px solid #4b5563;
}

.loading-audio-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6b7280 0%, #9ca3af 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 18px;
    animation: pulse 2s infinite;
}

.loading-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.loading-text span {
    color: #e5e7eb;
    font-size: 14px;
}

.loading-dots {
    display: flex;
    gap: 4px;
}

.loading-dots span {
    width: 6px;
    height: 6px;
    background-color: #00a884;
    border-radius: 50%;
    animation: loadingDots 1.4s infinite ease-in-out both;
}

.loading-dots span:nth-child(1) { animation-delay: -0.32s; }
.loading-dots span:nth-child(2) { animation-delay: -0.16s; }
.loading-dots span:nth-child(3) { animation-delay: 0s; }

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 0.7; }
    50% { transform: scale(1.05); opacity: 1; }
}

@keyframes loadingDots {
    0%, 80%, 100% {
        transform: scale(0);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Mejoras adicionales para el reproductor */
.custom-audio-player:hover {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
    transform: translateY(-1px);
    transition: all 0.3s ease;
}

.speed-text {
    font-weight: 600;
    color: #00a884;
}

/* Efectos adicionales y accesibilidad */
.custom-audio-player * {
    user-select: none;
}

.play-pause-btn:focus,
.speed-btn:focus,
.download-btn:focus {
    outline: 2px solid #00a884;
    outline-offset: 2px;
}

.progress-bar:focus {
    outline: 2px solid #00a884;
    outline-offset: 2px;
}

/* Animación de ondas de sonido cuando está reproduciendo */
.custom-audio-player.playing .loading-audio-icon {
    animation: soundWaves 1s infinite ease-in-out;
}

@keyframes soundWaves {
    0%, 100% { transform: scale(1); }
    25% { transform: scale(1.1); }
    50% { transform: scale(1.05); }
    75% { transform: scale(1.15); }
}

/* Tooltip para botones */
.play-pause-btn:hover::after,
.download-btn:hover::after,
.speed-btn:hover::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #1f2937;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    white-space: nowrap;
    z-index: 1000;
    margin-bottom: 5px;
}

/* Indicador de velocidad activa */
.speed-btn.active {
    background: #00a884;
    border-color: #00a884;
    color: white;
}

/* Mejora visual para dispositivos táctiles */
@media (hover: none) {
    .play-pause-btn:hover,
    .speed-btn:hover,
    .download-btn:hover {
        transform: none;
    }
    
    .progress-bar:hover {
        height: 6px;
    }
    
    .progress-bar:hover .progress-handle {
        opacity: 1;
    }
}

