/* ============================================================
   Radio Colombia Live — Estilos principales
   Tema: Spotify + TuneIn  |  Colores: negro, gris, verde, blanco
   ============================================================ */

/* ─── Variables ─────────────────────────────────────────────── */
:root {
  --green:        #1DB954;
  --green-dark:   #158a3e;
  --green-light:  #1ed760;

  /* Oscuro (default) */
  --bg:           #0a0a0a;
  --surface:      #111111;
  --surface2:     #1a1a1a;
  --surface3:     #222222;
  --border:       #2a2a2a;
  --border-hover: #3a3a3a;
  --text:         #ffffff;
  --text-secondary: #aaaaaa;
  --text-muted:   #666666;

  --sidebar-w:    220px;
  --player-h:     72px;
  --header-h:     64px;
  --radius:       10px;
  --radius-pill:  24px;
  --transition:   all .18s ease;
}

/* ─── Modo claro ─────────────────────────────────────────────── */
body.light-mode {
  --bg:           #f5f5f5;
  --surface:      #ffffff;
  --surface2:     #f0f0f0;
  --surface3:     #e8e8e8;
  --border:       #dddddd;
  --border-hover: #cccccc;
  --text:         #111111;
  --text-secondary: #555555;
  --text-muted:   #999999;
}

/* ─── Reset & base ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: 1fr var(--player-h);
  height: 100vh;
  overflow: hidden;
  transition: background .3s, color .3s;
}

/* ─── Sidebar ────────────────────────────────────────────────── */
.sidebar {
  grid-row: 1;
  grid-column: 1;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 1rem 0;
  transition: var(--transition);
}
.sidebar::-webkit-scrollbar { width: 3px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 1rem 1.5rem;
  text-decoration: none;
  color: var(--text);
}
.logo-circle {
  width: 34px; height: 34px;
  background: var(--green);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.logo-text { font-size: 15px; font-weight: 400; }
.logo-text strong { color: var(--green); }

.nav-section-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  padding: 0 1rem;
  margin: 0.5rem 0 0.25rem;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 1rem;
  font-size: 13px;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: 8px;
  margin: 1px 0.5rem;
  transition: var(--transition);
}
.nav-link i { font-size: 18px; }
.nav-link:hover { background: var(--surface3); color: var(--text); }
.nav-link.active { background: var(--surface3); color: var(--green); }

.sidebar-footer { margin-top: auto; padding-top: 1rem; border-top: 1px solid var(--border); }

.theme-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 1rem;
  font-size: 13px;
  color: var(--text-secondary);
  background: none;
  border: none;
  cursor: pointer;
  width: 100%;
  border-radius: 8px;
  margin: 1px 0.5rem;
  transition: var(--transition);
  font-family: inherit;
}
.theme-toggle:hover { background: var(--surface3); color: var(--text); }

/* ─── Main wrapper ───────────────────────────────────────────── */
.main-wrapper {
  grid-row: 1;
  grid-column: 2;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ─── Header fijo ────────────────────────────────────────────── */
.top-header {
  height: var(--header-h);
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 1.5rem;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 20;
}

.hamburger {
  display: none;
  background: none;
  border: none;
  color: var(--text);
  font-size: 22px;
  cursor: pointer;
  padding: 4px;
}

/* Buscador */
.search-wrapper {
  position: relative;
  flex: 1;
  max-width: 420px;
}
.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 17px;
  pointer-events: none;
}
.search-input {
  width: 100%;
  background: var(--surface3);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 8px 16px 8px 38px;
  color: var(--text);
  font-size: 13px;
  outline: none;
  font-family: inherit;
  transition: var(--transition);
}
.search-input::placeholder { color: var(--text-muted); }
.search-input:focus { border-color: var(--green); background: var(--surface2); }

.search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0; right: 0;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-height: 300px;
  overflow-y: auto;
  z-index: 100;
  display: none;
  box-shadow: 0 8px 24px rgba(0,0,0,.4);
}
.search-results.visible { display: block; }
.search-result-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
  transition: var(--transition);
}
.search-result-item:hover { background: var(--surface3); }
.search-result-item:last-child { border-bottom: none; }

/* Pills departamentos */
.dept-pills {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  flex: 1;
  scrollbar-width: none;
}
.dept-pills::-webkit-scrollbar { display: none; }
.pill {
  background: var(--surface3);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition);
  font-family: inherit;
}
.pill:hover { border-color: var(--green); color: var(--text); }
.pill.active { background: var(--green); border-color: var(--green); color: #fff; }

.btn-icon {
  background: var(--surface3);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 18px;
  transition: var(--transition);
  flex-shrink: 0;
}
.btn-icon:hover { color: var(--text); border-color: var(--green); }

/* ─── Page content ───────────────────────────────────────────── */
.page-content {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.page-content::-webkit-scrollbar { width: 4px; }
.page-content::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* ─── Stats ─────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 2rem;
}
.stat-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
}
.stat-num { font-size: 22px; font-weight: 500; color: var(--green); }
.stat-lbl { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* ─── Sección headers ────────────────────────────────────────── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.section-title { font-size: 16px; font-weight: 500; }
.ver-todas { font-size: 12px; color: var(--green); text-decoration: none; }
.ver-todas:hover { text-decoration: underline; }

/* ─── Tarjetas de emisoras ───────────────────────────────────── */
.radio-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 2rem;
}
.radio-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}
.radio-card:hover { background: var(--surface3); border-color: var(--border-hover); transform: translateY(-2px); }
.radio-card.playing { border-color: var(--green); }
.radio-card:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }

.radio-logo {
  width: 56px; height: 56px;
  border-radius: 10px;
  background: var(--surface3);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 10px;
  font-size: 13px;
  font-weight: 700;
  color: var(--green);
  overflow: hidden;
}
.radio-logo img { width: 100%; height: 100%; object-fit: cover; }

.radio-name {
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.radio-city { font-size: 11px; color: var(--text-secondary); margin-bottom: 3px; }
.radio-freq { font-size: 11px; color: var(--green); font-weight: 500; }
.radio-type {
  position: absolute;
  top: 8px; right: 8px;
  font-size: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 6px;
  color: var(--text-muted);
}
.radio-card.playing .radio-type { background: var(--green); border-color: var(--green); color: #000; }

/* Indicador de reproducción animado */
.playing-indicator {
  display: flex; align-items: flex-end; gap: 2px;
  height: 14px; margin-top: 6px;
}
.playing-indicator span {
  width: 3px; background: var(--green);
  border-radius: 2px;
  animation: wave .8s ease-in-out infinite;
}
.playing-indicator span:nth-child(2) { animation-delay: .15s; }
.playing-indicator span:nth-child(3) { animation-delay: .30s; }
@keyframes wave {
  0%, 100% { height: 4px; }
  50%       { height: 14px; }
}

/* Status dot */
.status-dot {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #4CAF50;
  margin-right: 4px;
  vertical-align: middle;
}
.status-dot.offline { background: #666; }

/* ─── Géneros ────────────────────────────────────────────────── */
.genre-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 2rem;
}
.genre-pill {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 6px 14px;
  font-size: 12px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: var(--transition);
  font-family: inherit;
}
.genre-pill:hover { border-color: var(--green); color: var(--text); }
.genre-pill.active { background: var(--green); border-color: var(--green); color: #fff; }

/* ─── Grid departamentos ─────────────────────────────────────── */
.dept-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
  margin-bottom: 2rem;
}
.dept-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: var(--transition);
  text-decoration: none;
  color: var(--text);
}
.dept-card:hover { border-color: var(--green); }
.dept-icon {
  width: 32px; height: 32px;
  background: var(--surface3);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}
.dept-name { font-size: 12px; font-weight: 500; }
.dept-count { font-size: 11px; color: var(--text-muted); }

/* ─── Publicidad ─────────────────────────────────────────────── */
.ad-banner {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
}

/* ─── Reproductor ────────────────────────────────────────────── */
.player-bar {
  grid-row: 2;
  grid-column: 1 / -1;
  height: var(--player-h);
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  gap: 1.5rem;
  flex-shrink: 0;
}

.player-info {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 250px;
  flex-shrink: 0;
}
.player-logo {
  width: 46px; height: 46px;
  border-radius: 8px;
  background: var(--surface3);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  font-weight: 700;
  color: var(--green);
  flex-shrink: 0;
  overflow: hidden;
}
.player-logo img { width: 100%; height: 100%; object-fit: cover; }
.player-meta { min-width: 0; flex: 1; }
.player-name {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.player-sub { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.fav-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
  transition: var(--transition);
  padding: 4px;
}
.fav-btn:hover, .fav-btn.active { color: #E91E63; }

.player-controls {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.ctrl-buttons { display: flex; align-items: center; gap: 14px; }
.ctrl-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
  transition: var(--transition);
  padding: 4px;
}
.ctrl-btn:hover { color: var(--text); }
.play-btn {
  width: 38px; height: 38px;
  background: var(--green);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  color: #000;
  font-size: 18px;
}
.play-btn:hover { background: var(--green-light); transform: scale(1.06); }
.play-btn i { margin-left: 1px; }

.buffer-bar {
  width: 320px;
  height: 3px;
  background: var(--surface3);
  border-radius: 4px;
  overflow: hidden;
}
.buffer-fill {
  height: 100%;
  background: var(--green);
  width: 0%;
  border-radius: 4px;
  transition: width .3s;
}
.player-tags { display: flex; gap: 6px; align-items: center; height: 14px; }
.live-badge {
  background: #E53935;
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: .5px;
}
.quality-badge {
  font-size: 10px;
  color: var(--text-muted);
}

.player-right {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 200px;
  justify-content: flex-end;
  flex-shrink: 0;
}
.volume-row { display: flex; align-items: center; gap: 6px; }
.volume-row i { font-size: 16px; color: var(--text-muted); }
.volume-slider {
  width: 80px;
  accent-color: var(--green);
  cursor: pointer;
}

/* ─── Modal compartir ────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}
.modal-overlay[hidden] { display: none; }
.modal-box {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.5rem;
  width: 320px;
  position: relative;
}
.modal-close {
  position: absolute;
  top: 12px; right: 12px;
  background: none; border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
}
.modal-box h3 { font-size: 16px; font-weight: 500; margin-bottom: 1rem; }
.share-buttons { display: flex; flex-direction: column; gap: 8px; }
.share-btn {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  text-decoration: none;
  cursor: pointer;
  border: none;
  font-family: inherit;
  transition: var(--transition);
}
.share-btn.whatsapp { background: #25D366; color: #fff; }
.share-btn.facebook { background: #1877F2; color: #fff; }
.share-btn.telegram { background: #229ED9; color: #fff; }
.share-btn.copy     { background: var(--surface3); color: var(--text); border: 1px solid var(--border); }

/* ─── Sidebar overlay móvil ──────────────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  z-index: 50;
}

/* ─── Skeleton loader ────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--surface3) 25%, var(--surface2) 50%, var(--surface3) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--radius);
}
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.skeleton-card { height: 140px; }

/* ─── Responsive ─────────────────────────────────────────────── */
@media (max-width: 768px) {
  body {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: fixed;
    top: 0; left: 0;
    height: 100%;
    width: var(--sidebar-w);
    z-index: 60;
    transform: translateX(-100%);
    transition: transform .25s ease;
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay { display: block; }
  .main-wrapper { grid-column: 1; }
  .hamburger { display: flex; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .player-info { width: auto; flex: 1; }
  .player-right { display: none; }
  .buffer-bar { width: 200px; }
  .dept-pills { display: none; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .page-content { padding: 1rem; }
  .top-header { padding: 0 1rem; gap: 8px; }
  .radio-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ─── Animaciones de entrada ─────────────────────────────────── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
.radio-card { animation: fadeInUp .3s ease both; }
.radio-card:nth-child(1)  { animation-delay: .02s; }
.radio-card:nth-child(2)  { animation-delay: .04s; }
.radio-card:nth-child(3)  { animation-delay: .06s; }
.radio-card:nth-child(4)  { animation-delay: .08s; }
.radio-card:nth-child(5)  { animation-delay: .10s; }
.radio-card:nth-child(6)  { animation-delay: .12s; }
