/* ════════════════════════════════════════════════════════════
   BUSCADOR DE RADIOS — UI operativa de prospección
   Estilo dark con toques neón coherentes con maqueta radio2.
   ════════════════════════════════════════════════════════════ */

:root {
  --bg-deep: #06060a;
  --bg-1: #0c0c12;
  --bg-2: #14141f;
  --bg-3: #1c1c2a;
  --bg-4: #262635;
  --line: rgba(255,255,255,0.06);
  --line-2: rgba(255,255,255,0.12);
  --pink: #ff2d55;
  --orange: #ff6b35;
  --cyan: #00d4ff;
  --purple: #9b5de5;
  --green: #00f5d4;
  --yellow: #fee440;
  --red: #ff4444;
  --text: #ffffff;
  --text-2: #c0c0cc;
  --muted: #6a6a78;
  --font: 'Outfit', system-ui, sans-serif;
  --mono: 'JetBrains Mono', monospace;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg-deep);
  color: var(--text);
  line-height: 1.5;
  font-size: 14px;
}
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: 0; }
input, select, textarea { font: inherit; color: inherit; }
a { color: var(--cyan); text-decoration: none; }
a:hover { color: var(--pink); }

/* TOPBAR */
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 1rem 1.5rem;
  background: linear-gradient(180deg, var(--bg-1), var(--bg-deep));
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(10px);
}
.topbar__brand { display: flex; align-items: center; gap: 0.9rem; }
.logo-icon {
  width: 44px; height: 44px; border-radius: 12px;
  background: linear-gradient(135deg, var(--pink), var(--orange));
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 1.1rem;
}
.topbar h1 {
  font-size: 1.2rem; font-weight: 700; letter-spacing: -0.01em;
}
.topbar h1 span {
  background: linear-gradient(135deg, var(--pink), var(--orange));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.topbar__sub {
  font-family: var(--mono);
  font-size: 0.7rem; color: var(--muted); letter-spacing: 0.05em;
  text-transform: uppercase;
}
.topbar__sub strong { color: var(--cyan); }
.link-out {
  font-family: var(--mono); font-size: 0.78rem;
  padding: 0.5rem 0.9rem; border: 1px solid var(--line-2);
  border-radius: 50px;
  letter-spacing: 0.05em;
}
.link-out:hover { border-color: var(--cyan); }

/* STATS */
.stats {
  display: grid; grid-template-columns: repeat(5, 1fr);
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--line);
}
.stat {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.85rem 1.1rem;
}
.stat__num {
  font-family: var(--mono); font-weight: 600;
  font-size: 1.6rem; line-height: 1;
  background: linear-gradient(135deg, var(--pink), var(--orange));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.stat__lbl {
  font-family: var(--mono); font-size: 0.7rem;
  color: var(--muted); letter-spacing: 0.1em;
  text-transform: uppercase; margin-top: 0.3rem;
}

/* FILTERS */
.filters {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--line);
  display: grid; gap: 0.75rem;
}
.search-wrap {
  display: flex; align-items: center; gap: 0.75rem;
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: 12px; padding: 0.4rem 0.8rem;
  transition: border-color 0.2s;
}
.search-wrap:focus-within { border-color: var(--pink); }
#qSearch {
  flex: 1; background: transparent; border: 0; padding: 0.55rem 0;
  outline: none; font-size: 0.95rem;
}
.search-count {
  font-family: var(--mono); font-size: 0.75rem; color: var(--muted);
  white-space: nowrap; letter-spacing: 0.05em;
}
.filter-row {
  display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: center;
}
.filter-row select {
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: 10px; padding: 0.55rem 0.9rem;
  outline: none;
}
.filter-row select:focus { border-color: var(--cyan); }
.chip {
  display: inline-flex; align-items: center; gap: 0.45rem;
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: 50px; padding: 0.45rem 0.9rem;
  font-size: 0.85rem; cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.chip:hover { border-color: var(--line-2); }
.chip input { accent-color: var(--pink); }

.actions-row { display: flex; gap: 0.6rem; flex-wrap: wrap; }
.btn {
  padding: 0.55rem 1rem; border-radius: 10px;
  font-weight: 500; font-size: 0.85rem;
  transition: all 0.15s;
}
.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.78rem; }
.btn-primary {
  background: linear-gradient(135deg, var(--pink), var(--orange));
  color: white; font-weight: 600;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 8px 24px rgba(255,45,85,0.3); }
.btn-ghost {
  background: var(--bg-2); border: 1px solid var(--line);
}
.btn-ghost:hover { border-color: var(--cyan); color: var(--cyan); }

/* TABLE */
.table-wrap {
  padding: 0 1.5rem 5rem;
}
.radios-tbl {
  width: 100%;
  border-collapse: separate; border-spacing: 0;
  margin-top: 1rem;
  font-size: 0.88rem;
}
.radios-tbl thead th {
  position: sticky; top: 0; z-index: 5;
  background: var(--bg-1);
  text-align: left;
  padding: 0.85rem 0.7rem;
  font-family: var(--mono); font-size: 0.7rem;
  font-weight: 600; letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--line-2);
  white-space: nowrap;
}
.radios-tbl thead th.sortable { cursor: pointer; user-select: none; }
.radios-tbl thead th.sortable:hover { color: var(--cyan); }
.radios-tbl thead th.sortable[data-dir="asc"]::after { content: " ↑"; color: var(--cyan); }
.radios-tbl thead th.sortable[data-dir="desc"]::after { content: " ↓"; color: var(--cyan); }
.radios-tbl tbody tr {
  border-bottom: 1px solid var(--line);
  transition: background 0.1s;
}
.radios-tbl tbody tr:hover { background: var(--bg-2); }
.radios-tbl tbody td {
  padding: 0.7rem;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.radios-tbl .col-pick { width: 32px; }

.r-name { font-weight: 600; }
.r-name small {
  display: block;
  font-family: var(--mono); font-size: 0.7rem;
  color: var(--muted); margin-top: 0.15rem; letter-spacing: 0.04em;
}
.r-freq { font-family: var(--mono); color: var(--cyan); white-space: nowrap; }
.r-band {
  font-family: var(--mono); font-size: 0.7rem;
  display: inline-block; padding: 0.15rem 0.45rem;
  border-radius: 4px; letter-spacing: 0.06em;
}
.r-band.fm { background: rgba(0,212,255,0.15); color: var(--cyan); }
.r-band.am { background: rgba(255,107,53,0.15); color: var(--orange); }

.r-yes { color: var(--green); }
.r-no  { color: var(--red); }
.r-unknown { color: var(--muted); font-family: var(--mono); }

.status-pill {
  display: inline-block;
  font-family: var(--mono); font-size: 0.72rem;
  padding: 0.2rem 0.55rem; border-radius: 4px;
  letter-spacing: 0.05em; text-transform: uppercase;
  font-weight: 600;
}
.status-pill.s-nuevo       { background: rgba(255,255,255,0.07); color: var(--text-2); }
.status-pill.s-sin_web     { background: rgba(255,228,68,0.15); color: var(--yellow); }
.status-pill.s-con_web     { background: rgba(0,212,255,0.15); color: var(--cyan); }
.status-pill.s-streaming   { background: rgba(0,245,212,0.12); color: var(--green); }
.status-pill.s-contactada  { background: rgba(155,93,229,0.18); color: var(--purple); }
.status-pill.s-vendida     { background: linear-gradient(135deg, rgba(255,45,85,0.25), rgba(255,107,53,0.25)); color: var(--pink); }
.status-pill.s-descartada  { background: rgba(255,255,255,0.04); color: var(--muted); text-decoration: line-through; }

.row-actions {
  display: flex; gap: 0.3rem;
}
.row-action {
  width: 28px; height: 28px;
  border-radius: 6px;
  background: var(--bg-3);
  border: 1px solid var(--line);
  font-size: 0.85rem;
  display: inline-flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
.row-action:hover { border-color: var(--pink); color: var(--pink); }

.pager {
  display: flex; justify-content: center; align-items: center; gap: 1rem;
  margin-top: 1rem;
  font-family: var(--mono); font-size: 0.8rem; color: var(--muted);
}

/* DRAWER */
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 480px; max-width: 100%;
  background: var(--bg-1);
  border-left: 1px solid var(--line-2);
  z-index: 100;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.22, 0.61, 0.36, 1);
  overflow-y: auto;
}
.drawer.is-open { transform: translateX(0); }
.drawer__inner { padding: 1.5rem; }
.drawer__close {
  position: absolute; top: 1rem; right: 1rem;
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--bg-3);
  font-size: 1.4rem; line-height: 1;
}
.drawer__close:hover { background: var(--pink); color: white; }

.drawer h2 {
  font-size: 1.5rem; font-weight: 700; letter-spacing: -0.01em;
  margin-bottom: 0.3rem; padding-right: 2.5rem;
}
.drw-sub {
  font-family: var(--mono); font-size: 0.78rem;
  color: var(--muted); letter-spacing: 0.06em;
  margin-bottom: 1.25rem;
}

.drw-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: 12px; padding: 1rem;
  margin-bottom: 1.25rem;
}
.drw-grid > div { display: flex; flex-direction: column; gap: 0.2rem; }
.drw-grid .drw-full { grid-column: span 2; }
.drw-lbl {
  font-family: var(--mono); font-size: 0.68rem;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--muted);
}
.drw-grid > div > span:not(.drw-lbl) {
  font-size: 0.92rem; font-weight: 500;
}

.drw-section { margin-bottom: 1rem; }
.drw-section input[type="url"],
.drw-section input[type="text"],
.drw-section select,
.drw-section textarea {
  width: 100%;
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: 10px; padding: 0.65rem 0.85rem;
  margin-top: 0.35rem; outline: none;
  font-size: 0.9rem;
  transition: border-color 0.15s;
}
.drw-section input:focus,
.drw-section select:focus,
.drw-section textarea:focus { border-color: var(--pink); }
.drw-section textarea { resize: vertical; min-height: 70px; font-family: var(--font); }

.drw-toggles { display: flex; gap: 0.6rem; flex-wrap: wrap; }
.drw-toggles label {
  display: inline-flex; align-items: center; gap: 0.45rem;
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: 50px; padding: 0.5rem 0.95rem;
  font-size: 0.85rem; cursor: pointer;
}
.drw-toggles input { accent-color: var(--green); }

.drw-pitch .pitch-box {
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: 10px; padding: 0.85rem;
  font-family: var(--mono); font-size: 0.78rem;
  color: var(--text-2); line-height: 1.55;
  white-space: pre-wrap;
  margin: 0.4rem 0 0.6rem;
  max-height: 200px; overflow: auto;
}

.drw-actions {
  display: flex; gap: 0.6rem;
  padding-top: 1rem; border-top: 1px solid var(--line);
}
.drw-actions .btn { flex: 1; }

/* TOAST */
.toast {
  position: fixed; bottom: 1.5rem; left: 50%; transform: translate(-50%, 100%);
  background: var(--bg-3); border: 1px solid var(--line-2);
  border-radius: 12px; padding: 0.8rem 1.4rem;
  font-size: 0.88rem; font-weight: 500;
  z-index: 200;
  opacity: 0;
  transition: transform 0.3s, opacity 0.3s;
  pointer-events: none;
}
.toast.is-show { transform: translate(-50%, 0); opacity: 1; }

@media (max-width: 900px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .topbar { padding: 0.85rem 1rem; flex-wrap: wrap; gap: 0.5rem; }
  .topbar h1 { font-size: 1rem; }
  .filters, .table-wrap { padding-inline: 0.75rem; }
  .radios-tbl { font-size: 0.78rem; }
  .radios-tbl thead th, .radios-tbl tbody td { padding: 0.5rem 0.4rem; }
  /* hide some columns on mobile */
  .radios-tbl th:nth-child(6), .radios-tbl td:nth-child(6) { display: none; }
  .radios-tbl th:nth-child(7), .radios-tbl td:nth-child(7) { display: none; }
  .drawer { width: 100%; }
}
