/*
 * style.css — Radio Argentina v2
 * Variables de tema + layout base. Los estilos del player están en player.css.
 */

/* ── Variables de tema ───────────────────────────────────────────────────── */

:root {
  --bg:         #111827;
  --surface:    #1f2937;
  --border:     #374151;
  --text:       #f9fafb;
  --muted:      #9ca3af;
  --accent:     #3b82f6;
  --green:      #22c55e;
  --red:        #ef4444;
  --playing-bg: #1e3a5f;
}

body.light {
  --bg:         #f3f4f6;
  --surface:    #ffffff;
  --border:     #d1d5db;
  --text:       #111827;
  --muted:      #6b7280;
  --accent:     #2563eb;
  --green:      #16a34a;
  --red:        #dc2626;
  --playing-bg: #dbeafe;
}

/* ── Reset / base ────────────────────────────────────────────────────────── */

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  min-height: 100vh;
  padding-bottom: 130px;
}

a { color: inherit; }

/* ── Header ──────────────────────────────────────────────────────────────── */

.site-header {
  background: linear-gradient(135deg, #1e3a5f 0%, #111827 70%);
  padding: 24px 20px 20px;
  text-align: center;
  border-bottom: 1px solid var(--border);
}
body.light .site-header {
  background: linear-gradient(135deg, #dbeafe 0%, #f3f4f6 70%);
}

.site-header h1 { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.site-header .sub { color: var(--muted); font-size: 13px; margin-bottom: 16px; line-height: 1.5; }

/* Station page header */
.site-header .site-brand { font-size: 18px; font-weight: 700; margin-bottom: 2px; }
.site-header .site-sub   { color: var(--muted); font-size: 12px; margin-bottom: 14px; }

.badges { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }

.badge {
  background: rgba(255,255,255,.08);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 12px;
  color: var(--muted);
  text-decoration: none;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.badge:hover { background: rgba(255,255,255,.14); color: var(--text); }
.badge-cafe  { border-color: #92400e; color: #fbbf24; }
.badge-cafe:hover { background: rgba(251,191,36,.12); color: #fde68a; }

body.light .badge { background: rgba(0,0,0,.06); color: #374151; }
body.light .badge:hover { background: rgba(0,0,0,.11); color: #111827; }
body.light .badge-cafe  { border-color: #b45309; color: #92400e; }
body.light .badge-cafe:hover { background: rgba(180,83,9,.10); color: #78350f; }

/* ── Buscador / filtros ──────────────────────────────────────────────────── */

.search-wrap {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

#buscador {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 15px;
  color: var(--text);
  outline: none;
}
#buscador:focus { border-color: var(--accent); }
#buscador::placeholder { color: var(--muted); }

.result-count { font-size: 12px; color: var(--muted); }

.filtros { display: none; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.filtros.visible { display: flex; }

.filter-btn {
  border: 1px solid var(--border);
  background: rgba(255,255,255,.05);
  color: var(--muted);
  border-radius: 20px;
  padding: 4px 11px;
  font-size: 12px;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}
.filter-btn:hover { background: rgba(255,255,255,.10); color: var(--text); }
.filter-btn.active             { background: rgba(59,130,246,.18); border-color: var(--accent); color: var(--text); }
.filter-btn.f-ok.active        { background: rgba(34,197,94,.15);  border-color: #22c55e; color: #86efac; }
.filter-btn.f-timeout.active   { background: rgba(245,158,11,.15); border-color: #f59e0b; color: #fcd34d; }
.filter-btn.f-muerto.active    { background: rgba(239,68,68,.15);  border-color: #ef4444; color: #fca5a5; }
.filter-btn.f-top.active       { background: rgba(251,191,36,.15); border-color: #fbbf24; color: #fde68a; }
.filter-btn.f-genre.active     { background: rgba(167,139,250,.15);border-color: #a78bfa; color: #ddd6fe; }
.filter-btn.f-cat              { border-style: dashed; }
.filter-btn.f-cat.has-genre    { border-color: #a78bfa; color: #ddd6fe; border-style: solid; }
.filter-btn.f-prov.active      { background: rgba(16,185,129,.15); border-color: #10b981; color: #6ee7b7; }
.filter-btn.f-provcat          { border-style: dashed; }
.filter-btn.f-provcat.has-prov { border-color: #10b981; color: #6ee7b7; border-style: solid; }

body.light .filter-btn              { background: rgba(0,0,0,.04); color: #374151; }
body.light .filter-btn:hover        { background: rgba(0,0,0,.09); color: #111827; }
body.light .filter-btn.active       { background: rgba(37,99,235,.12); color: #1e40af; }
body.light .filter-btn.f-ok.active  { background: rgba(22,163,74,.12);  border-color: #16a34a; color: #15803d; }
body.light .filter-btn.f-timeout.active { background: rgba(217,119,6,.12); border-color: #d97706; color: #b45309; }
body.light .filter-btn.f-muerto.active  { background: rgba(220,38,38,.12);  border-color: #dc2626; color: #b91c1c; }
body.light .filter-btn.f-top.active     { background: rgba(180,83,9,.12);   border-color: #d97706; color: #92400e; }
body.light .filter-btn.f-genre.active   { background: rgba(109,40,217,.12); border-color: #7c3aed; color: #5b21b6; }
body.light .filter-btn.f-cat.has-genre  { border-color: #7c3aed; color: #5b21b6; }
body.light .filter-btn.f-prov.active    { background: rgba(5,150,105,.12);  border-color: #059669; color: #065f46; }
body.light .filter-btn.f-provcat.has-prov { border-color: #059669; color: #065f46; }

#genre-panel, #province-panel {
  display: none;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 6px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255,255,255,.03);
}
#genre-panel.open, #province-panel.open { display: flex; }
body.light #genre-panel, body.light #province-panel { background: rgba(0,0,0,.03); }

/* ── Lista / cards ───────────────────────────────────────────────────────── */

.lista {
  max-width: 720px;
  margin: 0 auto;
  padding: 8px 12px;
}

.station {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.station:hover       { background: #2d3748; border-color: #4b5563; }
.station.rp-active   { background: var(--playing-bg); border-color: var(--accent); }
.station.rp-loading  { border-color: #f59e0b; }
.station.rp-error    { border-color: var(--red); }
.station.hidden      { display: none; }

body.light .station:hover { background: #e5e7eb; border-color: #9ca3af; }

.dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #374151; flex-shrink: 0; margin-top: 2px;
}
.dot-ok      { background: #22c55e; }
.dot-muerto  { background: #ef4444; }
.dot-timeout { background: #f59e0b; }

.station-num {
  font-size: 11px; color: var(--muted);
  min-width: 34px; text-align: right;
  font-variant-numeric: tabular-nums;
}
.station-logo {
  width: 36px; height: 36px; border-radius: 6px;
  object-fit: cover; flex-shrink: 0; background: var(--border);
}
.station-info { flex: 1; min-width: 0; }
.station-name {
  font-size: 14px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  display: flex; align-items: center; gap: 4px;
}
.station-pg-link {
  color: transparent; font-size: 11px; flex-shrink: 0;
  text-decoration: none; transition: color .15s; line-height: 1;
}
.station:hover .station-pg-link { color: var(--muted); }
.station-pg-link:hover { color: var(--text) !important; }

.station-prov {
  font-size: 12px; color: var(--muted); margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.station-tags { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 3px; }
.station-tag  {
  font-size: 10px; padding: 1px 5px; border-radius: 10px;
  background: rgba(167,139,250,.12); color: #a78bfa; white-space: nowrap;
}
body.light .station-tag { background: rgba(109,40,217,.10); color: #6d28d9; }

.station-icy-passive {
  font-size: 11px; color: var(--accent); font-weight: 500;
  margin-top: 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px;
}

.codec-badge {
  font-size: 10px; color: var(--muted); white-space: nowrap;
  align-self: flex-start; padding-top: 2px; flex-shrink: 0;
}
.icy-badge {
  font-size: 10px; color: #fff; font-weight: 600;
  padding: 2px 6px; border-radius: 10px; background: #7c3aed;
  white-space: nowrap; align-self: flex-start; flex-shrink: 0;
  cursor: default; letter-spacing: .3px;
}

.btn-play {
  width: 38px; height: 38px; border-radius: 50%;
  border: 2px solid var(--border); background: transparent;
  color: var(--muted); font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; cursor: pointer; transition: all .15s;
}
.station:hover .btn-play   { border-color: var(--accent); color: var(--accent); }
.station.rp-active .btn-play  { border-color: var(--green); color: var(--green); background: rgba(34,197,94,.1); }
.station.rp-loading .btn-play { border-color: #f59e0b; color: #f59e0b; }
.station.rp-error .btn-play   { border-color: var(--red); color: var(--red); }

/* ── Player bar (listado) ────────────────────────────────────────────────── */

#player-bar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: #0f172a;
  border-top: 1px solid var(--border);
  padding: 10px 16px 14px;
  display: none;
  flex-direction: column;
  gap: 8px;
  z-index: 100;
}
#player-bar.visible { display: flex; }
body.light #player-bar { background: #ffffff; border-top-color: #d1d5db; }

#player-title { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#player-prov  { font-size: 11px; color: var(--muted); }
#player-np    { font-size: 12px; color: var(--accent); font-weight: 600; min-height: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: calc(100vw - 120px); }

#btn-stop {
  position: absolute; right: 14px; top: 12px;
  background: transparent; border: none;
  color: var(--muted); font-size: 18px; cursor: pointer; padding: 4px;
}
#btn-stop:hover { color: var(--red); }

#listeners-badge { font-size: 11px; color: var(--green); }

#btn-vlc {
  font-size: 12px; color: #93c5fd; white-space: nowrap;
  text-decoration: none; padding: 4px 8px;
  border: 1px solid #374151; border-radius: 6px; display: none;
}
body.light #btn-vlc { color: #2563eb; border-color: #93c5fd; }

/* ── Share row ───────────────────────────────────────────────────────────── */

#share-row {
  display: none; gap: 8px; align-items: center; flex-wrap: wrap;
}
#share-row.visible { display: flex; }

.share-btn {
  background: rgba(255,255,255,.07);
  border: 1px solid var(--border);
  border-radius: 6px; color: var(--muted);
  font-size: 12px; padding: 5px 10px; cursor: pointer;
  white-space: nowrap; text-decoration: none;
  display: inline-flex; align-items: center; gap: 4px;
  transition: all .15s;
}
.share-btn:hover { background: rgba(255,255,255,.13); color: var(--text); border-color: #6b7280; }
#btn-copy.copied { border-color: var(--green); color: #86efac; }

body.light .share-btn { background: rgba(0,0,0,.05); color: #374151; }
body.light .share-btn:hover { background: rgba(0,0,0,.10); color: #111827; border-color: #9ca3af; }
body.light #btn-copy.copied { color: #15803d; border-color: #16a34a; }

/* ── QR modal ────────────────────────────────────────────────────────────── */

#qr-modal {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.65); z-index: 300;
  align-items: center; justify-content: center;
}
#qr-modal.visible { display: flex; }
#qr-box {
  background: #fff; border-radius: 12px;
  padding: 20px; text-align: center;
  max-width: 260px; width: 90%;
}
#qr-box img { width: 200px; height: 200px; display: block; margin: 0 auto 12px; }
#qr-name    { font-size: 14px; color: #111; font-weight: 600; margin-bottom: 4px; }
#qr-url     { font-size: 11px; color: #6b7280; word-break: break-all; margin-bottom: 12px; }
#qr-close   {
  background: #f3f4f6; border: none; border-radius: 6px;
  padding: 7px 18px; font-size: 13px; cursor: pointer; color: #374151;
}

/* ── Banner emisora compartida ───────────────────────────────────────────── */

#shared-banner {
  position: fixed; top: 0; left: 0; right: 0;
  background: var(--accent); color: #fff;
  text-align: center; padding: 10px 40px 10px 16px;
  font-size: 14px; z-index: 200;
  transition: opacity .6s ease;
}
#shared-banner.hide { opacity: 0; pointer-events: none; }
#shared-banner button {
  position: absolute; right: 10px; top: 50%;
  transform: translateY(-50%);
  background: none; border: none; color: rgba(255,255,255,.8);
  font-size: 15px; cursor: pointer; padding: 4px 6px;
}

/* ── Toast cafecito ──────────────────────────────────────────────────────── */

#support-toast {
  position: fixed; bottom: 140px; right: 16px;
  max-width: 260px; background: #1f2937ee;
  border: 1px solid #374151; border-left: 3px solid #fbbf24;
  border-radius: 8px; padding: 13px 40px 13px 17px;
  font-size: 14px; color: #d1d5db; line-height: 1.5; z-index: 200;
  opacity: 1; transition: opacity .6s ease;
}
#support-toast.hide { opacity: 0; pointer-events: none; }
#support-toast a    { color: #fbbf24; text-decoration: none; }
#support-toast a:hover { text-decoration: underline; }
#support-toast button {
  position: absolute; top: 6px; right: 8px;
  background: none; border: none; color: #6b7280;
  font-size: 13px; cursor: pointer; padding: 2px;
}
body.light #support-toast { background: #ffffffee; color: #374151; border-color: #d1d5db; }
body.light #support-toast button { color: #9ca3af; }
body.light #support-toast button:hover { color: #374151; }

/* ── Página de emisora individual ────────────────────────────────────────── */

.station-page {
  max-width: 600px; margin: 0 auto; padding: 32px 20px;
  text-align: center;
}
.station-page h1 { font-size: 22px; font-weight: 700; margin-bottom: 6px; }
.station-page .prov { font-size: 13px; color: var(--muted); margin-bottom: 12px; }
.station-page .tags { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; margin-bottom: 20px; }
.station-page .tag  { font-size: 11px; padding: 2px 8px; border-radius: 12px; background: rgba(167,139,250,.12); color: #a78bfa; }

.player-wrap {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 24px 20px; margin-bottom: 24px;
}

.info-row {
  display: flex; justify-content: space-between;
  font-size: 13px; padding: 6px 0;
  border-bottom: 1px solid var(--border);
}
.info-lbl { color: var(--muted); }
.info-val  { color: var(--text); font-weight: 500; }

.share-row-st { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin: 20px 0; }
.sbtn {
  background: rgba(255,255,255,.07); border: 1px solid var(--border);
  border-radius: 20px; padding: 6px 14px; font-size: 13px;
  color: var(--text); cursor: pointer; text-decoration: none;
  transition: background .15s;
}
.sbtn:hover { background: rgba(255,255,255,.13); }
.sbtn.copied { border-color: var(--green); color: #86efac; }

body.light .sbtn { background: rgba(0,0,0,.05); }
body.light .sbtn:hover { background: rgba(0,0,0,.10); }
body.light .sbtn.copied { color: #15803d; }

.rel-section { text-align: left; margin-top: 32px; }
.rel-section h2 { font-size: 14px; color: var(--muted); margin-bottom: 10px; }
.rel-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 0; border-bottom: 1px solid var(--border);
  text-decoration: none; color: var(--text);
  transition: color .15s;
}
.rel-item:hover { color: var(--accent); }
.rel-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--border); flex-shrink: 0; }
.rel-dot.ok { background: var(--green); }
.rel-icy { font-size: 10px; color: #fff; background: #7c3aed; border-radius: 8px; padding: 1px 5px; }

/* ── Estado / ahora suena (página individual) ────────────────────────────── */

.st-status { font-size: 13px; color: var(--muted); min-height: 18px; margin: 8px 0 4px; }
.st-np {
  font-size: 16px; font-weight: 700; color: var(--accent);
  min-height: 24px; margin: 10px 0 6px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis; max-width: 100%;
}
.np-dot {
  display: inline-block; flex-shrink: 0;
  width: 8px; height: 8px;
  background: var(--accent); border-radius: 50%;
  animation: np-pulse 1.5s ease-in-out infinite;
}
@keyframes np-pulse {
  0%, 100% { opacity: 1;   transform: scale(1); }
  50%       { opacity: .2; transform: scale(.5); }
}
.st-live   { color: var(--green); font-weight: 600; }
.st-listeners { font-size: 12px; color: var(--green); min-height: 16px; }

/* QR modal (página individual) */
#qr-modal-st {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.65); z-index: 300;
  align-items: center; justify-content: center;
}
#qr-modal-st.visible { display: flex; }
#qr-box-st { background: #fff; border-radius: 12px; padding: 20px; text-align: center; max-width: 260px; width: 90%; }
#qr-box-st img { width: 180px; height: 180px; display: block; margin: 0 auto 12px; }
#qr-box-st .qr-name { font-size: 14px; color: #111; font-weight: 600; margin-bottom: 4px; }
#qr-box-st .qr-url  { font-size: 11px; color: #6b7280; word-break: break-all; margin-bottom: 12px; }
#qr-close-st {
  background: #f3f4f6; border: none; border-radius: 6px;
  padding: 7px 18px; font-size: 13px; cursor: pointer; color: #374151;
}

/* ── Toast de bienvenida v2 ──────────────────────────────────────────────── */

.rp-welcome {
  position: fixed;
  bottom: 20px; right: 20px;
  width: 320px; max-width: calc(100vw - 32px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 8px 36px rgba(0,0,0,.5);
  padding: 20px;
  z-index: 9100;
  font-size: 14px; line-height: 1.5;
  transform: translateY(24px); opacity: 0;
  transition: transform .35s cubic-bezier(.22,.68,0,1.2), opacity .3s;
}
.rp-welcome--in  { transform: translateY(0); opacity: 1; }
.rp-welcome--out { transform: translateY(24px); opacity: 0; }

.rp-welcome-close {
  position: absolute; top: 10px; right: 12px;
  background: none; border: none;
  color: var(--muted); cursor: pointer;
  font-size: 17px; line-height: 1; padding: 4px;
}
.rp-welcome-close:hover { color: var(--text); }

.rp-welcome h3 {
  margin: 0 24px 10px 0;
  font-size: 16px; font-weight: 700;
  color: var(--accent);
}
.rp-welcome ul {
  margin: 0 0 10px; padding: 0;
  list-style: none; font-size: 13px;
}
.rp-welcome ul li { margin-bottom: 3px; }
.rp-welcome ul li::before { content: '✓ '; color: var(--accent); font-weight: 700; }

.rp-welcome-privacy {
  font-size: 11px; color: var(--muted);
  background: rgba(0,0,0,.12);
  border-radius: 7px; padding: 7px 9px;
  margin-bottom: 12px;
}
body.light .rp-welcome-privacy { background: rgba(0,0,0,.05); }

.rp-welcome-q {
  font-size: 13px; font-weight: 600;
  margin: 10px 0 6px;
}

.rp-welcome-btns {
  display: flex; gap: 6px; flex-wrap: wrap;
}
.rp-welcome-btns button {
  flex: 1; min-width: 0;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 12px; padding: 6px 4px;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
  white-space: nowrap;
}
.rp-welcome-btns button:hover { border-color: var(--accent); }
.rp-welcome-btns button.rp-sel {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.rp-welcome-cta {
  display: block; width: 100%;
  margin-top: 14px; padding: 10px;
  background: var(--accent);
  border: none; border-radius: 9px;
  color: #fff; font-size: 14px; font-weight: 700;
  cursor: pointer; text-align: center;
  transition: opacity .15s;
}
.rp-welcome-cta:hover { opacity: .85; }

.rp-welcome-footer {
  margin-top: 10px;
  font-size: 11px; color: var(--muted);
  text-align: center;
}

/* ── Footer ──────────────────────────────────────────────────────────────── */

.site-footer {
  text-align: center; font-size: 11px; color: var(--muted);
  padding: 20px 16px; border-top: 1px solid var(--border); margin-top: 20px;
}
.site-footer a { color: var(--muted); text-decoration: underline; }
