/* ============================================= */
/* 1. VARIABLES GLOBALES Y CONFIGURACIONES BASE  */
/* ============================================= */

:root {
  /* ---------------------- */
  /* PALETA DE COLORES      */
  /* ---------------------- */
  --color-primary: #007887;
  --color-secondary: #121212;
  --color-tertiary: #cccccc; 
  --color-white: #ffffff;
  --color-black: #000000;
  --color-text: rgba(255, 255, 255, 0.85);
  --color-text-light: rgba(255, 255, 255, 0.5);
  --color-live: #ff0000;
  
  --primary: #E27147;

  /* ---------------------- */
  /* FONDOS Y SUPERFICIES   */
  /* ---------------------- */
  --bg-gradient: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
  --bg-glass: rgba(0, 0, 0, 0.1);
  --bg-glass-hover: rgba(0, 0, 0, 0.2);
  --bg-dark: rgba(0, 0, 0, 0.95);
  --bg-modal: rgba(18, 18, 18, 0.9);
  --bg-overlay: rgba(0, 0, 0, 0.4);
  --bg-live: rgba(255, 0, 0, 0.1);

  /* ---------------------- */
  /* SOMBRAS Y EFECTOS      */
  /* ---------------------- */
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.5);
  --shadow-md: 0 4px 15px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 6px 20px rgba(0, 0, 0, 0.15);
  --shadow-xl: 0 10px 25px rgba(0, 0, 0, 0.3);
  --blur-sm: blur(10px);
  --blur-md: blur(12px);
  --blur-lg: blur(15px);

  /* ---------------------- */
  /* TRANSICIONES Y ALERTA  */
  /* ---------------------- */
  --transition-fast: 0.2s;
  --transition-normal: 0.3s;
  --transition-slow: 0.5s;

  /* ---------------------- */
  /* ESPACIADOS Y TAMAÑOS   */
  /* ---------------------- */
  --spacing-xs: 8px;
  --spacing-sm: 12px;
  --spacing-md: 16px;
  --spacing-lg: 20px;
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 50px;
  --border-glass: 1px solid rgba(255, 255, 255, 0.2);
}

/* ============================================= */
/* 2. ESTRUCTURA BASE Y ESTILOS GLOBALES         */
/* ============================================= */

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Montserrat', sans-serif;
  background: var(--bg-gradient);
  height: 100vh;
  height: 100dvh; /* Evita saltos por barras dinámicas en móviles */
  overflow: hidden;
  color: var(--color-white);
}

body.index-page {
  overflow: hidden;
}

/* Contenedor principal elástico - Distribuye los bloques verticalmente */
.content-wrapper {
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between; 
  padding-bottom: 90px; /* Protege el espacio de la barra flotante */
}

/* Zona central corregida para favorecer la subida de los contenedores */
.main-content-centered {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-start; /* Empuja el contenido hacia arriba */
  align-items: center;
  min-height: 0;
  width: 100%;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: 100%;
}

/* ============================================= */
/* 3. UTILIDADES ACCESIBLES                      */
/* ============================================= */

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ============================================= */
/* 4. COMPONENTES REUTILIZABLES                  */
/* ============================================= */

.glass-button {
  padding: 10px 18px;
  border-radius: var(--radius-lg);
  background: var(--bg-glass);
  backdrop-filter: var(--blur-sm);
  color: var(--color-white);
  text-decoration: none;
  font-size: 1rem;
  font-weight: 600;
  text-transform: uppercase;
  cursor: pointer;
  transition: all var(--transition-normal) ease;
  box-shadow: var(--shadow-md);
  flex-shrink: 0;
  white-space: nowrap;
  border: var(--border-glass);
  font-family: 'Barlow Condensed', sans-serif;
}

.glass-button:hover,
.glass-button.active {
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(10px);
  transform: translateY(-1px);
}

.glass-button i {
  margin-right: 8px;
  font-size: 0.9em;
  width: 16px;
  text-align: center;
}

.glass-card {
  background: var(--bg-glass);
  backdrop-filter: var(--blur-sm);
  border-radius: var(--radius-md);
  border: var(--border-glass);
  box-shadow: var(--shadow-lg);
  transition: all var(--transition-normal) ease;
}

.glass-card:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
}

/* ============================================= */
/* 5. EFECTOS VISUALES Y MULTIMEDIA              */
/* ============================================= */

.artwork-background {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  filter: blur(25px) brightness(0.85);
  transform: scale(1.1);
  z-index: -2;
  transition: background-image var(--transition-slow) ease-in-out;
  animation: zoomBg 60s ease-in-out infinite;
  pointer-events: none;
}

body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: var(--bg-overlay);
  backdrop-filter: var(--blur-sm);
  z-index: -1;
}

.fondo-animado {
  animation: zoomBg 0.8s infinite alternate ease-in-out;
}

/* ============================================= */
/* 6. CABECERA - LOGO ADAPTABLE A LA PANTALLA    */
/* ============================================= */

.main-header {
  padding-top: var(--spacing-md);
  position: relative;
  z-index: 100;
  flex-shrink: 0;
}

.main-header .container {
  min-height: auto;
}

.logo-container {
  flex-shrink: 0;
}

.logo-img {
  height: auto;
  width: auto;
  max-height: 12vh; /* Escala basándose en el alto del dispositivo */
  max-width: 320px;
  aspect-ratio: 1200 / 629;
  user-select: none;
  filter: drop-shadow(var(--shadow-sm));
  transition: filter var(--transition-normal) ease;
}

.logo-img:hover {
  filter: drop-shadow(0 3px 5px rgba(0,0,0,0.35));
}

/* ============================================= */
/* 7. NOW PLAYING - COMPACTO Y ALINEADO ARRIBA   */
/* ============================================= */

.container-artwork {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start; /* Alinea los elementos al principio de la caja */
  margin: 25px auto 0 auto;
  padding: 0 1rem;
  width: 100%;
  max-width: 100vw;
  text-align: center;
  box-sizing: border-box;
  flex: 1;
  min-height: 0;
  transform: none !important;
}

/* El bloque contenedor que envuelve los identificadores dinámicos */
.now-playing-text {
  display: block !important;
  line-height: 1.2;
  font-family: 'Barlow Condensed', sans-serif;
  text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.6);
  margin-top: 5px; /* Ajuste milimétrico para pegarse al logo */
  margin-bottom: 0.4rem;
  letter-spacing: 0.5px;
  width: 100%;
}

#np_current_artist {
  display: block !important;
  font-size: clamp(1.2rem, 3vh, 1.8rem); /* Tipografía elástica fluida */
  font-weight: 700;
  margin-top: 0;
  margin-bottom: 2px;
  opacity: 0.95;
  text-shadow: 1px 1px 4px rgba(0, 0, 0, 0.7);
  text-transform: none !important;
  letter-spacing: 0.8px;
  color: var(--color-white);
}

#np_current_title {
  display: block !important;
  font-size: clamp(1rem, 2.5vh, 1.4rem);
  font-weight: 500;
  margin-top: 0;
  margin-bottom: 0.5rem;
  opacity: 0.85;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
  text-transform: none !important;
  letter-spacing: 0.75px;
  color: var(--color-text);
}

.np_track_artwork {
  background: var(--bg-glass);
  backdrop-filter: var(--blur-sm);
  padding: 6px;
  border-radius: var(--radius-md);
  border: var(--border-glass);
  box-shadow: var(--shadow-lg);
  margin-bottom: 0.5rem;
  transition: all var(--transition-normal) ease;
  max-height: 35vh; /* La carátula limita su crecimiento para dar aire en móviles */
  aspect-ratio: 1/1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.np_track_artwork:hover {
  background: rgba(255, 255, 255, 0.15);
}

.np_track_artwork img {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 250px;
  max-height: 100%;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: var(--border-glass);
  margin: 0 auto;
}

.fade-in {
  animation: fadeInUp 0.8s ease-out;
}

/* Optimización estricta de carátulas para pantallas muy bajas */
@media (max-height: 700px) {
  .np_track_artwork img {
    max-width: 180px;
  }
  #np_current_artist { font-size: 1.3rem; }
  #np_current_title { font-size: 1.1rem; }
}

/* ============================================= */
/* 8. REPRODUCTOR - UBICACIÓN ESTABLE Y DINÁMICA */
/* ============================================= */

.player-section {
  margin: 20px auto 0 auto; /* El margen automático empuja el bloque de reproducción al fondo */
  width: 100%;
  max-width: 1200px;
  padding: 0 20px;
  box-sizing: border-box;
  flex-shrink: 0;
  transform: none !important;
}

.player-container {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 0 auto;
}

.glass-player {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  gap: 20px;
  z-index: 10;
  color: var(--color-white);
  transition: all var(--transition-normal) ease;
  font-family: 'Barlow Condensed', sans-serif;
}

/* BOTÓN DE PLAY INTELIGENTE */
.player-button {
  background: rgba(255,255,255,0.18);
  border: var(--border-glass);
  border-radius: 50%;
  width: clamp(60px, 8vh, 85px); 
  height: clamp(60px, 8vh, 85px);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--transition-normal) ease, transform var(--transition-fast);
  box-shadow: 0 0 12px rgba(255,255,255,0.15);
  animation: playGlow 2.5s ease-in-out infinite;
}

.player-button svg {
  width: 40%;
  height: 40%;
  fill: var(--color-white);
}

.player-button:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.05);
}

.player-button.playing {
  animation: pulse 1.5s infinite;
  background: rgba(255,255,255,0.35);
  transform: scale(1.05);
  box-shadow: 0 0 18px rgba(255,255,255,0.35);
}

/* ============================================= */
/* 9. BARRA INFERIOR DE ACCIÓN - MENÚ PWA FIJO    */
/* ============================================= */

.bottom-action-bar {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 32px);
  max-width: 500px;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 60px;
  border: var(--border-glass);
  padding: 8px 16px;
  z-index: 100;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.bottom-nav-items {
  display: flex;
  justify-content: space-around;
  align-items: center;
  width: 100%;
  gap: 8px;
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: transparent;
  border: none;
  color: var(--color-text-light);
  cursor: pointer;
  transition: all var(--transition-normal) ease;
  padding: 6px 12px;
  border-radius: 50px;
  font-family: 'Montserrat', sans-serif;
  font-size: 0.75rem;
  font-weight: 500;
  text-decoration: none;
  flex: 1;
  min-width: 0;
}

.bottom-nav-item i {
  font-size: 20px;
  transition: transform var(--transition-normal) ease;
}

.bottom-nav-item span {
  font-size: 0.65rem;
  font-weight: 500;
  white-space: nowrap;
}

.bottom-nav-item:hover {
  color: var(--color-white);
  background: rgba(255, 255, 255, 0.15);
}

.bottom-nav-item.active {
  color: var(--primary);
  background: rgba(226, 113, 71, 0.25);
}

/* ============================================= */
/* 10. MODALES POPUPS, HISTORIAL Y COMPONENTES   */
/* ============================================= */

.popup-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(90vw, 500px);
  max-height: 80vh;
  background: var(--bg-modal);
  backdrop-filter: var(--blur-lg);
  border: var(--border-glass);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xl);
  z-index: 10000;
  color: var(--color-white);
  font-family: 'Barlow', sans-serif;
}

.popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: var(--bg-overlay);
  backdrop-filter: var(--blur-sm);
  z-index: 9999;
  display: none;
}

.popup-overlay.active {
  display: block;
}

.history-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--spacing-md);
  border-bottom: var(--border-glass);
  background: var(--bg-glass);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.history-head h3 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--color-white);
}

.history-head .x {
  background: var(--bg-glass-hover);
  border: var(--border-glass);
  border-radius: var(--radius-sm);
  color: var(--color-white);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-normal) ease;
}

.history-head .x:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.1);
}

#history-list {
  list-style: none;
  margin: 0;
  padding: var(--spacing-md);
  max-height: 60vh;
  overflow-y: auto;
  display: grid;
  gap: var(--spacing-sm);
}

#history-list li {
  display: grid;
  grid-template-columns: 60px 1fr;
  gap: var(--spacing-sm);
  align-items: center;
  padding: var(--spacing-sm);
  background: var(--bg-glass);
  border-radius: var(--radius-sm);
  border: var(--border-glass);
  transition: all var(--transition-normal) ease;
}

#history-list img.hcov {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: var(--border-glass);
}

#history-list .hmeta {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

#history-list .hmeta .artist {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--color-white);
}

#history-list .hmeta .song {
  font-size: 0.85rem;
  color: var(--color-text-light);
}

/* FORMULARIOS INTERNOS */
.contact-form {
  padding: var(--spacing-md);
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs);
}

.form-group input,
.form-group textarea {
  padding: var(--spacing-sm);
  background: var(--bg-glass);
  border: var(--border-glass);
  border-radius: var(--radius-sm);
  color: var(--color-white);
}

/* PROMPT DE INSTALACIÓN SISTEMA PWA */
.pwa-popup {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.pwa-popup.show {
  opacity: 1;
  visibility: visible;
}

.pwa-popup-content {
  background: var(--bg-modal);
  backdrop-filter: var(--blur-lg);
  border: var(--border-glass);
  border-radius: var(--radius-md);
  padding: var(--spacing-lg);
  max-width: 400px;
  width: 90%;
}

/* SISTEMA TOAST ALERTA DE ACTUALIZACIÓN PWA */
.update-toast {
  position: fixed;
  bottom: 80px;
  left: 20px;
  right: 20px;
  background: linear-gradient(135deg, #007887 0%, #005f6b 100%);
  color: white;
  padding: 16px 20px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
  z-index: 9999;
}

/* ============================================= */
/* 11. KEYFRAMES Y DECLARACIÓN DE ANIMACIONES    */
/* ============================================= */

@keyframes zoomBg {
  0% { transform: scale(1); }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

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

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.4); }
  70% { box-shadow: 0 0 0 12px rgba(255, 255, 255, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0); }
}

@keyframes playGlow {
  0% { box-shadow: 0 0 8px rgba(255,255,255,0.15); }
  50% { box-shadow: 0 0 16px rgba(255,255,255,0.35); }
  100% { box-shadow: 0 0 8px rgba(255,255,255,0.15); }
}