/**
 * La hora de la Jirafa - Estilos del Reproductor
 * Reproductor Web Moderno con Visualizador
 */

/* ============================================
   REPRODUCTOR FIJO
   ============================================ */
.fixed-player {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: 100px;
    background: rgba(28, 20, 8, 0.97);
    backdrop-filter: blur(30px);
    border-top: 2px solid rgba(245, 166, 35, 0.25);
    z-index: var(--z-player);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Barra de progreso */
.player-progress {
    height: 4px;
    background: var(--bg-elevated);
    cursor: pointer;
    position: relative;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary) 0%, var(--primary-dark) 100%);
    width: 0%;
    transition: width 0.1s linear;
    position: relative;
}

.progress-bar::after {
    content: '';
    position: absolute;
    right: -6px;
    top: 50%;
    transform: translateY(-50%);
    width: 12px;
    height: 12px;
    background: var(--primary);
    border-radius: 50%;
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.player-progress:hover .progress-bar::after {
    opacity: 1;
}

.player-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    gap: 24px;
}

/* Info del reproductor */
.player-info {
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: 200px;
    flex: 0 0 300px;
}

.player-cover {
    width: 56px;
    height: 56px;
    border-radius: var(--border-radius-md);
    overflow: hidden;
    flex-shrink: 0;
    position: relative;
}

.player-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.default-cover-small {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.player-details {
    min-width: 0;
    flex: 1;
}

#player-title {
    font-size: var(--font-size-base);
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
}

#player-artist {
    font-size: var(--font-size-sm);
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Controles de reproducción */
.player-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    justify-content: center;
}

.control-btn {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    border-radius: 50%;
    transition: all var(--transition-fast);
}

.control-btn:hover {
    color: var(--primary);
    background: rgba(255, 215, 0, 0.1);
}

.control-btn svg {
    width: 24px;
    height: 24px;
}

.play-control {
    width: 52px;
    height: 52px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: var(--bg-dark);
}

.play-control:hover {
    transform: scale(1.08);
    color: var(--bg-dark);
    background: var(--primary-light);
}

.play-control svg {
    width: 28px;
    height: 28px;
}

/* Extras del reproductor */
.player-extras {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 200px;
    justify-content: flex-end;
}

.volume-control {
    display: flex;
    align-items: center;
    gap: 8px;
}

#volume-slider {
    width: 80px;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--bg-elevated);
    border-radius: 2px;
    cursor: pointer;
}

#volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    background: var(--primary);
    border-radius: 50%;
    cursor: pointer;
}

#volume-slider::-moz-range-thumb {
    width: 12px;
    height: 12px;
    background: var(--primary);
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

/* Visualizador de audio — fondo completo del player */
#audio-visualizer {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    opacity: 1;
    z-index: 0;
}

/* El contenido del player debe quedar encima del canvas */
.player-progress,
.player-content {
    position: relative;
    z-index: 1;
}

/* ============================================
   ESTADOS DEL REPRODUCTOR
   ============================================ */
.fixed-player.playing {
    box-shadow: 0 -4px 20px rgba(255, 215, 0, 0.15);
}

.fixed-player.playing .play-icon {
    display: none;
}

.fixed-player.playing .pause-icon {
    display: block !important;
}

.fixed-player.playing .player-cover {
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

/* ============================================
   REPRODUCTOR POPUP (OPCIONAL)
   ============================================ */
.player-popup {
    position: fixed;
    bottom: 120px;
    right: 24px;
    width: 360px;
    background: var(--bg-card);
    border-radius: var(--border-radius-xl);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-xl);
    z-index: calc(var(--z-player) - 1);
    display: none;
    overflow: hidden;
}

.player-popup.open {
    display: block;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.popup-header {
    padding: 16px 20px;
    background: var(--bg-elevated);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.popup-header h4 {
    font-size: var(--font-size-sm);
    font-weight: 600;
}

.popup-close {
    width: 28px;
    height: 28px;
    background: var(--bg-dark);
    border-radius: 50%;
    color: var(--text-muted);
    font-size: 1.2rem;
}

.popup-content {
    padding: 20px;
}

.popup-cover {
    width: 100%;
    aspect-ratio: 1;
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    margin-bottom: 20px;
    position: relative;
}

.popup-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.popup-info {
    text-align: center;
    margin-bottom: 20px;
}

.popup-title {
    font-size: var(--font-size-lg);
    font-weight: 600;
    margin-bottom: 4px;
}

.popup-artist {
    color: var(--text-muted);
    font-size: var(--font-size-sm);
}

.popup-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
}

.popup-progress {
    margin-top: 20px;
}

/* ============================================
   CONTROLES ADICIONALES
   ============================================ */
.repeat-btn.active,
.shuffle-btn.active {
    color: var(--primary);
}

.like-btn.liked {
    color: var(--error);
}

.like-btn.liked svg {
    fill: var(--error);
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .fixed-player {
        height: 80px;
    }
    
    .player-content {
        padding: 0 16px;
        gap: 12px;
    }
    
    .player-info {
        flex: 0 0 auto;
        min-width: 0;
    }
    
    .player-cover {
        width: 44px;
        height: 44px;
    }
    
    .player-details {
        max-width: 120px;
    }
    
    #player-title {
        font-size: var(--font-size-sm);
    }
    
    #player-artist {
        font-size: var(--font-size-xs);
    }
    
    .player-controls {
        flex: 1;
    }
    
    .control-btn {
        width: 40px;
        height: 40px;
    }
    
    .play-control {
        width: 48px;
        height: 48px;
    }
    
    .play-control svg {
        width: 24px;
        height: 24px;
    }
    
    .player-extras {
        display: none;
    }
    
    #audio-visualizer {
        height: 40px;
    }
}

@media (max-width: 480px) {
    .player-info {
        flex: 1;
    }
    
    .player-details {
        max-width: 100px;
    }
    
    .player-controls .control-btn:not(.play-control):not(#prev-btn):not(#next-btn) {
        display: none;
    }
}