/* 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;
}

.main-album-title {
    text-align: center;
    font-size: 28px;
    font-weight: 700;
    color: #e0e0e0;
    margin: 30px auto 15px;
    letter-spacing: 1px;
    text-shadow: 0 4px 12px rgba(0, 0, 0, 0.6);
}

.back-button {
    color: #e0e0e0;
    cursor: pointer;
    transition: color 0.2s ease;
}

.back-button:hover {
    color: #007bff;
}

/* El visualizador superior ha sido eliminado, ahora se integra en la lista */
.vinyl-display {
    position: relative;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.6);
}

.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: 40px;
    height: 40px;
    background-color: #fce8d6;
    border-radius: 50%;
    border: 2px 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;
    flex-direction: column;
    align-items: stretch;
    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.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    position: relative;
    overflow: hidden;
    /* Importante para el pseudo-elemento */
}

.track-main-content {
    display: flex;
    align-items: center;
    width: 100%;
}

.track-vinyl-container {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-height 0.5s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.5s ease, margin-top 0.5s ease;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 100%;
}

.track-item.active .track-vinyl-container {
    max-height: 220px; /* Restaurado para el vinilo (200px) + márgenes */
    opacity: 1;
    margin-top: 15px;
    padding-bottom: 5px;
}

.visualizer-card {
    height: 72px;
    padding: 0;
    overflow: hidden;
    cursor: default;
    pointer-events: none;
    background: rgba(42, 42, 74, 0.4) !important; /* Fondo cristalino translúcido */
    border: 1px solid rgba(0, 123, 255, 0.2) !important; /* Borde neón sutil */
    box-shadow: 0 4px 15px rgba(0, 123, 255, 0.1) !important;
}

.visualizer-card::before {
    display: none !important; /* Ocultar fondo difuminado */
}

.visualizer-card .visualizer-canvas {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 12px;
    margin: 0;
    background: transparent;
    border: none;
    box-shadow: none;
}

/* 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:not(.visualizer-card):hover::before {
    opacity: 0.8;
}

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

.track-item:not(.visualizer-card):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;
}

/* --- TARJETA DE INTRODUCCIÓN DEL ÁLBUM --- */
.album-intro-card {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 20px;
    margin-bottom: 25px;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

.album-square-cover {
    width: 100%;
    aspect-ratio: 1 / 1;
    max-width: 320px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.5);
    margin-bottom: 15px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.intro-album-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.5s ease;
}

.intro-album-image:hover {
    transform: scale(1.05);
}

.album-intro-text {
    width: 100%;
    text-align: justify;
}

.album-intro-text p {
    font-size: 14px;
    line-height: 1.6;
    color: #c0c0d0;
    margin: 0;
    font-weight: 300;
}

/* --- CRÉDITOS DEL ÁLBUM --- */
.album-credits-card {
    background: rgba(13, 13, 30, 0.3);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.03);
    padding: 15px 20px;
    margin-top: 25px;
    margin-bottom: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.album-credits-card h4 {
    margin: 0 0 10px 0;
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #007bff;
}

.album-credits-card p {
    font-size: 12px;
    line-height: 1.6;
    color: #8c8ca0;
    margin: 0;
    font-weight: 300;
}