/* styles.css — Estética sobria de tarjetas, en la línea de paramioncologo. */
:root {
  --bg: #0f1419; --panel: #1a2129; --panel2: #222b35;
  --txt: #e8edf2; --muted: #9aa7b3; --line: #2c3742;
  --accent: #4f9cf9; --accent2: #18c29c; --warn: #f5a623;
  --radius: 14px;
  color-scheme: dark;
}
/* ── Tema claro (data-theme="light" en <html>) ── */
html[data-theme="light"] {
  --bg: #f5f7fa; --panel: #ffffff; --panel2: #eef1f5;
  --txt: #1a2129; --muted: #5d6b78; --line: #d7dee6;
  --accent: #2f7fe0; --accent2: #12a98a; --warn: #c47d10;
  color-scheme: light;
}
html[data-theme="light"] .top    { background: linear-gradient(160deg, #eef2f7, #e3e9f0); }
html[data-theme="light"] .hero   { background: linear-gradient(160deg, #eaf1f8, #f5f7fa); }
html[data-theme="light"] .player { background: #ffffffee; }
html[data-theme="light"] .st.new { background: #e2e8ef; color: #3a4750; }
/* Botón flotante de tema (web y panel) */
.theme-btn { position: fixed; top: 12px; right: 12px; z-index: 100; width: 40px; height: 40px;
  border-radius: 50%; border: 1px solid var(--line); background: var(--panel); color: var(--txt);
  font-size: 1.15rem; line-height: 1; cursor: pointer; box-shadow: 0 2px 10px rgba(0,0,0,.22); }
.theme-btn:hover { background: var(--panel2); }
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--txt);
  font: 16px/1.55 system-ui, -apple-system, Segoe UI, Roboto, sans-serif; }
.wrap { max-width: 820px; margin: 0 auto; padding: 0 18px; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.top { background: linear-gradient(160deg, #1b2530, #11161c); border-bottom: 1px solid var(--line); padding: 30px 0 22px; }
.top h1 { margin: 0; font-size: 1.7rem; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sub { margin: 6px 0 0; color: var(--muted); }
.chip { background: var(--accent); color: #04121f; font-size: .8rem; font-weight: 700;
  padding: 3px 10px; border-radius: 999px; text-transform: capitalize; }
.chip:empty { display: none; }

.filters { display: flex; gap: 8px; align-items: center; margin: 22px 0 14px; flex-wrap: wrap; }
.filters .f { background: var(--panel); color: var(--muted); border: 1px solid var(--line);
  padding: 7px 14px; border-radius: 999px; cursor: pointer; font-size: .9rem; }
.filters .f.active { background: var(--accent); color: #04121f; border-color: var(--accent); font-weight: 700; }
.admin-link { margin-left: auto; color: var(--muted); font-size: .9rem; }

.cards { display: grid; gap: 14px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.card.has-pod { border-color: #2b6; box-shadow: 0 0 0 1px rgba(24,194,156,.25) inset; }
.card .meta { display: flex; justify-content: space-between; gap: 10px; font-size: .78rem; color: var(--muted); }
.card .src { font-weight: 600; color: #c3cfd9; }
.card .title { margin: 6px 0 6px; font-size: 1.12rem; line-height: 1.35; }
.card .title a { color: var(--txt); }
.card .snip { margin: 0 0 12px; color: var(--muted); font-size: .92rem; }
.actions { display: flex; align-items: center; gap: 10px; }
.play { background: var(--accent2); color: #02110d; border: 0; border-radius: 10px;
  padding: 9px 16px; font-weight: 700; cursor: pointer; }
.play:hover { filter: brightness(1.08); }
.pending { color: var(--muted); font-size: .88rem; }

.empty { text-align: center; color: var(--muted); padding: 50px 10px; }
.pager { display: flex; gap: 12px; align-items: center; justify-content: center; margin: 26px 0 50px; }
.pager button { background: var(--panel2); color: var(--txt); border: 1px solid var(--line);
  border-radius: 9px; padding: 8px 14px; cursor: pointer; }
.pager button:disabled { opacity: .4; cursor: default; }
.pginfo { color: var(--muted); }

/* ── Web pública: hero del programa + parrilla de episodios ──────────────────── */
.hero { background: linear-gradient(160deg, #20303f, #0e1318); border-bottom: 1px solid var(--line); padding: 40px 0; }
.hero-in { display: flex; gap: 26px; align-items: flex-end; }
.hero-cover { width: 190px; height: 190px; border-radius: 16px; object-fit: cover; box-shadow: 0 18px 40px rgba(0,0,0,.5); flex-shrink: 0; }
.hero-cover.ph { display: flex; align-items: center; justify-content: center; font-size: 4rem; background: var(--panel2); }
.hero-info { min-width: 0; }
.kicker { font-size: .72rem; letter-spacing: .14em; color: var(--muted); font-weight: 700; }
.hero-info h1 { margin: 6px 0 10px; font-size: 2.6rem; line-height: 1.05; }
.hero-desc { margin: 0 0 8px; color: #c3cfd9; max-width: 60ch; }
.hero-meta { margin: 0; color: var(--muted); font-size: .9rem; }
.section-title { margin: 28px 0 16px; font-size: 1.25rem; }
.section-title .count { color: var(--muted); font-weight: 400; }

.eps { display: grid; gap: 12px; margin-bottom: 120px; }
.ep { display: flex; gap: 16px; align-items: center; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px 16px; transition: background .15s; }
.ep:hover { background: var(--panel2); }
.ep-cover { position: relative; width: 76px; height: 76px; border-radius: 10px; overflow: hidden; flex-shrink: 0;
  background: var(--panel2); display: flex; align-items: center; justify-content: center; font-size: 1.6rem; }
.ep-cover img { width: 100%; height: 100%; object-fit: cover; }
.ep-num { position: absolute; left: 4px; top: 2px; font-size: .7rem; font-weight: 700; color: #fff;
  text-shadow: 0 1px 3px #000; }
.ep-body { flex: 1; min-width: 0; }
.ep-title { margin: 0 0 4px; font-size: 1.08rem; }
.ep-meta { margin: 0 0 6px; color: var(--muted); font-size: .82rem; }
.ep-desc { margin: 0 0 6px; color: #c3cfd9; font-size: .92rem; }
.ep-arts { font-size: .85rem; color: var(--muted); }
.ep-arts summary { cursor: pointer; }
.ep-arts ul { margin: 8px 0 0; padding-left: 18px; }
.ep-play { width: 50px; height: 50px; border-radius: 50%; border: 0; flex-shrink: 0; cursor: pointer;
  background: var(--accent2); color: #02110d; font-size: 1.1rem; }
.ep-play:hover { filter: brightness(1.1); }

.player { position: fixed; bottom: 0; left: 0; width: 100%; background: #0c1116ee; backdrop-filter: blur(8px);
  border-top: 1px solid var(--line); padding: 10px 0; z-index: 50; }
.player-in { display: flex; align-items: center; gap: 12px; }
.pl-cover { width: 48px; height: 48px; border-radius: 8px; object-fit: cover; flex-shrink: 0; }
.pl-meta { min-width: 0; width: 180px; }
.pl-meta b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .92rem; }
.pl-meta small { color: var(--muted); }
.player audio { flex: 1; height: 38px; }
#pl-rate { background: var(--panel2); color: var(--txt); border: 1px solid var(--line); border-radius: 8px; padding: 6px; }
.pl-close { background: none; border: 0; color: var(--muted); font-size: 1.1rem; cursor: pointer; }
@media (max-width: 640px) {
  .hero-in { flex-direction: column; align-items: flex-start; }
  .hero-info h1 { font-size: 1.8rem; }
  .pl-meta { display: none; }
}

/* ── Panel: pestañas, paneles, formularios ───────────────────────────────────── */
.admin { padding-bottom: 60px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 18px 0 22px; flex-wrap: wrap; }
.tab { background: none; border: 0; border-bottom: 2px solid transparent; color: var(--muted);
  padding: 10px 14px; cursor: pointer; font-size: .95rem; }
.tab.active { color: var(--txt); border-bottom-color: var(--accent); font-weight: 700; }
.pane { display: none; }
.pane.active { display: block; }
.field { margin: 0 0 14px; }
.field label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: 5px; }
.field input, .field textarea, .field select { width: 100%; background: var(--panel); border: 1px solid var(--line);
  color: var(--txt); border-radius: 10px; padding: 10px 12px; font: inherit; }
.field textarea { resize: vertical; }
.form-actions { display: flex; align-items: center; gap: 14px; margin-top: 10px; }
.form-actions .note { margin: 0; }
.cover-row { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; }
.cover-preview, .cover-ph { width: 96px; height: 96px; border-radius: 12px; object-fit: cover; background: var(--panel2); }
.cover-ph { display: flex; align-items: center; justify-content: center; font-size: 2rem; }
.row .sel { width: 18px; height: 18px; flex-shrink: 0; }
.compose-bar { position: sticky; bottom: 0; display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: var(--panel2); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-top: 14px; }
.compose-bar input { flex: 1; min-width: 160px; background: var(--panel); border: 1px solid var(--line);
  color: var(--txt); border-radius: 10px; padding: 9px 12px; }

/* ── Panel admin ─────────────────────────────────────────────────────────── */
.admin-head { display: flex; justify-content: space-between; align-items: center; margin: 22px 0; }
.topicbar { display: flex; gap: 8px; margin: 16px 0 24px; }
.topicbar input { flex: 1; background: var(--panel); border: 1px solid var(--line); color: var(--txt);
  border-radius: 10px; padding: 11px 14px; font-size: 1rem; }
.btn { background: var(--accent); color: #04121f; border: 0; border-radius: 10px; padding: 11px 18px;
  font-weight: 700; cursor: pointer; }
.btn.alt { background: var(--panel2); color: var(--txt); border: 1px solid var(--line); }
.btn:disabled { opacity: .5; cursor: default; }
.note { color: var(--muted); font-size: .9rem; margin: 10px 0; min-height: 1.2em; }
.row { display: flex; gap: 10px; align-items: center; justify-content: space-between;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; }
.row .info { min-width: 0; }
.row .info b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .info small { color: var(--muted); }
.row .st { font-size: .8rem; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.st.new { background: #33404d; color: #c3cfd9; }
.st.requested { background: #4a3a14; color: var(--warn); }
.st.done { background: #14402f; color: var(--accent2); }
.login { max-width: 360px; margin: 80px auto; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 28px; }
.login input { width: 100%; background: var(--panel2); border: 1px solid var(--line); color: var(--txt);
  border-radius: 10px; padding: 11px 14px; font-size: 1rem; margin: 8px 0 14px; }
.login .err { color: #f56; font-size: .9rem; min-height: 1.2em; }

/* Editor de reparto (pestaña Guión) */
.cast-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.cast-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.cast-row .cn { flex: 1 1 130px; min-width: 110px; }
.cast-row .cg { width: 58px; }
.cast-row .cv { flex: 2 1 180px; }
.cast-row .cvp, .cast-row .cx { padding: 6px 10px; }
#gs-script { width: 100%; box-sizing: border-box; font-family: ui-monospace, Menlo, Consolas, monospace; line-height: 1.5; }

/* Búsquedas guardadas (pestaña Artículos) */
.saved-searches { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 10px 0; }
.saved-searches .ss-lbl { color: var(--muted, #9aa); font-size: .85rem; }
.ss-chip { display: inline-flex; align-items: center; background: var(--panel2); border: 1px solid var(--line);
  border-radius: 999px; overflow: hidden; }
.ss-chip.active { border-color: var(--accent, #5b9); }
.ss-chip .ss-go { background: none; border: 0; color: var(--txt); cursor: pointer; padding: 5px 10px; font-size: .88rem; }
.ss-chip.active .ss-go { font-weight: 600; }
.ss-chip .ss-go small { opacity: .55; }
.ss-chip .ss-del { background: none; border: 0; color: var(--muted, #9aa); cursor: pointer; padding: 5px 9px 5px 4px; font-size: .85rem; }
.ss-chip .ss-del:hover { color: #f56; }

/* Barra de generación de guión (pestaña Guión) */
.gen-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 12px 0 18px; }

/* Selector de música (marcas del guión) */
.music-picker { background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 8px;
  margin: 0 0 8px; max-height: 260px; overflow: auto; }
.mp-row { display: flex; align-items: center; gap: 10px; padding: 5px 4px; border-bottom: 1px solid var(--line); }
.mp-row b { flex: 1; font-weight: 400; font-size: .85rem; word-break: break-all; }
.mp-row audio { width: 200px; }
code { background: var(--panel2); padding: 1px 5px; border-radius: 4px; font-size: .82em; }

/* Página de ayuda (comandos del guión) */
.help { max-width: 760px; line-height: 1.55; }
.help h2 { font-size: 1.05rem; margin: 24px 0 8px; border-bottom: 1px solid var(--line); padding-bottom: 4px; }
.help pre { background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 12px;
  overflow-x: auto; font-size: .85rem; white-space: pre-wrap; }
.help-tbl { width: 100%; border-collapse: collapse; margin: 6px 0; }
.help-tbl th, .help-tbl td { text-align: left; vertical-align: top; padding: 7px 8px; border-bottom: 1px solid var(--line); font-size: .9rem; }
.help-tbl th { color: var(--muted, #9aa); font-weight: 600; }
.help-tbl td:first-child { white-space: nowrap; }
.help ul { padding-left: 20px; } .help li { margin: 4px 0; }

/* Panel "Pedir a Claude" */
.ask-box { margin-top: 22px; border-top: 1px dashed var(--line); padding-top: 16px; }
#ask-result { width: 100%; box-sizing: border-box; font-family: ui-monospace, Menlo, Consolas, monospace; line-height: 1.5; }

/* Línea de tiempo del mix (diseño antes de generar) */
.tl { position: relative; background: var(--panel2); border: 1px solid var(--line); border-radius: 10px;
  padding: 8px 10px 10px; margin-top: 12px; overflow: hidden; user-select: none; cursor: pointer; }
.tl-ruler { position: relative; height: 14px; margin-bottom: 4px; }
.tl-tick { position: absolute; transform: translateX(-2px); font-size: .65rem; color: var(--muted); }
.tl-tick::before { content: ''; position: absolute; left: 0; top: 12px; width: 1px; height: 6px; background: var(--line); }
.tl-lane { position: relative; margin-top: 6px; }
.tl-lane-name { font-size: .72rem; color: var(--muted); margin-bottom: 2px; }
.tl-lane-name small { opacity: .6; }
.tl-voices { position: relative; height: 32px; background: rgba(255,255,255,.03); border-radius: 5px; }
.tl-turn { position: absolute; top: 2px; height: 28px; border-radius: 4px; overflow: hidden; box-sizing: border-box;
  padding: 0 5px; display: flex; align-items: center; color: #05121d; font-size: .68rem; font-weight: 600; opacity: .92; }
.tl-turn span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-env { display: block; width: 100%; height: 34px; background: rgba(255,255,255,.03); border-radius: 5px; }
.tl-env polygon { fill: rgba(79,156,249,.35); stroke: var(--accent); stroke-width: .01; }
.tl-playhead { position: absolute; top: 0; bottom: 0; left: 0; width: 2px; background: #ff5577; pointer-events: none; z-index: 3; }

/* Mezclador multipista (tipo Audacity) */
.mix { margin-top: 12px; }
.mix-toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.mix-tracks { position: relative; background: var(--panel2); border: 1px solid var(--line); border-radius: 10px;
  padding: 8px 10px 12px; overflow-x: auto; overflow-y: hidden; user-select: none; }
.mix-canvas { position: relative; }
.mix-lane { position: relative; margin-top: 8px; }
.mix-lane-h { font-size: .72rem; color: var(--muted); margin-bottom: 3px; display: flex; align-items: center; gap: 6px; }
.mix-lane-h .mix-gain { width: 90px; }
.mix-del { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: .9rem; }
.mix-del:hover { color: #f56; }
.mix-clipzone { position: relative; height: 48px; background: rgba(255,255,255,.03); border-radius: 5px; }
.mix-wave { position: absolute; top: 0; height: 48px; border-radius: 5px; background: rgba(24,194,156,.1);
  border: 1px solid rgba(24,194,156,.4); box-sizing: border-box; }

/* Portada como banner ancho (web pública) */
.hero-banner { display: block; width: 100%; height: auto; border-radius: 14px;
  box-shadow: 0 18px 40px rgba(0,0,0,.45); }
.hero:has(.hero-banner:not([hidden])) { padding: 22px 0; }
