#floatingPlayer {
    position: fixed;
    bottom: 65px;
    left: 5%;
    width: 90%;
    display: grid;
    grid-template-columns: 220px 1fr 220px;
    align-items: center;
    padding: 10px 80px;
    background: #000000a6;
    border: 1px solid #FFCC00;
    border-radius: 20px;
    color: white;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.5);
    transform: translateY(200%);  /*Oculto (fuera de la pantalla) */
    transition: transform 0.3s ease-out;  /*Animación de entrada/salida */
    z-index: 9999;
}

/* 2. Ocultar el elemento de audio nativo (SÓLO lo usamos como motor) */
#audioPlayerContainerFloat audio {
    display: none !important; 
}

/* 3. Estilos de los controles personalizados */
#customPlayerControls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    padding: 5px 0;
    color: white;
    width: 100%;
}

.player-icon {
    background: none;
    border: none;
    color: white; /* Iconos blancos */
    font-size: 1.2em;
    cursor: pointer;
    padding: 5px;
}
.player-icon:hover {
    color: #ccc;
}

/* Botón shuffle activo */
#shuffleBtn.active {
    color: #FFCC00;
}
#shuffleBtn.active svg {
    stroke: #FFCC00;
}

/* Ocultar botones en modo single (canción individual) */
 
/* 4. Estilos para la barra de progreso (Personalización) */
#progressBar, #volumeControl {
    -webkit-appearance: none; /* Oculta el estilo nativo de Chrome/Safari */
    appearance: none;
    height: 6px;
    width: 100px;
    background: #555; /* Fondo de la barra */
    border-radius: 3px;
    cursor: pointer;
}

/* Thumb (el circulito de la barra) */
#progressBar::-webkit-slider-thumb, #volumeControl::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: white; /* Circulito blanco */
    cursor: pointer;
}

.contenedorCaratula {
    display: flex;
    flex-direction: row;
    gap: 20px;
    align-items: center;
}

#musicCaratulaCustom {
    width: 68px;
    height: 68px;
    border-radius: 10px;
    object-fit: cover;
    min-width: 50px;
    min-height: 50px;
}

#musicTitleCustom {
    font-weight: bold;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

#musicArtistaCustom {
    font-size: 0.8rem;
    color: white;
    font-weight: 400;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#musicTitleCustom {
    font-weight: bold;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mini-player-visible {
    transform: translateY(0) !important; /* Visible */
}

/* Estilos internos del reproductor */
#audioPlayerContainerFloat audio {
    width: 100%;
    margin-top: 5px;
}

.close-player-btn {
    background: none;
    border: none;
    color: white;
    font-size: 1.2em;
    cursor: pointer;
    margin-left: 15px;
}

audio::-webkit-media-controls, audio::-webkit-media-controls-enclosure, audio::-webkit-media-controls-panel {
    background: #0e0e0e !important;
    color: #ffffff;
    border-radius: 10px;
}

audio::-webkit-media-controls-panel {
    background-color: #0e0e0e;
}

audio::-webkit-media-controls-play-button,
audio::-webkit-media-controls-time-remaining-display, audio::-webkit-media-controls-current-time-display, audio::-webkit-media-controls-timeline,
audio::-webkit-media-controls-timeline {
    color: #fff
}

.left-section {
    display: flex;
    align-items: center;
    gap: 20px;
}

.center-section {
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.right-section {
    display: flex;
    justify-content: flex-end;
    min-width: 40px;
}

@media (max-width: 1450px) {
    #floatingPlayer {
        grid-template-columns: 120px 1fr 50px;
        width: 95%;
        left: 2.5%;
        right: 2.5%;
        padding: 10px 20px;
    }

    #musicCaratulaCustom {
        width: 55px;
        height: 55px;
    }

    .contenedorCaratula {
        gap: 10px;
        overflow: hidden;
        align-items: center;
    }

    .info-music {
        flex-direction: column;
        max-width: 90px;
        min-width: 0;
        overflow: hidden;
        justify-content: center;
    }

    #musicTitleCustom, #musicArtistaCustom {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    #musicTitleCustom {
        font-size: 0.85rem;
        font-weight: bold;
    }

    #musicArtistaCustom {
        font-size: 0.75rem;
        font-weight: 400;
        opacity: 0.9;
    }

    /* Controles */
    #customPlayerControls {
        gap: 10px;
        justify-content: center;
        width: 100%;
        min-width: 0;
    }

    #progressBar {
        height: 4px;
    }

    #volumeControl {
        width: 80px
    }

    .close-player-btn {
        font-size: 1.1rem;
    }
}

@media (max-width: 700px) {
    #floatingPlayer {
        grid-template-columns: 60px 1fr 40px;
        width: 95%;
        border-radius: 15px;
        left: 3%;
        right: 3%;
    }

    .contenedorCaratula {
        gap: 10px;
    }

    #musicCaratulaCustom {
        width: 50px;
        height: 50px;
    }

    .info-music {
        display: none;
    }

    #customPlayerControls {
        gap: 5px;
    }

    #progressBar {
        display: block;
        width: 100%;
        height: 4px;
    }

    #volumeControl,
    #volumeBtn {
        display: none;
    }

    .close-player-btn {
        margin-left: 0;
        font-size: 1em;
    }
}

@media (max-width: 450px) {
    #floatingPlayer {
        grid-template-columns: 1fr 40px !important;
        padding: 8px 12px;
        width: 94%;
        left: 3%;
        right: 3%;
    }

    .contenedorCaratula {
        display: none !important;
    }

    #musicCaratulaCustom {
        display: none !important;
    }

    #customPlayerControls {
        display: flex;
        justify-content: center;
        align-items: center;
        gap: 6px;
    }

    #progressBar {
        width: 100%;
        height: 4px;
    }

    #volumeControl {
        display: none !important;
    }

    #shuffleBtn {
        display: none !important;
    }

    .close-player-btn {
        font-size: 1.2rem;
    }
}

@media (max-width: 360px) {
    #floatingPlayer {
        grid-template-columns: 1fr 35px !important;
        padding: 6px 10px;
    }

    .contenedorCaratula {
        display: none !important;
    }

    #customPlayerControls {
        gap: 4px;
        justify-content: center;
    }

    .player-icon[data-action="back"], .player-icon[data-action="forward"], #volumeControl {
        display: none !important;
    }

    #progressBar {
        width: 100%;
        height: 4px;
        display: block;
    }

    .close-player-btn {
        font-size: 1.1rem;
    }
}

/* ============================================
   ESTADOS DE CONEXIÓN Y REPRODUCCIÓN EN SEGUNDO PLANO
   ============================================ */

/* Estado sin conexión */
#floatingPlayer.offline-mode {
    border-color: #ff6b6b;
    position: relative;
}

#floatingPlayer.offline-mode::after {
    content: 'Sin conexión';
    position: absolute;
    top: -8px;
    right: 20px;
    background: #ff6b6b;
    color: white;
    font-size: 0.65rem;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 500;
}

/* Indicador de que se requiere interacción del usuario */
#playPauseBtn.needs-interaction {
    animation: pulse-attention 1.5s ease-in-out infinite;
    box-shadow: 0 0 0 0 rgba(255, 204, 0, 0.7);
}

@keyframes pulse-attention {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 204, 0, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(255, 204, 0, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(255, 204, 0, 0);
    }
}

/* Quitar animación cuando se hace click */
#playPauseBtn:active,
#playPauseBtn:focus {
    animation: none;
}

/* Estado de reconexión */
#floatingPlayer.reconnecting::after {
    content: 'Reconectando...';
    position: absolute;
    top: -8px;
    right: 20px;
    background: #ffa500;
    color: white;
    font-size: 0.65rem;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 500;
    animation: blink 1s ease-in-out infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ============================================
   BOTÓN DE COLA EN REPRODUCTOR FLOTANTE
   ============================================ */

.queue-btn {
    position: relative;
    margin-right: 10px;
}

.queue-btn.active svg {
    stroke: var(--primary-color, #FFCC00);
}

.queue-count {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--primary-color, #FFCC00);
    color: #000;
    font-size: 0.65rem;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

.queue-count.hidden {
    display: none;
}

/* Badge en el tab del panel */
.queue-badge {
    background: var(--primary-color, #1DB954);
    color: #000;
    font-size: 0.65rem;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    margin-left: 4px;
}

.queue-badge.hidden {
    display: none;
}

/* ============================================
   PANEL DE COLA (QUEUE PANEL)
   ============================================ */

/* Cabecera de sección */
.queue-section-header {
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.queue-section-list {
    flex: 1;
}

/* Canción actual destacada */
.queue-current-wrapper {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 0.5rem;
}

.queue-current-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
    border-radius: 6px;
    background: linear-gradient(135deg, rgba(var(--primary-rgb, 29, 185, 84), 0.2) 0%, rgba(var(--primary-rgb, 29, 185, 84), 0.05) 100%);
}

.queue-current-item .queue-item-number {
    color: var(--primary-color, #1DB954);
    font-weight: 600;
}

/* Items de la cola */
.queue-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.queue-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.queue-item.playing {
    background: rgba(255, 255, 255, 0.15);
}

.queue-item-number {
    width: 24px;
    text-align: center;
    font-size: 0.8rem;
    color: #9ca3af;
    flex-shrink: 0;
}

.queue-item:hover .queue-item-number {
    color: transparent;
}

.queue-item:hover .queue-item-number::before {
    content: '▶';
    color: white;
    position: absolute;
    font-size: 0.7rem;
}

.queue-item-number {
    position: relative;
}

.queue-item-cover {
    width: 40px;
    height: 40px;
    border-radius: 4px;
    object-fit: cover;
    flex-shrink: 0;
}

.queue-item-info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.queue-item-title {
    font-size: 0.875rem;
    color: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
}

.queue-item.playing .queue-item-title {
    color: var(--primary-color, #1DB954);
}

.queue-item-artist {
    font-size: 0.75rem;
    color: #9ca3af;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.queue-item-duration {
    font-size: 0.75rem;
    color: #9ca3af;
    flex-shrink: 0;
}

.queue-item-playing-indicator {
    color: var(--primary-color, #1DB954);
    animation: pulse-eq 1s ease-in-out infinite;
}

@keyframes pulse-eq {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Mensaje cola vacía */
.queue-empty {
    text-align: center;
    padding: 2rem 1rem;
    color: #6b7280;
}

.queue-empty .material-symbols-outlined {
    font-size: 3rem;
    margin-bottom: 0.5rem;
    opacity: 0.5;
}

/* Responsive: ocultar botón de cola en móvil muy pequeño */
@media (max-width: 450px) {
    .queue-btn {
        display: none !important;
    }
}