/* ==========================================================================
   SOY LA RUMBA RADIO — Official Stylesheet
   Luxury Dark Theme + Tropical Neon Vibrations
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700;800;900&family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  --bg-primary: #0a0114;
  --bg-secondary: #130324;
  --bg-glass: rgba(22, 6, 40, 0.75);
  --bg-card: rgba(255, 255, 255, 0.05);
  --bg-card-hover: rgba(255, 255, 255, 0.09);

  --color-gold: #f5b027;
  --color-pink: #ff2a74;
  --color-purple: #8b31ff;
  --color-cyan: #00e5ff;
  --color-live: #00ff88;

  --gradient-brand: linear-gradient(135deg, #f5b027 0%, #ff2a74 50%, #8b31ff 100%);
  --gradient-glow: radial-gradient(circle at center, rgba(255, 42, 116, 0.25) 0%, transparent 70%);

  --text-primary: #ffffff;
  --text-secondary: rgba(255, 255, 255, 0.7);
  --text-muted: rgba(255, 255, 255, 0.4);

  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(255, 42, 116, 0.35);

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --radius-full: 9999px;

  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 35px rgba(255, 42, 116, 0.3);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-primary);
  background-image: 
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(139, 49, 255, 0.3), transparent 70%),
    radial-gradient(circle at 10% 80%, rgba(255, 42, 116, 0.15), transparent 50%),
    radial-gradient(circle at 90% 90%, rgba(245, 176, 39, 0.1), transparent 50%);
  color: var(--text-primary);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* --- Loading Overlay --- */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-primary);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loading-overlay.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loading-spinner {
  width: 44px;
  height: 44px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--color-pink);
  border-right-color: var(--color-gold);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

.loading-text {
  font-family: 'Outfit', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 1px;
  color: var(--text-secondary);
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* --- App Shell & Container --- */
.app {
  width: 100%;
  max-width: 480px;
  min-height: 100vh;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  margin: 0 auto;
}

.app-container {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* --- Header --- */
.header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.header__logo {
  height: 36px;
  width: auto;
  object-fit: contain;
}

.header__live-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 14px;
  background: rgba(0, 255, 136, 0.12);
  border: 1px solid rgba(0, 255, 136, 0.3);
  border-radius: var(--radius-full);
  font-family: 'Outfit', sans-serif;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--color-live);
  letter-spacing: 1px;
  text-transform: uppercase;
}

.header__live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-live);
  box-shadow: 0 0 10px var(--color-live);
  animation: pulseLive 1.6s ease-in-out infinite;
}

@keyframes pulseLive {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

/* --- Error Banner (Fixed & Compact) --- */
.error-banner {
  display: none !important; /* Kept hidden in demo mode */
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 16px;
  background: rgba(255, 42, 116, 0.15);
  border: 1px solid rgba(255, 42, 116, 0.3);
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  font-size: 0.85rem;
  color: #ff9bbb;
}

.error-banner.is-visible {
  display: flex !important;
}

.error-banner__icon {
  width: 18px !important;
  height: 18px !important;
  flex-shrink: 0;
  fill: #ff2a74;
}

/* --- Album Art Section --- */
.album-art-section {
  position: relative;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 24px;
}

.album-art-bg {
  position: absolute;
  width: 240px;
  height: 240px;
  border-radius: 50%;
  background-size: cover;
  background-position: center;
  filter: blur(50px) saturate(1.8);
  opacity: 0.4;
  z-index: 0;
  transition: background-image 0.6s ease;
}

.album-art-container {
  position: relative;
  z-index: 1;
  width: min(280px, 75vw);
  aspect-ratio: 1;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg), 0 0 50px rgba(139, 49, 255, 0.25);
  border: 1px solid var(--border-glow);
  background: #110222;
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.album-art-container.is-playing {
  animation: pulseAlbum 4s ease-in-out infinite;
}

@keyframes pulseAlbum {
  0%, 100% { transform: scale(1); box-shadow: var(--shadow-lg), 0 0 45px rgba(255, 42, 116, 0.35); }
  50% { transform: scale(1.02); box-shadow: var(--shadow-lg), 0 0 70px rgba(245, 176, 39, 0.4); }
}

.album-art-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* --- Track Info --- */
.track-info {
  width: 100%;
  text-align: center;
  margin-bottom: 20px;
  padding: 0 10px;
}

.track-info__title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text-primary);
  margin-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.track-info__artist {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* --- Waveform Visualizer --- */
.waveform {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 4px;
  height: 32px;
  margin-bottom: 24px;
  width: 100%;
}

.waveform-bar {
  width: 4px;
  border-radius: 3px;
  background: var(--gradient-brand);
  height: 6px;
  transition: height 0.15s ease;
}

.waveform.is-playing .waveform-bar {
  animation: waveAnim 0.8s ease-in-out infinite alternate;
}

.waveform-bar:nth-child(2n) { animation-delay: 0.15s; }
.waveform-bar:nth-child(3n) { animation-delay: 0.3s; }
.waveform-bar:nth-child(4n) { animation-delay: 0.45s; }

@keyframes waveAnim {
  0% { height: 6px; }
  100% { height: 28px; }
}

/* --- Player Controls --- */
.player-controls {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 24px;
}

.play-btn {
  position: relative;
  width: 76px;
  height: 76px;
  border-radius: 50%;
  border: none;
  background: var(--gradient-brand);
  box-shadow: 0 6px 25px rgba(255, 42, 116, 0.45);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease;
  outline: none;
}

.play-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 10px 35px rgba(255, 42, 116, 0.6);
}

.play-btn:active {
  transform: scale(0.95);
}

.play-btn__icon {
  width: 32px;
  height: 32px;
  fill: #ffffff;
}

.play-btn__ring {
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 2px solid rgba(255, 42, 116, 0.35);
  opacity: 0;
  pointer-events: none;
}

.play-btn.is-playing .play-btn__ring {
  animation: playPulse 2s ease-out infinite;
}

@keyframes playPulse {
  0% { transform: scale(1); opacity: 0.8; }
  100% { transform: scale(1.45); opacity: 0; }
}

/* --- Volume Control --- */
.volume-control {
  width: 100%;
  max-width: 360px;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-card);
  padding: 10px 18px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
  backdrop-filter: blur(10px);
  margin-bottom: 20px;
}

.volume-control__icon-btn {
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  padding: 0;
}

.volume-control__icon {
  width: 20px;
  height: 20px;
  fill: var(--text-secondary);
  transition: fill 0.2s ease;
}

.volume-control__icon:hover {
  fill: #ffffff;
}

.volume-control__slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 5px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.15);
  outline: none;
  cursor: pointer;
}

.volume-control__slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--color-pink);
  box-shadow: 0 0 10px var(--color-pink);
  cursor: pointer;
  transition: transform 0.15s ease;
}

.volume-control__slider::-webkit-slider-thumb:hover {
  transform: scale(1.3);
}

/* --- Listeners Count --- */
.listeners {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 28px;
}

.listeners__icon {
  width: 16px;
  height: 16px;
  fill: var(--color-gold);
}

.listeners__count {
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

/* --- Song History Section --- */
.history-section {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 18px;
  backdrop-filter: blur(20px);
  margin-bottom: 24px;
}

.section-title {
  font-family: 'Outfit', sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  margin-bottom: 12px;
  text-transform: uppercase;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.history-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  transition: background 0.2s ease;
}

.history-item:hover {
  background: var(--bg-card-hover);
}

.history-item__art {
  width: 40px;
  height: 40px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
  background: #19052a;
}

.history-item__info {
  flex: 1;
  min-width: 0;
}

.history-item__title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-item__artist {
  font-size: 0.75rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-item__time {
  font-size: 0.7rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

/* --- Install PWA Banner --- */
.install-banner {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(140%);
  width: calc(100% - 32px);
  max-width: 440px;
  padding: 12px 18px;
  background: var(--bg-glass);
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-md);
  backdrop-filter: blur(25px);
  box-shadow: var(--shadow-glow);
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 1000;
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.install-banner.is-visible {
  transform: translateX(-50%) translateY(0);
}

.install-banner__text {
  flex: 1;
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.install-banner__text strong {
  color: var(--text-primary);
  display: block;
}

.install-banner__btn {
  padding: 6px 14px;
  border: none;
  border-radius: var(--radius-full);
  background: var(--gradient-brand);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.install-banner__btn:hover {
  transform: scale(1.05);
}

.install-banner__close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
}

/* --- Footer --- */
.footer {
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  padding-top: 12px;
}

.footer__brand {
  background: var(--gradient-brand);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 700;
}

/* --- Animations --- */
.fade-in {
  animation: fadeIn 0.6s ease forwards;
}

.slide-up {
  animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

/* ==========================================================================
   MODE SWITCHER TABS (Radio En Vivo vs Playlists a la Carta)
   ========================================================================== */
.mode-tabs {
  display: flex;
  gap: 8px;
  background: rgba(255, 255, 255, 0.04);
  padding: 6px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 20px;
  width: 100%;
  max-width: 440px;
}

.mode-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  background: transparent;
  border: none;
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s ease;
}

.mode-tab.is-active {
  background: var(--bg-card);
  color: #fff;
  border: 1px solid var(--border-glow);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4), inset 0 0 12px rgba(255, 107, 43, 0.15);
}

.mode-tab__pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ff2d55;
  box-shadow: 0 0 8px #ff2d55;
  animation: pulse-dot 1.5s infinite;
}

@keyframes pulse-dot {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.3); opacity: 1; box-shadow: 0 0 14px #ff2d55; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

/* ==========================================================================
   PROGRESS & SEEK BAR (For On-Demand Tracks)
   ========================================================================== */
.progress-container {
  display: none;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: 440px;
  margin: 12px 0 6px 0;
}

.progress-container.is-visible {
  display: flex;
}

.time-label {
  font-size: 0.75rem;
  font-family: monospace;
  color: var(--text-muted);
  min-width: 36px;
  text-align: center;
}

.progress-bar-wrap {
  flex: 1;
  position: relative;
  height: 20px;
  display: flex;
  align-items: center;
}

.seek-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.12);
  outline: none;
  cursor: pointer;
  position: relative;
  z-index: 2;
  transition: height 0.15s ease;
}

.seek-slider:hover {
  height: 8px;
}

.seek-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 10px var(--color-brand-primary);
  cursor: pointer;
  transition: transform 0.1s ease;
}

.seek-slider::-webkit-slider-thumb:hover {
  transform: scale(1.3);
}

.seek-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  border: none;
  box-shadow: 0 0 10px var(--color-brand-primary);
  cursor: pointer;
}

/* ==========================================================================
   MULTIMEDIA PLAYER CONTROLS (Shuffle, Prev, Play, Next, Repeat)
   ========================================================================== */
.player-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin: 16px 0;
  width: 100%;
}

.player-sub-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.player-sub-btn svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.player-sub-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  transform: scale(1.08);
}

.player-sub-btn:active {
  transform: scale(0.95);
}

.player-sub-btn.is-active {
  color: var(--color-brand-accent);
  border-color: var(--color-brand-accent);
  background: rgba(0, 240, 255, 0.12);
  box-shadow: 0 0 12px rgba(0, 240, 255, 0.3);
}

/* ==========================================================================
   ON-DEMAND PLAYLIST SECTION & TRACKLIST
   ========================================================================== */
.playlists-section {
  display: none;
  width: 100%;
  max-width: 500px;
  margin-top: 10px;
}

.playlists-section.is-visible {
  display: block;
}

.playlists-header {
  margin-bottom: 16px;
}

.genre-chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
  scrollbar-width: none;
}

.genre-chips::-webkit-scrollbar {
  display: none;
}

.genre-chip {
  padding: 8px 16px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.genre-chip:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.genre-chip.is-active {
  background: var(--gradient-brand);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 4px 14px rgba(255, 107, 43, 0.35);
}

.playlist-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  margin-bottom: 14px;
}

.playlist-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.playlist-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.playlist-play-all-btn {
  padding: 8px 16px;
  background: var(--gradient-accent);
  color: #0d0f14;
  font-size: 0.8rem;
  font-weight: 700;
  border: none;
  border-radius: var(--radius-full);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.playlist-play-all-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 0 16px rgba(0, 240, 255, 0.5);
}

/* Tracklist Rows */
.tracklist {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.track-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.track-row:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.18);
  transform: translateX(4px);
}

.track-row.is-playing {
  background: linear-gradient(90deg, rgba(255, 107, 43, 0.15), rgba(0, 240, 255, 0.08));
  border-color: var(--color-brand-accent);
  box-shadow: 0 4px 18px rgba(0, 240, 255, 0.15);
}

.track-number {
  font-family: monospace;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  width: 24px;
  text-align: center;
}

.track-row.is-playing .track-number {
  display: none;
}

.track-row-playing-icon {
  display: none;
  width: 24px;
  height: 18px;
  align-items: flex-end;
  justify-content: center;
  gap: 2px;
}

.track-row.is-playing .track-row-playing-icon {
  display: flex;
}

.track-mini-bar {
  width: 3px;
  height: 14px;
  background: var(--color-brand-accent);
  border-radius: 2px;
  animation: mini-eq 0.8s ease infinite alternate;
}

.track-mini-bar:nth-child(2) { animation-delay: 0.2s; height: 18px; }
.track-mini-bar:nth-child(3) { animation-delay: 0.4s; height: 10px; }

@keyframes mini-eq {
  0% { transform: scaleY(0.3); }
  100% { transform: scaleY(1); }
}

.track-art {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  flex-shrink: 0;
  background: rgba(0, 0, 0, 0.3);
}

.track-info-col {
  flex: 1;
  min-width: 0;
}

.track-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.track-row.is-playing .track-title {
  color: var(--color-brand-accent);
}

.track-artist {
  font-size: 0.78rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.track-duration {
  font-size: 0.78rem;
  font-family: monospace;
  color: var(--text-muted);
  flex-shrink: 0;
}

