/* RADIO MERCADO DON MANUEL — panel administrativo
   Tema oscuro "vidrio" sobre el video de fondo de la marca (escenas de Miércoles de Campo). */
:root {
  --verde: #1f9a4a; --verde-2: #27b35a; --verde-osc: #0c3a22; --verde-claro: rgba(39, 179, 90, .18);
  --ambar: #f7d117; --ambar-2: #ffb21a; --ambar-claro: rgba(247, 209, 23, .16);
  --rojo: #e2332a; --rojo-claro: rgba(226, 51, 42, .18); --azul: #5aa9ff; --azul-claro: rgba(90, 169, 255, .16);
  --tinta: #f6f2e8; --gris: #b9c2bc; --gris-2: #8d9891; --linea: rgba(255, 255, 255, .12);
  --vidrio: rgba(16, 24, 20, .62); --vidrio-2: rgba(255, 255, 255, .07); --vidrio-borde: rgba(255, 255, 255, .14);
  --radio: 18px; --sombra: 0 10px 40px rgba(0, 0, 0, .35);
  font-family: "Poppins", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  color: var(--tinta); background: #07120c; font-size: 15px;
}
* { box-sizing: border-box; }
html { background: #07120c; }
body { margin: 0; min-height: 100vh; overflow-x: hidden; background: transparent; }
a { color: var(--ambar); }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0 0 .4em; line-height: 1.2; }
h1 { font-size: 1.7rem; font-weight: 800; letter-spacing: -.01em; } h2 { font-size: 1.12rem; font-weight: 700; } h3 { font-size: 1rem; }
.muted { color: var(--gris); } .small { font-size: .86rem; } .mono { font-family: Consolas, "Cascadia Mono", monospace; font-size: .85rem; }
.hidden { display: none !important; }

/* ---------- Fondo animado (video de la marca) ---------- */
.bg { position: fixed; inset: 0; z-index: -2; overflow: hidden; background: #07120c url(/static/assets/fondo.jpg) center/cover no-repeat; }
.bg video { position: absolute; inset: -40px; width: calc(100% + 80px); height: calc(100% + 80px); object-fit: cover; filter: blur(3px) saturate(1.15); transform: scale(1.05); }
.bg::after { content: ""; position: absolute; inset: 0;
  background: radial-gradient(circle at 15% 10%, rgba(247, 209, 23, .10), transparent 40%),
              radial-gradient(circle at 90% 90%, rgba(31, 154, 74, .18), transparent 45%),
              linear-gradient(180deg, rgba(5, 12, 8, .55), rgba(5, 12, 8, .78)); }
.bg.light video { filter: blur(0) saturate(1.1); }
.bg.light::after { background: linear-gradient(180deg, rgba(5, 12, 8, .25), rgba(5, 12, 8, .65)); }
@media (prefers-reduced-motion: reduce) { .bg video { display: none; } }

/* ---------- Estructura ---------- */
.layout { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.layout > * { min-width: 0; }
.sidebar { background: rgba(6, 22, 13, .72); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); border-right: 1px solid var(--vidrio-borde);
  color: #fff; padding: 18px 12px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; flex-direction: column; gap: 8px; align-items: stretch; padding: 4px 6px 18px; }
.logo-chip { background: #fbf7ec; border-radius: 14px; padding: 8px 10px; box-shadow: 0 6px 20px rgba(0, 0, 0, .35); display: flex; justify-content: center; }
.logo-chip img { width: 100%; max-width: 190px; height: auto; display: block; }
.brand b { display: block; font-size: .74rem; letter-spacing: .18em; text-align: center; color: var(--ambar); }
.nav a { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 12px; color: #dfe9e3; text-decoration: none; font-weight: 500; transition: background .2s, transform .15s; }
.nav a:hover { background: rgba(255, 255, 255, .08); transform: translateX(2px); }
.nav a.active { background: linear-gradient(90deg, var(--ambar), var(--ambar-2)); color: #1a1400; font-weight: 700; box-shadow: 0 6px 18px rgba(247, 209, 23, .25); }
.nav svg { width: 19px; height: 19px; flex: none; }
.sidebar .foot { margin-top: auto; font-size: .78rem; color: var(--gris); padding: 8px; }
.main { padding: 26px 30px 70px; max-width: 1400px; width: 100%; animation: entrar .35s ease; }
@keyframes entrar { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.topbar { display: flex; align-items: center; gap: 14px; justify-content: space-between; margin-bottom: 20px; flex-wrap: wrap; }
.topbar h1 { text-shadow: 0 2px 16px rgba(0, 0, 0, .5); }
.topbar .right { display: flex; gap: 10px; align-items: center; background: var(--vidrio); border: 1px solid var(--vidrio-borde); padding: 8px 12px; border-radius: 99px; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }

/* ---------- Tarjetas de vidrio ---------- */
.grid { display: grid; gap: 18px; }
.grid > * { min-width: 0; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } .g5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.card, .ctrl-group { background: var(--vidrio); border: 1px solid var(--vidrio-borde); border-radius: var(--radio); padding: 18px 20px; box-shadow: var(--sombra);
  backdrop-filter: blur(16px) saturate(1.2); -webkit-backdrop-filter: blur(16px) saturate(1.2); transition: transform .2s, border-color .2s; }
.card:hover { border-color: rgba(247, 209, 23, .35); }
.card h2 { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ctrl-group p { margin: .2em 0 .8em; color: var(--gris); font-size: .88rem; }
.section-gap { margin-top: 22px; }
h2.section-gap { text-shadow: 0 2px 12px rgba(0, 0, 0, .6); }

/* Indicadores grandes */
.stat { position: relative; overflow: hidden; }
.stat .ico { position: absolute; right: 14px; top: 12px; font-size: 1.9rem; opacity: .9; }
.stat .num { font-size: 2.1rem; font-weight: 800; line-height: 1.1; margin-top: 6px; }
.stat .lbl { color: var(--gris); font-size: .85rem; }
.stat.s-verde { background: linear-gradient(135deg, rgba(31, 154, 74, .55), rgba(12, 58, 34, .7)); }
.stat.s-ambar { background: linear-gradient(135deg, rgba(247, 209, 23, .42), rgba(120, 80, 0, .55)); }
.stat.s-rojo { background: linear-gradient(135deg, rgba(226, 51, 42, .48), rgba(90, 15, 10, .6)); }
.stat.s-azul { background: linear-gradient(135deg, rgba(90, 169, 255, .4), rgba(20, 40, 90, .6)); }

/* Al aire */
.onair { position: relative; overflow: hidden; border: 1px solid rgba(247, 209, 23, .45);
  background: linear-gradient(135deg, rgba(20, 60, 35, .82), rgba(10, 20, 14, .78)); }
.onair::before { content: ""; position: absolute; inset: -40%; background: conic-gradient(from 0deg, transparent, rgba(247, 209, 23, .14), transparent 30%);
  animation: girar 9s linear infinite; pointer-events: none; }
@keyframes girar { to { transform: rotate(360deg); } }
.onair > * { position: relative; }
.onair .title { font-size: 1.45rem; font-weight: 800; margin: 6px 0; }
.eq { display: inline-flex; align-items: flex-end; gap: 4px; height: 28px; margin-right: 10px; vertical-align: middle; }
.eq i { width: 5px; border-radius: 3px; background: linear-gradient(var(--ambar), var(--verde-2)); animation: eq 1s ease-in-out infinite; }
.eq i:nth-child(1) { animation-delay: -.2s; } .eq i:nth-child(2) { animation-delay: -.5s; } .eq i:nth-child(3) { animation-delay: -.1s; }
.eq i:nth-child(4) { animation-delay: -.7s; } .eq i:nth-child(5) { animation-delay: -.35s; }
@keyframes eq { 0%, 100% { height: 20%; } 50% { height: 100%; } }
.eq.off i { animation: none; height: 20%; opacity: .4; }
.progress { height: 10px; background: rgba(255, 255, 255, .12); border-radius: 99px; overflow: hidden; margin-top: 12px; }
.progress > div { height: 100%; background: linear-gradient(90deg, var(--verde-2), var(--ambar)); box-shadow: 0 0 12px rgba(247, 209, 23, .6); transition: width .5s linear; }
.dots { display: flex; gap: 6px; margin-top: 8px; }
.dots span { width: 22px; height: 8px; border-radius: 99px; background: rgba(255, 255, 255, .15); }
.dots span.on { background: var(--ambar); box-shadow: 0 0 10px rgba(247, 209, 23, .6); }

/* ---------- Chips ---------- */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: 99px; font-size: .8rem; font-weight: 600; white-space: nowrap; background: rgba(255, 255, 255, .1); color: #e8ede9; }
.chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .9; }
.chip.ok { background: var(--verde-claro); color: #6fe39a; }
.chip.warn { background: var(--ambar-claro); color: var(--ambar); }
.chip.err { background: var(--rojo-claro); color: #ff8a83; }
.chip.info { background: var(--azul-claro); color: #9fcaff; }
.chip.off { background: rgba(255, 255, 255, .08); color: var(--gris-2); }
.chip.live { background: var(--rojo); color: #fff; box-shadow: 0 0 14px rgba(226, 51, 42, .6); }
.chip.live::before { animation: pulse 1.2s infinite; background: #fff; }
@keyframes pulse { 50% { opacity: .2; } }

/* ---------- Botones ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--vidrio-borde); background: rgba(255, 255, 255, .08); padding: 9px 16px; border-radius: 12px;
  cursor: pointer; font-weight: 600; text-decoration: none; color: var(--tinta); transition: transform .12s, background .2s, box-shadow .2s; }
.btn:hover { background: rgba(255, 255, 255, .16); transform: translateY(-1px); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn.primary { background: linear-gradient(135deg, var(--verde-2), var(--verde)); border-color: transparent; color: #fff; box-shadow: 0 6px 18px rgba(31, 154, 74, .35); }
.btn.primary:hover { box-shadow: 0 8px 24px rgba(31, 154, 74, .5); }
.btn.amber { background: linear-gradient(135deg, var(--ambar), var(--ambar-2)); border-color: transparent; color: #1a1400; }
.btn.danger { background: linear-gradient(135deg, #ff4a3d, var(--rojo)); border-color: transparent; color: #fff; box-shadow: 0 6px 18px rgba(226, 51, 42, .35); }
.btn.ghost-danger { color: #ff8a83; border-color: rgba(226, 51, 42, .45); }
.btn.sm { padding: 6px 11px; font-size: .84rem; border-radius: 10px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
label.btn { position: relative; }

/* ---------- Formularios ---------- */
label.f { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: .88rem; }
label.f span.hint { font-weight: 400; color: var(--gris); font-size: .8rem; }
input[type=text], input[type=password], input[type=number], input[type=email], input[type=date], input[type=datetime-local], input[type=time], select, textarea {
  border: 1px solid var(--vidrio-borde); border-radius: 12px; padding: 10px 12px; background: rgba(0, 0, 0, .3); color: var(--tinta); min-width: 0; color-scheme: dark; }
select option { background: #10201a; color: var(--tinta); }
input::placeholder { color: var(--gris-2); }
input:focus, select:focus, textarea:focus, .btn:focus-visible { outline: 3px solid rgba(247, 209, 23, .55); outline-offset: 1px; }
input[type=checkbox], input[type=radio] { accent-color: var(--ambar); width: 18px; height: 18px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; align-items: end; }
.check { display: inline-flex; gap: 8px; align-items: center; font-weight: 500; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--vidrio-borde); border-radius: 14px; overflow: hidden; background: rgba(0, 0, 0, .3); }
.stepper button { border: 0; background: var(--verde-claro); width: 46px; height: 46px; font-size: 1.35rem; cursor: pointer; color: #6fe39a; font-weight: 800; }
.stepper button:hover { background: rgba(39, 179, 90, .35); }
.stepper output { width: 62px; text-align: center; font-weight: 800; font-size: 1.4rem; color: var(--ambar); }

/* ---------- Tablas ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th { text-align: left; font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--gris-2); padding: 8px 10px; border-bottom: 1px solid var(--linea); white-space: nowrap; }
td { padding: 10px; border-bottom: 1px solid rgba(255, 255, 255, .06); vertical-align: middle; }
tbody tr { transition: background .15s; }
tbody tr:hover { background: rgba(255, 255, 255, .04); }
tr.dragging { opacity: .4; }
tr.drop-target td { border-top: 3px solid var(--ambar); }
.handle { cursor: grab; color: var(--gris-2); font-size: 1.1rem; user-select: none; padding: 0 4px; }
.thumb { width: 96px; height: 54px; object-fit: cover; border-radius: 8px; background: #1b2a22; display: block; box-shadow: 0 4px 12px rgba(0, 0, 0, .4); }

/* ---------- Alertas ---------- */
.alert { padding: 11px 15px; border-radius: 12px; margin-bottom: 10px; border: 1px solid; font-size: .92rem; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.alert.error { background: rgba(120, 20, 15, .55); border-color: rgba(255, 120, 110, .4); color: #ffd6d2; }
.alert.warn { background: rgba(110, 85, 0, .5); border-color: rgba(247, 209, 23, .4); color: #fff1b0; }
.alert.info { background: rgba(20, 50, 95, .5); border-color: rgba(90, 169, 255, .35); color: #d6e8ff; }
.alert.ok { background: rgba(15, 80, 40, .55); border-color: rgba(39, 179, 90, .4); color: #c8f5d8; }

/* ---------- Sedes ---------- */
.site-card { display: flex; flex-direction: column; gap: 7px; }
.site-card .name { font-weight: 800; font-size: 1.05rem; }
.site-card .tv { font-size: 1.6rem; }
.linkbox { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; background: rgba(0, 0, 0, .3); border: 1px dashed rgba(247, 209, 23, .35); border-radius: 12px; padding: 8px 10px; }
.linkbox code { min-width: 0; flex: 1 1 100%; white-space: normal; word-break: break-all; font-size: .82rem; color: var(--ambar); }

/* ---------- Calendario ---------- */
.week { display: grid; grid-template-columns: 52px repeat(7, 1fr); gap: 4px; }
.week .col { position: relative; height: 336px; background: repeating-linear-gradient(rgba(255,255,255,.04) 0 13px, rgba(255,255,255,.08) 13px 14px); border: 1px solid var(--linea); border-radius: 8px; }
.week .hours { position: relative; height: 336px; font-size: .7rem; color: var(--gris); }
.week .hours span { position: absolute; right: 4px; transform: translateY(-50%); }
.week .block { position: absolute; left: 3px; right: 3px; background: linear-gradient(180deg, var(--verde-2), var(--verde)); color: #fff; border-radius: 6px; font-size: .7rem; padding: 2px 4px; overflow: hidden; box-shadow: 0 4px 10px rgba(0,0,0,.3); }
.week .now { position: absolute; left: 0; right: 0; height: 2px; background: var(--ambar); box-shadow: 0 0 8px var(--ambar); }
.week .dname { text-align: center; font-weight: 700; font-size: .82rem; padding-bottom: 4px; }

/* ---------- Modal y avisos ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(0, 0, 0, .6); backdrop-filter: blur(4px); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; z-index: 50; overflow-y: auto; }
.modal { background: rgba(14, 26, 19, .96); border: 1px solid var(--vidrio-borde); border-radius: 20px; width: min(640px, 100%); padding: 22px 24px; box-shadow: 0 20px 60px rgba(0, 0, 0, .6); animation: entrar .25s ease; }
.modal.wide { width: min(1000px, 100%); }
.modal .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.toast-zone { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 60; }
.toast { background: rgba(14, 26, 19, .95); border: 1px solid rgba(39, 179, 90, .5); color: #fff; padding: 12px 18px; border-radius: 14px; box-shadow: var(--sombra); max-width: 420px; animation: entrar .25s ease; }
.toast.err { border-color: rgba(226, 51, 42, .7); background: rgba(70, 12, 10, .95); }

/* ---------- Pestañas ---------- */
.tabs { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.tabs button { border: 1px solid var(--vidrio-borde); background: var(--vidrio); padding: 8px 14px; cursor: pointer; font-weight: 600; color: var(--gris); border-radius: 99px; backdrop-filter: blur(10px); }
.tabs button.active { color: #1a1400; background: linear-gradient(90deg, var(--ambar), var(--ambar-2)); border-color: transparent; }

/* ---------- Ingreso ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login .card { width: min(420px, 100%); padding: 30px 28px; background: rgba(10, 22, 15, .7); }
.login .logo-chip { margin: 0 auto 18px; max-width: 260px; padding: 12px 16px; }
.login .logo-chip img { width: 100%; max-width: 230px; }
.login h1 { text-align: center; font-size: 1.5rem; }
.login .onair-tag { text-align: center; margin-bottom: 14px; }
.upload-progress { height: 10px; background: rgba(255, 255, 255, .12); border-radius: 99px; overflow: hidden; }
.upload-progress div { height: 100%; width: 0; background: linear-gradient(90deg, var(--ambar), var(--verde-2)); transition: width .2s; }

@media (max-width: 1100px) { .g5 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .g3, .g4 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 820px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: sticky; top: 0; z-index: 20; height: auto; flex-direction: row; align-items: center; gap: 8px; padding: 8px 10px; border-right: 0; border-bottom: 1px solid var(--vidrio-borde); }
  .sidebar .foot, .brand b { display: none; }
  .brand { padding: 0; flex: none; }
  .logo-chip { padding: 4px 6px; border-radius: 10px; }
  .logo-chip img { width: 64px; }
  .nav { display: flex; gap: 4px; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; flex: 1; min-width: 0; }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { flex: none; padding: 8px 12px; font-size: .9rem; white-space: nowrap; }
  .g2, .g3, .g5 { grid-template-columns: 1fr; }
  .g4 { grid-template-columns: 1fr 1fr; }
  .main { padding: 16px 12px 60px; }
  .topbar { flex-direction: column; align-items: flex-start; gap: 8px; }
  .topbar .right { flex-wrap: wrap; border-radius: 16px; }
  .card { padding: 15px; }
  .form-grid { grid-template-columns: 1fr; }
  td, th { padding: 8px 6px; }
  .thumb { width: 72px; height: 40px; }
  .modal-bg { padding: 2vh 8px; }
  .week .col, .week .hours { height: 240px; }
  .stat .num { font-size: 1.7rem; }
}
