/* Definición de la animación de brillo */
@keyframes pulse-shadow {
    0% {
        box-shadow: 0 0 10px rgba(52, 152, 219, 0.4); /* Sombra inicial suave */
    }
    50% {
        box-shadow: 0 0 20px rgba(52, 152, 219, 0.7); /* Sombra más intensa */
    }
    100% {
        box-shadow: 0 0 10px rgba(52, 152, 219, 0.4); /* Vuelve a la sombra suave */
    }
}

body {
    /* Fondo más oscuro para contraste (Dark Mode) */
    font-family: sans-serif;
    margin: 0;
    padding: 0;
    background-color: #1a1a2e; /* Gris muy oscuro o azul noche */
    color: #ecf0f1; /* Color de texto claro */
    line-height: 1.6;
}

header {
    background-color: #2c3e50;
    color: white;
    padding: 20px 0;
    text-align: center;
}

/* MODIFICACIÓN DE TAMAÑO DEL LOGO */
#header-logo {
    display: block; 
    margin: 0 auto 10px; 
    max-width: 180px; /* Tamaño aumentado */
    height: auto;
    border-radius: 5px; 
}

header h1 {
    margin-top: 0;
}

main {
    max-width: 1200px;
    margin: 20px auto;
    padding: 20px; 
    background-color: #2c3e50; /* Un tono oscuro para el contenedor principal */
    border-radius: 10px; 
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.5); /* Sombra suave para destacar */
}

/* * ESTILOS: BARRA DE BÚSQUEDA
 */
#search-container {
    padding: 10px 0 20px 0;
    text-align: center;
}

#search-input {
    width: 95%;
    max-width: 600px; /* Limita el ancho en escritorio */
    padding: 12px 20px;
    font-size: 1.1em;
    border: 2px solid #3498db; /* Borde azul llamativo */
    border-radius: 25px;
    background-color: #3c4b5d; /* Fondo oscuro */
    color: #ecf0f1; /* Texto claro */
    transition: border-color 0.3s, box-shadow 0.3s;
}

#search-input::placeholder {
    color: #bdc3c7; /* Color suave para el placeholder */
}

#search-input:focus {
    border-color: #f39c12; /* Borde naranja/dorado al hacer foco */
    box-shadow: 0 0 10px rgba(243, 156, 18, 0.5);
    outline: none;
}


section {
    padding: 20px 0;
    border-bottom: 1px solid #4a5a6d; /* Tono de línea ajustado al modo oscuro */
}

h2, h3 {
    color: #3498db; /* Mantener el azul principal */
    border-bottom: 2px solid #3c4b5d; /* Ligeramente más oscuro para la línea */
    padding-bottom: 10px;
}

hr {
    border: 0;
    border-top: 1px solid #4a5a6d;
    margin: 40px 0;
}

/* * PARTE MÚSICA
 */
#music-player {
    display: flex;
    flex-direction: column;
    align-items: center;
}

#player-container {
    background: #3c4b5d; /* Gris azulado más claro */
    border: 1px solid #4a5a6d;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
    width: 100%;
    max-width: 350px;
    text-align: center;
    /* ANIMACIÓN: Brillo pulsante cuando está reproduciendo */
    animation: pulse-shadow 2s infinite alternate;
}

#cover-art {
    width: 100%;
    max-width: 250px;
    height: auto;
    border-radius: 5px;
    margin-bottom: 15px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    aspect-ratio: 1 / 1; 
    object-fit: cover;
    border: 3px solid #3498db; 
}

#controls button {
    background: #3498db;
    color: white;
    border: none;
    padding: 10px 15px;
    margin: 5px;
    cursor: pointer;
    border-radius: 5px;
    font-size: 1.2em;
    transition: background 0.3s, transform 0.1s; 
}

#controls button:hover {
    background: #2980b9;
}

#controls button:active {
    transform: scale(0.95); /* Efecto "hundido" */
}

#progress-bar-container {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 15px;
}

#progress-bar {
    flex-grow: 1;
    cursor: pointer;
}

/* ESTILOS: CONTROL DE VOLUMEN
 */
#volume-control-container {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    max-width: 300px;
    margin: 15px auto 0;
    padding: 5px 0;
    border-top: 1px solid #4a5a6d;
}

#volume-slider {
    flex-grow: 1;
    cursor: pointer;
}

#music-playlist {
    list-style: none;
    padding: 0;
    width: 100%;
    max-width: 400px;
    margin-top: 20px;
    color: #ecf0f1; 
}

#music-playlist li {
    padding: 10px;
    margin-bottom: 5px;
    background: #3c4b5d; 
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.3s, box-shadow 0.2s; 
}

#music-playlist li:hover {
    background: #506173; 
    box-shadow: 0 0 8px #3498db; 
}

#music-playlist li.playing {
    /* Destacar la canción activa con una barra lateral */
    background: #3498db; 
    color: white;
    font-weight: bold;
    box-shadow: inset 5px 0 0 #f39c12; /* Barra lateral naranja/dorada */
    transform: scale(1.01); 
    transition: transform 0.2s, box-shadow 0.2s;
}

/* * PARTE VÍDEO
 */
#youtube-player-container {
    width: 100%;
    max-width: 800px;
    margin: 0 auto 20px;
    position: relative;
    padding-bottom: 56.25%; /* 16:9 Aspect Ratio */
    height: 0;
    overflow: hidden;
}

#youtube-player {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

#video-thumbnails {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
}

.video-item {
    cursor: pointer;
    width: 100%;
    max-width: 250px;
    background: #3c4b5d; 
    border: 1px solid #4a5a6d;
    border-radius: 5px;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    transition: transform 0.2s;
}

.video-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.4); 
}

.video-item img {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    display: block;
}

.video-item p {
    padding: 10px;
    margin: 0;
    font-size: 0.9em;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ESTILO PARA CENTRAR EL TEXTO DEL CANAL DE YOUTUBE */
.nota {
    text-align: center; 
    margin-top: 15px;
    padding-top: 10px;
}

footer {
    text-align: center;
    padding: 10px 0;
    background-color: #2c3e50;
    color: white;
    margin-top: 20px;
}

/* * RESPONSIVE (Ajustes para pantallas pequeñas)
 */
@media (max-width: 768px) {
    #music-player {
        flex-direction: column;
    }
    
    #player-container, #music-playlist {
        max-width: 100%;
    }
    
    #video-thumbnails {
        /* ⭐ CAMBIO: Centrar las miniaturas en vista móvil ⭐ */
        justify-content: center; 
    }

    .video-item {
        /* CAMBIO: Dar un max-width fijo para asegurar el centrado en filas de un solo elemento */
        max-width: 300px; 
        width: 90%;
    }
}

@media (max-width: 480px) {
    .video-item {
        max-width: 100%; 
    }
}