/* Reset y fuente */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Segoe UI", Roboto, Arial, sans-serif;
}

body {
  --color-principal: #23fa40;
  --color-fondo: linear-gradient(135deg, #23fa40, #031806, #23fa40);
  --color-texto: #fff;
  --color-container: rgba(30,30,30,0.85);
  --color-input: #2a2a2a;
  --color-border: #555;

  background: var(--color-fondo);
  background-size: 300% 300%;
  animation: gradientAnimation 15s ease infinite;
  color: var(--color-texto);
  text-align: center;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

/* Light mode */
body.light-mode {
  --color-principal: #23fa40;
  --color-fondo: linear-gradient(135deg, #23fa40, #ffffff, #23fa40);
  --color-texto: #000000;
  --color-container: rgba(255, 255, 255, 0.85);
  --color-input: #ffffff;
  --color-border: #555;
  
  background: var(--color-fondo);
  background-size: 300% 300%;
  animation: gradientAnimation 15s ease infinite;
  color: var(--color-texto);
  text-align: center;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

/* Animaciones */
@keyframes gradientAnimation {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes pulso {
  0% { box-shadow: 0 0 5px var(--color-principal); }
  50% { box-shadow: 0 0 20px var(--color-principal); }
  100% { box-shadow: 0 0 5px var(--color-principal); }
}

/* Encabezados */
h1 {
  font-size: 2.5rem;
  margin: 20px 0 10px;
  color: var(--color-principal);
  text-shadow: 0 0 10px var(--color-principal);
}

h2, h3 {
  margin: 15px 0;
  color: var(--color-texto);
}

/* Imagen decorativa */
img {
  filter: drop-shadow(0 0 8px rgba(255,255,255,0.4));
  margin-bottom: 15px;
  width: 250px;
}

/* Formulario */
.search {
  display: flex;
  justify-content: center;
  margin: 20px 0;
  gap: 10px;
}

.search input {
  padding: 10px 15px;
  font-size: 1rem;
  border: 1px solid var(--color-border);
  border-radius: 30px;
  outline: none;
  width: 250px;
  background: var(--color-input);
  color: var(--color-texto);
  transition: 0.3s;
}

.search input:focus {
  background: #333;
  animation: pulso 1.5s infinite;
}

.search button {
  padding: 10px 20px;
  font-size: 1rem;
  border: none;
  border-radius: 30px;
  background: var(--color-principal);
  color: #fff;
  cursor: pointer;
  transition: 0.3s;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.search button:hover {
  box-shadow: 0 0 15px var(--color-principal);
}

/* Secciones */
.section, .artist-section, .albums-grid, .tracks-section {
  margin-top: 25px;
}

/* Artista */
.artist-section {
  background: var(--color-container);
  padding: 30px;
  border-radius: 15px;
  box-shadow: 0 0 20px rgba(0,0,0,0.3);
}

.artist-section a {
  display: inline-block;
  margin-top: 5px;
  color: var(--color-principal);
  text-decoration: none;
}

.artist-section a:hover {
  text-decoration: underline;
}

/* Contenedor principal */
.container {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 100%;
  max-width: 1200px;
  margin: 20px;
}

/* Contenido principal */
.main-content {
  display: flex;
  width: 1000px;
  gap: 30px;
  margin-top: 30px;
  padding: 20px;
}

/* Álbumes */
.albums-grid {
  display: flex;

  grid-auto-rows: auto;
  gap: 100px;

  width: 100%;
  max-width: 700px; /* controla el ancho para que no se extienda o encoja */
  max-height: 50vh; /* altura máxima antes de scroll */
  overflow-y: auto;

  background: rgba(30, 30, 30, 0.85);
  border-radius: 15px;
  padding: 15px;
  box-shadow: 0 0 15px rgba(255, 255, 255, 0.1);
}

.album-card {
  background: rgba(40, 40, 40, 0.9);
  border-radius: 12px;
  padding: 15px;
  text-align: center;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
  cursor: pointer;
  transition: transform 0.25s, box-shadow 0.25s;
  color: #fff;
}

body.light-mode .album-card {
  background: #fff;
  color: #000;
}

.album-card:hover {
  transform: scale(1.08);
  box-shadow: 0 0 20px var(--color-principal);
}

.album-art {
  width: 200px;
  height: 200px; /* Fijamos una altura para las imágenes */
  border-radius: 10px;
  margin-bottom: 15px;
  object-fit: cover; /* Asegura que la imagen se ajuste correctamente */
}

.album-title {
  font-weight: bold;
  font-size: 1.2rem;
  margin-bottom: 5px;
  color: var(--color-principal);
}

.album-sub {
  font-size: 0.9rem;
  color: #bbb;
}

body.light-mode .album-sub {
  color: #ffffff;
}

/* Canciones */
.tracks-section {
  display: grid;
  width: 48%;
  max-height: 50vh;
  overflow-y: auto;
  background: var(--color-container);
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 0 15px rgba(0,0,0,0.3);
}

.tracks-section h3 {
  font-size: 1.8rem;
  margin-bottom: 10px;
  color: var(--color-principal);
}

.track-list {
  list-style-type: none;
  padding-left: 0;
  margin: 0;
  text-align: left;
}

.track-list li {
  font-size: 1.1rem;
  padding: 10px;
  margin: 10px 0;
  background-color: rgba(40,40,40,0.9);
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--color-texto);
  transition: background-color 0.3s ease, transform 0.2s ease;
  cursor: pointer;
}

body.light-mode .track-list li {
  background-color: #fff;
  border: 1px solid var(--color-border);
  color: #000;
}

.track-list li:hover {
  background-color: var(--color-principal);
  color: #fff;
  transform: scale(1.05);
}

.track-list li:active {
  background-color: #00ff2a;
  color: #000;
}

/* Botón de tema */
.main-content-theme {
  position: absolute;
  top: 20px;
  right: 20px;
}

.theme-grid {
  background: rgba(0, 0, 0, 0.9);
  border-radius: 12px;
  padding: 15px;
  text-align: center;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
  cursor: pointer;
  transition: transform 0.25s, box-shadow 0.25s, background 0.3s;
  color: var(--color-texto);
}

body.light-mode .theme-grid {
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 4px 15px rgba(150, 150, 150, 0.5);
}

/* Canciones y playlist */
.tracks-section { 
  display: grid; 
  width: 48%; 
  max-height: 50vh; 
  overflow-y: auto; 
  background: var(--color-container); 
  padding: 20px; 
  border-radius: 12px; 
  box-shadow: 0 0 15px rgba(0,0,0,0.3); 
}

.tracks-section h3 { font-size: 1.8rem; 
  margin-bottom: 10px; 
  color: var(--color-principal);
 }

.track-list { 
  list-style-type: none; 
  padding-left: 0; 
  margin: 0; 
  text-align: left; 
}

.track-list li {
  font-size: 1.1rem; 
  padding: 10px; 
  margin: 10px 0; 
  background-color: rgba(40,40,40,0.9);
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.1); 
  color: var(--color-texto); 
  transition: background-color 0.3s ease, transform 0.2s ease; 
  cursor: pointer;
}
body.light-mode .track-list li { 
  background-color: #fff; 
  border: 1px solid var(--color-border); 
  color: #000; 
}

.track-list li:hover {
   background-color: var(--color-principal); 
   color: #fff; transform: scale(1.05); 
  }

.track-list li:active { 
  background-color: #90cdff; 
  color: #000; 
}

/* Playlist debajo */
.playlist-fixed {
  width: 500px;
  margin-top: 40px;
  background: var(--color-container);
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 0 15px rgba(0,0,0,0.3);
}

.logout-container {
  position: absolute;
  top: 15px;
  left: 15px;
}

.logout-btn {
  background: #e63946; /* Rojo elegante */
  color: white;
  border: none;
  padding: 8px 14px;
  font-size: 14px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: background 0.3s ease;
}

.logout-btn:hover {
  background: #b71c1c;
}

#playlist li {
  transition: opacity 0.3s ease, transform 0.2s ease;
}

#playlist li:hover {
  transform: scale(1.03);
  cursor: pointer;
}

/* Playlist */
#playlist {
  list-style: none;
  padding-left: 0;
  margin: 20px 0;
}

.playlist-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  border-bottom: 1px solid #444;
  cursor: default;
  transition: background 0.2s ease;
}

.playlist-item:hover {
  background-color: rgba(255, 255, 255, 0.05);
}

.track-name {
  flex: 1;
  font-size: 1.1rem;
  color: var(--color-texto, #fff);
}

.remove-btn {
  background: none;
  border: none;
  color: #ff4d4d;
  cursor: pointer;
  font-size: 16px;
  padding: 0 6px;
  transition: color 0.2s ease;
}

.remove-btn:hover {
  color: #ff0000;
}

.track-buttons {
    display: flex;
    gap: 6px; /* espacio entre botones */
}

.track-buttons button {
    background: var(--color-principal, #fff);
    border: 1px solid var(--color-principal, #fff);
    border-radius: 50%;
    width: 28px;  /* más pequeño */
    height: 28px; /* más pequeño */
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px; /* ícono más proporcional */
}

.track-buttons button:hover {
    background: var(--color-fondo, #fff);
    color: white;
    transform: scale(1.1);
    border-color: var(--color-fondo, #fff);
}

/* Botón de reproducción aleatoria */
.auto-play-btn{
  margin: 8px 0 10px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--color-principal);
  background: transparent;
  color: var(--color-texto);
  cursor: pointer;
  font-weight: 600;
}

/* ¡NUEVO! -> Estilo al pasar el mouse por encima */
.auto-play-btn:hover {
  background: var(--color-principal);
  border-color: var(--color-principal); /* El borde también cambia */
  color: #031806; /* Color de texto oscuro para contraste (o #000) */
}

/* ¡NUEVO! -> Estilo al hacer clic ("más clarito") */
.auto-play-btn:active {
  background: #90cdff; /* Copiado de tu .track-list li:active */
  border-color: #90cdff; /* El borde también cambia */
  color: #000;
}

.auto-play-btn.playing{
  background: var(--color-principal);
  color: #000;
}
.youtube-player{ display:none; } /* visible solo al reproducir */

.youtube-player {
  margin-top: 15px;
  width: 100%;
  max-width: 500px;
  height: 280px;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

.lang-btn {
  background: none;
  border: none;
  color: white;
  font-weight: bold;
  margin-left: 10px;
  cursor: pointer;
  font-size: 1rem;
  transition: color 0.2s ease;
}
.lang-btn:hover {
  color: #ffd700;
}

/* Overlay perfil: diseño centrado y botones reactivos al color elegido */
#profile-overlay {
    --profile-color: #23fa40;
    --profile-contrast: #000;
}
#profile-overlay .profile-card {
    background: var(--color-input, #fff);
    color: var(--color-texto, #000);
    padding: 22px;
    border-radius: 12px;
    width: min(520px, 92%);
    box-shadow: 0 12px 40px rgba(0,0,0,0.35);
    text-align: left;
    transition: transform .18s ease, box-shadow .18s ease;
    transform-origin: center;
}
#profile-overlay .profile-card:focus-within,
#profile-overlay .profile-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 50px rgba(0,0,0,0.42);
}

/* Centrar labels/inputs y darles espacio */
#profile-overlay label small { display:block; margin-bottom:6px; color:var(--color-texto); }
#profile-overlay input[type="color"] {
    width:64px; height:40px; padding:0; border-radius:6px; border:1px solid #ccc;
    accent-color: var(--profile-color);
    cursor: pointer;
}

/* Acciones (botones) centradas */
#profile-overlay .profile-actions {
    display:flex;
    gap:12px;
    justify-content:center;
    align-items:center;
}

/* Botones adaptativos al color seleccionado (usa variables establecidas por JS) */
#profile-overlay .btn-save {
    background: var(--profile-color);
    color: var(--profile-contrast);
    border: none;
    padding: 8px 14px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: transform .12s ease, box-shadow .12s ease, filter .12s ease;
}
#profile-overlay .btn-save:hover { transform: translateY(-2px); filter: brightness(.95); box-shadow: 0 8px 20px rgba(0,0,0,0.12); }

/* Skip con borde del color seleccionado */
#profile-overlay .btn-skip {
    background: transparent;
    color: var(--profile-color);
    border: 1px solid var(--profile-color);
    padding: 8px 14px;
    border-radius: 8px;
    cursor: pointer;
    transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
}
#profile-overlay .btn-skip:hover {
    background: rgba(0,0,0,0.04);
    transform: translateY(-2px);
}

.points-float {
  position: absolute;
  top: 0;
  left: 50%;
  font-weight: 700;
  color: var(--points-blue, #3b82f6); /* azul */
  pointer-events: none;
  z-index: 10;
  text-shadow: 0 2px 6px rgba(0,0,0,0.35);
  animation: floatUpCenter 900ms ease-out forwards;
}
.money-float {
  position: absolute;
  top: 0;
  right: 0;
  font-weight: 700;
  pointer-events: none;
  z-index: 10;
  text-shadow: 0 2px 6px rgba(0,0,0,0.35);
  animation: floatUp 900ms ease-out forwards;
}
.money-float.pos { color: var(--money-green, #22c55e); } /* verde */
.money-float.neg { color: var(--money-red, #ef4444); }  /* rojo */

@keyframes floatUpCenter {
  0%   { opacity: 0; transform: translate(-50%, 0) scale(0.92); }
  12%  { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -32px) scale(1.06); }
}
@keyframes floatUp {
  0%   { opacity: 0; transform: translateY(0) scale(0.92); }
  12%  { opacity: 1; }
  100% { opacity: 0; transform: translateY(-28px) scale(1.06); }
}

/* Accesibilidad y reduce-motion */
@media (prefers-reduced-motion: reduce) {
    #profile-overlay .profile-card,
    #profile-overlay .btn-save,
    #profile-overlay .btn-skip {
        transition: none !important;
        transform: none !important;
    }
}


@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(15px); /* Optional: slight upward move */
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Apply fade-in to the main container of each page */
/* You might need to adjust the selector based on your HTML structure */
main.container {
  animation: fadeIn 0.6s ease-out forwards; /* Apply the animation */
  opacity: 0; /* Start hidden */
}
