/* CSS Document */

/* Importar fuente (ej. Roboto) */
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&display=swap');

body {
    font-family: 'Roboto', sans-serif;
    margin: 0;
    padding: 0;
    background: radial-gradient(circle at top right, #1e1e3f, #0d0d1e);
    /* Fondo con gradiente */
    color: #e0e0e0;
    overflow-x: hidden;
    min-height: 100vh;
}

.player-app {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    max-width: 450px;
    margin: 0 auto;
    background-color: #1a1a2e;
    /* Contenedor de la app */
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    position: relative;
    padding-bottom: 110px;
    /* Espacio para el reproductor inferior fijo con la barra */
    overflow: hidden;
    /* Asegura que el pseudo-elemento no se salga */
}

/* Fondo central sutil con altavoz.jpg */
.player-app::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 100%;
    background-image: url('altavoz.jpg');
    background-size: cover;
    background-position: center;
    opacity: 0.15;
    /* Sutil y transparente */
    z-index: 0;
    pointer-events: none;
    filter: grayscale(30%);
}

.player-app>* {
    position: relative;
    z-index: 1;
}

/* --- ENCABEZADO Y VINILO (Estilos existentes) --- */
.app-header {
    display: flex;
    align-items: center;
    padding: 20px 15px;
    background-color: #1a1a2e;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    z-index: 10;
}

.header-title {
    margin: 0 auto;
    font-size: 22px;
    font-weight: 500;
    color: #e0e0e0;
}

.player-visualizer {
    padding: 30px 0;
    display: flex;
    justify-content: center;
    align-items: center;
}

.vinyl-display {
    position: relative;
    width: 250px;
    height: 250px;
    border-radius: 50%;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.5);
    /* overflow: hidden; */
    /* Quitamos esto para que la sombra no se corte si hay bordes, pero lo manejamos en el script */
}

.vinyl-image,
.vinyl-image-temp {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    filter: brightness(0.8);
    animation: rotate-vinyl 20s linear infinite;
    animation-play-state: paused;
}

/* El disco gira cuando el contenedor tiene la clase .playing */
.vinyl-display.playing .vinyl-image {
    animation-play-state: running;
}

@keyframes rotate-vinyl {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.vinyl-center {
    position: absolute;
    width: 50px;
    height: 50px;
    background-color: #fce8d6;
    border-radius: 50%;
    border: 3px solid #e0e0e0;
    box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.5);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* --- LISTA DE PISTAS --- */
.tracklist-section {
    flex-grow: 1;
    padding: 0 15px 20px;
}

.track-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.track-item {
    display: flex;
    align-items: center;
    background: rgba(42, 42, 74, 0.4);
    /* Fondo semi-transparente */
    backdrop-filter: blur(5px);
    /* Glassmorphism */
    -webkit-backdrop-filter: blur(5px);
    margin-bottom: 12px;
    padding: 12px 15px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    position: relative;
    overflow: hidden;
    /* Importante para el pseudo-elemento */
}

/* Fondo difuminado con la carátula */
.track-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: var(--track-cover);
    background-size: cover;
    background-position: center;
    filter: blur(20px) brightness(0.4);
    opacity: 0.6;
    z-index: -1;
    transition: opacity 0.3s ease;
}

.track-item:hover::before {
    opacity: 0.8;
}

.track-item:hover {
    background-color: #2a2a4a;
    transform: scale(1.02);
    box-shadow: 0 4px 15px rgba(0, 123, 255, 0.2);
}

.track-item:active {
    transform: scale(0.98);
}

.track-item.active {
    background-color: #252550;
    /* Fondo azul oscuro para la pista activa */
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
}

.track-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    /* Bordes más suaves */
    margin-right: 15px;
    flex-shrink: 0;
    overflow: hidden;
    position: relative;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.track-cover-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: filter 0.3s ease;
}

.track-item:hover .track-icon {
    transform: scale(1.1);
    box-shadow: 0 6px 12px rgba(0, 123, 255, 0.4);
}

/* Efecto para pista activa */
.track-item.active .track-icon {
    border-radius: 50%;
    /* Convertir en círculo tipo vinilo */
    animation: pulse-active 2s infinite ease-in-out;
    border: 2px solid #007bff;
}

.track-item.active .track-icon::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 8px;
    height: 8px;
    background-color: #1a1a2e;
    border-radius: 50%;
    box-shadow: inset 0 0 2px rgba(255, 255, 255, 0.5);
}

@keyframes pulse-active {
    0% {
        box-shadow: 0 0 0 0 rgba(0, 123, 255, 0.7);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(0, 123, 255, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(0, 123, 255, 0);
    }
}

.track-details-list {
    flex-grow: 1;
}

.track-details-list h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 400;
    color: #e0e0e0;
}

.track-details-list p {
    margin: 0;
    font-size: 13px;
    color: #8c8c99;
}

.track-arrow {
    font-size: 24px;
    color: #8c8c99;
    margin-left: 15px;
}


/* --- REPRODUCTOR INFERIOR FIJO Y BARRA DE PROGRESO --- */

.bottom-player {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-width: 450px;
    margin: 0 auto;
    background: rgba(42, 42, 74, 0.7);
    /* Fondo cristal para el reproductor */
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.5);
    z-index: 20;
    display: flex;
    flex-direction: column;
}

/* 1. Barra de Progreso */
.progress-bar-container {
    padding: 10px 15px 0;
    /* Espacio superior para la barra */
    cursor: pointer;
}

.progress-bar {
    position: relative;
    height: 4px;
    width: 100%;
    background-color: #3a3a5a;
    /* Color de la barra vacía */
    border-radius: 2px;
}

.progress-fill {
    height: 100%;
    width: 0%;
    /* Controlado por JS */
    background-color: #007bff;
    /* Color de relleno */
    border-radius: 2px;
}

.progress-handle {
    position: absolute;
    top: 50%;
    left: 0%;
    /* Controlado por JS */
    transform: translate(-50%, -50%);
    width: 12px;
    height: 12px;
    background-color: #e0e0e0;
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
    display: block;
    /* Siempre visible para mejor UX */
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.progress-bar-container:hover .progress-handle {
    transform: translate(-50%, -50%) scale(1.3);
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.8);
}

/* 2. Contenido del Reproductor */
.player-content {
    display: flex;
    align-items: center;
    padding: 10px 15px 15px;
}

.current-track-info {
    display: flex;
    align-items: center;
    flex-grow: 1;
    margin-right: 15px;
}

.bottom-player .track-icon {
    width: 50px;
    height: 50px;
    border-radius: 8px;
    margin-right: 12px;
    flex-shrink: 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.bottom-player .track-details {
    overflow: hidden;
}

.bottom-player .track-title {
    margin: 0;
    font-size: 15px;
    font-weight: 500;
    color: #e0e0e0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bottom-player .track-duration-current {
    margin: 0;
    font-size: 12px;
    color: #8c8c99;
}

.player-buttons {
    display: flex;
    align-items: center;
}

.player-button {
    font-size: 30px;
    color: #e0e0e0;
    cursor: pointer;
    margin: 0 8px;
    transition: all 0.2s ease;
}

.player-button:hover {
    color: #007bff;
    text-shadow: 0 0 10px rgba(0, 123, 255, 0.8);
    transform: scale(1.2);
}

.player-button:active {
    transform: scale(0.9);
}

.player-button.play-pause {
    font-size: 45px;
    color: #007bff;
    text-shadow: 0 0 15px rgba(0, 123, 255, 0.5);
}

.player-button.play-pause:hover {
    text-shadow: 0 0 20px rgba(0, 123, 255, 1);
}

#audio-player {
    display: none;
}