/* Variables CSS - Se actualizan desde config.js en tiempo de ejecución.
   Los valores por defecto aquí deben coincidir con los colores de config.js
   para evitar un flash de colores incorrectos durante la carga inicial. */
:root {
    --bg-color-1: #15181e;
    --bg-color-2: #15181e;
    --bg-color-3: #15181e;
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --accent-color: #dc2626; /* Rojo para live/barras */
    --accent-color-rgb: 220, 38, 38; /* Para opacidades */
    --icon-color: #ffffff;
}

/* Reset y estilos base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    width: 100%;
    overflow: hidden;
    font-family: "Plus Jakarta Sans", sans-serif;
    background: linear-gradient(135deg, var(--bg-color-1) 0%, var(--bg-color-2) 50%, var(--bg-color-3) 100%);
    color: var(--text-primary);
}

/* Contenedor principal full-screen */
.radio-player {
    position: relative;
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* Efecto de brillo radial del fondo */
.background-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 600px;
    height: 600px;
    transform: translate(-50%, -50%);
    z-index: 1;
    pointer-events: none;
}

/* Contenedor del reproductor */
.player-container {
    position: relative;
    z-index: 2;
    width: 90%;
    max-width: 800px;
    border-radius: 24px;
    padding: 40px;
}

/* Sección de portada */
.cover-section {
    display: flex;
    justify-content: center;
    margin-bottom: 32px;
    position: relative;
    z-index: 10;
}

.cover-container {
    position: relative;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    /* overflow: hidden; Removed to allow glow to show outside */
    cursor: pointer;
    transition: transform 0.3s ease;
}

/* Glow/aura detrás del círculo: se extiende hacia abajo para crear el efecto
   de reflejo sutil sobre superficie, como en la imagen de referencia.
   El desplazamiento (top: 65%) lo empuja hacia abajo sin mover el círculo. */
.cover-container::before {
    content: '';
    position: absolute;
    top: 88%;
    left: 50%;
    width: 160%;
    height: 160%;
    transform: translate(-50%, -50%);
    background-image: var(--cover-bg);
    background-size: cover;
    background-position: center bottom;
    border-radius: 50%;
    z-index: -1;
    filter: blur(28px);
    opacity: 0.55;
    transition: opacity 0.3s ease, background-image 0.5s ease;
}

/* Máscara circular para el contenido interno (imágenes) */
.cover-inner {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    overflow: hidden;
    z-index: 2;
}

.cover-container:hover {
    transform: scale(1.05);
}


.cover-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
    opacity: 0;
    transform: scale(1.1); /* Efecto de zoom suave al salir */
    transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1), transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1;
}

.cover-container img.active {
    opacity: 1;
    transform: scale(1);
    z-index: 2;
}

.cover-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.cover-container:hover .cover-overlay {
    opacity: 1;
}

.cover-toggle {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: white;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.cover-toggle:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

/* Sección de información */
.info-section {
    text-align: center;
    margin-bottom: 24px;
    position: relative;
    z-index: 10;
}

.station-name {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 8px;
    color: #ffffff;
}

.track-info {
    margin-bottom: 16px;
    width: 100%;
    overflow: hidden; /* Asegurar que no desborde el contenedor padre */
}

.now-playing {
    font-size: 12px;
    font-weight: 300;
    color: rgba(255, 255, 255, 0.7);
    text-transform: uppercase;
    letter-spacing: 5px;
    display: block;
    margin-bottom: 4px;
}

.track-title-container {
    width: 100%;
    overflow: hidden;
    white-space: nowrap;
    position: relative;
    /* Máscara para suavizar los bordes del scroll */
    mask-image: linear-gradient(to right, transparent 0%, black 5%, black 95%, transparent 100%);
    -webkit-mask-image: linear-gradient(to right, transparent 0%, black 5%, black 95%, transparent 100%);
}

.track-title {
    font-size: 36px;
    font-weight: 400;
    color: #ffffff;
    line-height: 1.2;
    display: inline-block;
    white-space: nowrap;
    padding-left: 0;
    opacity: 0; /* Inicialmente oculto */
    transform: translateY(10px); /* Ligero desplazamiento inicial */
    /* Transición suave para opacidad y posición */
    transition: opacity 0.5s ease-in-out, transform 0.5s ease-in-out;
}

.track-title.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Skeleton shimmer mientras carga el título de la canción */
.track-title.loading {
    opacity: 1 !important;
    transform: translateY(0) !important;
    display: inline-block;
    min-width: 220px;
    height: 1.15em;
    background: linear-gradient(90deg,
        rgba(255,255,255,0.05) 25%,
        rgba(255,255,255,0.13) 50%,
        rgba(255,255,255,0.05) 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
    border-radius: 6px;
    color: transparent;
    vertical-align: middle;
}

@keyframes skeleton-shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Contenedor interno para el scroll */
.track-title-scroller {
    display: inline-flex;
    gap: 50px; /* Espacio entre el texto original y el duplicado */
    white-space: nowrap;
}

.track-title-scroller.scrolling {
    animation: scroll-continuous var(--scroll-duration, 10s) linear infinite;
}

@keyframes scroll-continuous {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(var(--scroll-distance));
    }
}

/* Barra de progreso */
.progress-section {
    margin-bottom: 32px;
    position: relative;
    z-index: 10;
}

/* Área de clic amplia (invisible), centrada verticalmente */
.progress-bar {
    position: relative;
    height: 20px;
    display: flex;
    align-items: center;
    cursor: pointer;
}

.progress-tooltip {
    position: absolute;
    bottom: 28px;
    left: 0;
    transform: translateX(-50%);
    background: rgba(10, 10, 20, 0.92);
    color: #fff;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.1s linear;
    white-space: nowrap;
    z-index: 20;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

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

/* Riel visible de la barra */
.progress-track {
    position: relative;
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 999px;
    transition: height 0.2s ease;
}

.progress-bar:hover .progress-track {
    height: 6px;
}

/* Parte rellena */
.progress-fill {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 35%;
    background: linear-gradient(90deg, var(--accent-color) 0%, color-mix(in srgb, var(--accent-color) 60%, #ff9999) 100%);
    border-radius: 999px;
    transition: width 0.3s ease;
    box-shadow: 0 0 10px rgba(var(--accent-color-rgb), 0.6);
}

/* Thumb — FUERA del overflow del track */
.progress-handle {
    position: absolute;
    top: 50%;
    left: 35%;
    width: 14px;
    height: 14px;
    background: #ffffff;
    border: 2.5px solid var(--accent-color);
    border-radius: 50%;
    transform: translate(-50%, -50%) scale(0.85);
    cursor: grab;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
    animation: progress-pulse 2s ease-out infinite;
    z-index: 2;
}

.progress-bar:hover .progress-handle {
    transform: translate(-50%, -50%) scale(1.1);
    animation: none;
    box-shadow: 0 0 0 6px rgba(var(--accent-color-rgb), 0.2), 0 2px 6px rgba(0, 0, 0, 0.4);
}

.progress-handle:active {
    cursor: grabbing;
    transform: translate(-50%, -50%) scale(1.2);
    box-shadow: 0 0 0 9px rgba(var(--accent-color-rgb), 0.15), 0 2px 6px rgba(0, 0, 0, 0.4);
}

@keyframes progress-pulse {
    0%   { box-shadow: 0 2px 6px rgba(0,0,0,0.4), 0 0 0 0px rgba(var(--accent-color-rgb), 0.5); }
    70%  { box-shadow: 0 2px 6px rgba(0,0,0,0.4), 0 0 0 7px rgba(var(--accent-color-rgb), 0); }
    100% { box-shadow: 0 2px 6px rgba(0,0,0,0.4), 0 0 0 0px rgba(var(--accent-color-rgb), 0); }
}

/* Tiempos bajo la barra de progreso */
.progress-times {
    display: flex;
    justify-content: space-between;
    margin-top: 6px;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-secondary);
    user-select: none;
}

/* Sección de controles */
.controls-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    position: relative;
    z-index: 10;
}

/* Control de volumen */
.volume-control {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    max-width: 300px;
}

.mute-button {
    width: 36px;
    height: 36px;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.mute-button:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
}

.volume-slider-container {
    position: relative;
    flex: 1;
    height: 20px;
    display: flex;
    align-items: center;
}

.volume-slider {
    position: absolute;
    width: 100%;
    height: 4px;
    background: transparent;
    outline: none;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    z-index: 2;
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: #ffffff;
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.volume-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.volume-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: #ffffff;
    border-radius: 50%;
    cursor: pointer;
    border: none;
    transition: transform 0.2s ease;
}

.volume-slider::-moz-range-thumb:hover {
    transform: scale(1.2);
}

.volume-track {
    position: absolute;
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    overflow: hidden;
}

.volume-fill {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 90%; /* Esto se actualiza dinámicamente con JS */
    background: var(--accent-color);
    border-radius: 2px;
    pointer-events: none; /* Permitir que los clics pasen al slider */
    /* transition removed for smoother JS animation and dragging */
}

.volume-percentage {
    font-size: 14px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.8);
    min-width: 35px;
    text-align: right;
}

.max-volume-button {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.max-volume-button:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
}

.volume-icon-right {
    color: inherit; /* Heredar color del botón padre */
}

/* Wrapper izquierdo: visualizer + share juntos */
.left-controls {
    display: flex;
    align-items: center;
    gap: 4px;
    justify-content: flex-end;
    justify-self: end;
}

/* Botón de compartir — mismo estilo que visualizer-toggle */
.share-button {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    padding: 12px;
    border-radius: 12px;
    transition: all 0.3s ease;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.share-button:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
}

/* Contenedor relativo para el popup */
.share-container {
    position: relative;
}

/* Popup de compartir */
.share-popup {
    position: absolute;
    bottom: calc(100% + 14px);
    left: 50%;
    transform: translateX(-50%) translateY(8px);
    width: 220px;
    background: rgba(15, 15, 20, 0.97);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 18px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
    z-index: 200;
    box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.6);
    pointer-events: none;
}

.share-popup.active {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
    pointer-events: all;
}

.share-popup-title {
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    margin: 0 0 14px 0;
    padding-bottom: 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    letter-spacing: 0.5px;
}

.share-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.share-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.5);
    text-decoration: none;
    transition: background 0.2s ease, color 0.2s ease, transform 0.15s ease;
    padding: 10px;
}

.share-icon:hover {
    background: rgba(255, 255, 255, 0.14);
    color: rgba(255, 255, 255, 0.95);
    transform: scale(1.1);
}

/* Flecha apuntando hacia el botón */
.share-popup-caret {
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid rgba(15, 15, 20, 0.97);
}

/* Controles principales */
.main-controls {
    display: grid;
    grid-template-columns: 1fr auto 1fr; /* Tres columnas: espacio flexible, botón auto, espacio flexible */
    align-items: center;
    width: 100%;
    gap: 24px;
}

.visualizer-toggle {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    padding: 12px;
    border-radius: 12px;
    transition: all 0.3s ease;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.visualizer-toggle:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
}

.play-button {
    justify-self: center; /* Centrar en la columna del medio */
    position: relative;
    width: 80px;
    height: 80px;
    background: #ffffff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

.play-button:hover {
    transform: scale(1.05);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
}

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

.play-button svg {
    color: #1a1a2e;
    transition: opacity 0.3s ease;
}

.play-button svg.hidden {
    display: none;
}

/* Indicador LIVE */

.live-indicator {
    justify-self: start; /* Alinear a la izquierda */
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(var(--accent-color-rgb), 0.2);
    padding: 8px 16px;
    border-radius: 20px;
    border: 1px solid rgba(var(--accent-color-rgb), 0.3);
    white-space: nowrap; /* Evitar que "En vivo" rompa en dos líneas */
    min-width: 0; /* Permite que el flexbox comprima el elemento si es necesario */
}

.live-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
}

.live-dot {
    width: 8px;
    height: 8px;
    background-color: var(--accent-color);
    border-radius: 50%;
    position: relative;
}

.live-dot::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    background-color: var(--accent-color);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    /* Animation paused by default, active via class */
    animation: none;
    z-index: -1;
}

.live-dot.pulsing::after {
    animation: live-pulse 2s infinite ease-out;
}

.live-text{
    font-size: 13px;
    font-weight: 700;
    color: var(--accent-color);
}

@keyframes live-pulse {
    0% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.8;
    }
    100% {
        transform: translate(-50%, -50%) scale(3);
        opacity: 0;
    }
}

/* Visualizador de ondas como fondo */
.visualizer-canvas {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 35vh; /* Ocupa el 35% inferior de la pantalla */
    z-index: 1; /* Detrás del player (z-index 2) pero sobre el fondo */
    pointer-events: none;
    opacity: 0; /* Inicialmente oculto */
    transition: opacity 0.2s ease-in-out;
}

.visualizer-canvas.visible {
    opacity: 1;
}

/* Responsive design */
@media (max-width: 768px) {
    .player-container {
        padding: 24px;
        width: 95%;
    }

    .cover-container {
        width: 160px;
        height: 160px;
    }

    .track-title {
        font-size: 24px;
    }

    .station-name {
        font-size: 20px;
    }

    .play-button {
        width: 70px;
        height: 70px;
    }

    /* Reducir gap entre columnas para dar más espacio a ambos lados */
    .main-controls {
        gap: 8px;
    }

    /* Botones más compactos para que los 3 quepan en la columna izquierda */
    .visualizer-toggle,
    .share-button,
    .history-button {
        width: 40px;
        height: 40px;
        padding: 8px;
    }

    .left-controls {
        gap: 2px;
    }

    /* Live indicator más compacto */
    .live-indicator {
        padding: 6px 10px;
        gap: 5px;
    }

    .live-text {
        font-size: 12px;
    }

    .listener-number {
        font-size: 12px;
    }

    .volume-control {
        max-width: 250px;
    }
}

@media (max-width: 480px) {
    .player-container {
        padding: 20px;
    }

    .cover-container {
        width: 140px;
        height: 140px;
    }

    .track-title {
        font-size: 20px;
    }

    .station-name {
        font-size: 18px;
    }

    .play-button {
        width: 60px;
        height: 60px;
    }

    .play-button svg {
        width: 24px;
        height: 24px;
    }

    /* Botones aún más pequeños en pantallas muy reducidas */
    .visualizer-toggle,
    .share-button,
    .history-button {
        width: 36px;
        height: 36px;
        padding: 6px;
    }

    .left-controls {
        gap: 1px;
    }

    .main-controls {
        gap: 6px;
    }

    /* Ocultar el contador de oyentes en pantallas muy pequeñas
       para que "En vivo" siempre quepa sin comprimir */
    .listener-separator,
    .listener-icon,
    .listener-number {
        display: none;
    }

    .live-indicator {
        padding: 6px 10px;
    }

    .volume-control {
        max-width: 200px;
    }

    .visualizer-canvas.visible {
        opacity: 0.2;
    }
}

/* Estados especiales */
.hidden {
    display: none !important;
}

.muted .volume-fill {
    background: rgba(255, 255, 255, 0.3);
}

.muted .volume-icon {
    color: rgba(255, 255, 255, 0.4);
}

/* Animaciones de transición */
.fade-in {
    animation: fadeIn 0.5s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ─── Oyentes en live-indicator ─────────────────────────────────────────────── */
.listener-separator {
    font-size: 13px;
    font-weight: 700;
    color: var(--accent-color);
    opacity: 0.6;
    line-height: 1;
}

.listener-icon {
    color: var(--accent-color);
    opacity: 0.85;
    flex-shrink: 0;
}

.listener-number {
    font-size: 13px;
    font-weight: 700;
    color: var(--accent-color);
    min-width: 14px;
}

/* ─── Botón historial ────────────────────────────────────────────────────────── */
.history-button {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    padding: 12px;
    border-radius: 12px;
    transition: all 0.3s ease;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.history-button:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
}

/* ─── Overlay de fondo del historial ────────────────────────────────────────── */
.history-overlay {
    position: fixed;
    inset: 0;
    z-index: 300;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    pointer-events: none;
}

.history-overlay.visible {
    opacity: 1;
    visibility: visible;
    pointer-events: all;
}

/* ─── Panel de historial ─────────────────────────────────────────────────────── */
.history-panel {
    position: fixed;
    top: 0;
    right: -320px;
    width: 300px;
    height: 100vh;
    z-index: 301;
    background: rgba(15, 15, 20, 0.97);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-left: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: column;
    transition: right 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: -8px 0 40px rgba(0, 0, 0, 0.5);
}

.history-panel.open {
    right: 0;
}

.history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 20px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
}

.history-title {
    font-size: 16px;
    font-weight: 600;
    color: #ffffff;
    margin: 0;
}

.history-close-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    padding: 6px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.history-close-btn:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
}

/* ─── Lista del historial ────────────────────────────────────────────────────── */
.history-list {
    list-style: none;
    overflow-y: auto;
    flex: 1;
    padding: 8px 0;
}

.history-list::-webkit-scrollbar {
    width: 4px;
}

.history-list::-webkit-scrollbar-track {
    background: transparent;
}

.history-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 2px;
}

.history-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    transition: background 0.2s ease;
}

.history-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.history-item:first-child .history-track {
    color: #ffffff;
    font-weight: 500;
}

.history-index {
    font-size: 11px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.3);
    min-width: 18px;
    text-align: right;
    flex-shrink: 0;
}

.history-track {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.75);
    line-height: 1.4;
    word-break: break-word;
}

/* ─── Spinner de carga del historial ─────────────────────────────────────────── */
.history-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 40px 20px;
}

.history-spinner {
    width: 28px;
    height: 28px;
    border: 2.5px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--accent-color, #dc2626);
    border-radius: 50%;
    animation: history-spin 0.7s linear infinite;
}

.history-loading-text {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.35);
    letter-spacing: 0.03em;
}

@keyframes history-spin {
    to { transform: rotate(360deg); }
}
