/* Equital OTT — base visual compartida: tipografía, colores, botones, formularios e insignias.
   Los colores de marca son provisorios: ajustar --brand con el manual de marca de Equital. */
@font-face {
  font-family: "Inter";
  src: url("/static/vendor/fonts/inter-latin-var.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --brand: #1f7aff;
  --brand-hover: #3d8dff;
  --brand-soft: rgba(31, 122, 255, 0.14);

  --bg: #07080b;
  --surface: #0f1116;
  --surface-2: #161920;
  --surface-3: #1f232c;
  --line: rgba(255, 255, 255, 0.07);
  --line-2: rgba(255, 255, 255, 0.13);
  --text: #f4f5f7;
  --text-2: #a5aab5;
  --text-3: #868c98;  /* 4,7:1 o más sobre todos los fondos (WCAG AA para texto chico) */
  --live: #ff3b30;
  --ok: #30d158;
  --warn: #ffb020;
  --danger: #ff453a;

  --r-s: 8px;
  --r: 12px;
  --r-l: 16px;
  --shadow: 0 24px 60px -24px rgba(0, 0, 0, 0.9);
  --gutter: clamp(16px, 3vw, 40px);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--font);
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
[hidden] { display: none !important; }
a { color: inherit; text-decoration: none; }
button { padding: 0; border: 0; background: none; color: inherit; font: inherit; cursor: pointer; }
img { display: block; max-width: 100%; }
h1, h2, h3, p, ol, ul, dl, dd { margin: 0; }
code, .mono { font-family: var(--mono); font-size: 0.92em; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
::selection { background: rgba(31, 122, 255, 0.35); }
* { scrollbar-width: thin; scrollbar-color: var(--surface-3) transparent; }

.i {
  flex: none;
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---------- botones ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 38px;
  padding: 0 16px;
  border-radius: var(--r-s);
  background: var(--surface-3);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}
.btn:hover { background: #292e39; }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn .i { width: 18px; height: 18px; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-hover); }
.btn-outline { background: transparent; box-shadow: inset 0 0 0 1px var(--line-2); }
.btn-outline:hover { background: var(--surface-2); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-danger { color: var(--danger); }
.btn-danger:hover { background: rgba(255, 69, 58, 0.12); color: var(--danger); }
.btn-sm { height: 32px; padding: 0 12px; border-radius: 7px; font-size: 13px; }
.btn-lg { height: 48px; padding: 0 22px; border-radius: 10px; font-size: 15px; }
.btn-block { width: 100%; }

/* ---------- formularios ---------- */
.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.field > span { color: var(--text-2); font-size: 13px; font-weight: 600; }
.field > .reveal-wrap { color: inherit; font-size: inherit; font-weight: inherit; }
.input,
.field input:not([type="checkbox"]):not([type="file"]),
.field select,
.field textarea {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-s);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.field textarea { height: auto; padding: 11px 14px; resize: vertical; }
.input::placeholder, .field input::placeholder, .field textarea::placeholder { color: var(--text-3); }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(31, 122, 255, 0.22);
}
input[type="file"] { min-width: 0; color: var(--text-2); font-size: 13px; }
input[type="file"]::file-selector-button {
  height: 32px;
  margin-right: 10px;
  padding: 0 12px;
  border: 0;
  border-radius: 7px;
  background: var(--surface-3);
  color: var(--text);
  font: 600 13px var(--font);
  cursor: pointer;
}
.hint { color: var(--text-3); font-size: 12.5px; line-height: 1.55; }
.hint code { color: var(--text-2); }
.form-error { min-height: 1.4em; color: var(--danger); font-size: 13.5px; }
.check { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 500; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--brand); }

/* ---------- insignias y estados ---------- */
.badge-live, .badge-off {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 22px;
  padding: 0 8px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}
.badge-live { background: var(--live); color: #fff; }
.badge-live::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #fff; animation: pulse 1.6s ease-in-out infinite; }
.badge-off { background: rgba(255, 255, 255, 0.1); color: var(--text-2); }
@keyframes pulse { 50% { opacity: 0.25; } }
@keyframes spin { to { transform: rotate(360deg); } }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.live { color: var(--ok); background: rgba(48, 209, 88, 0.12); }
.pill.live::before { animation: pulse 1.6s ease-in-out infinite; }
.pill.ok { color: var(--ok); background: rgba(48, 209, 88, 0.1); }
.pill.warn { color: var(--warn); background: rgba(255, 176, 32, 0.12); }
.pill.danger { color: var(--danger); background: rgba(255, 69, 58, 0.12); }
.pill.muted { color: var(--text-3); background: rgba(255, 255, 255, 0.06); }
.tag {
  display: inline-flex;
  align-items: center;
  height: 18px;
  padding: 0 6px;
  border-radius: 4px;
  background: var(--brand-soft);
  color: var(--brand-hover);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  vertical-align: 1px;
}
.tag.muted { background: rgba(255, 255, 255, 0.07); color: var(--text-3); }

/* ---------- logos de canal ---------- */
.logo-tile {
  flex: none;
  display: grid;
  place-items: center;
  width: 64px;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border-radius: var(--r-s);
  background: #171b23;
  box-shadow: inset 0 0 0 1px var(--line);
}
.logo-tile img { width: 100%; height: 100%; padding: 6%; object-fit: contain; }
.logo-tile.text span {
  display: -webkit-box;
  overflow: hidden;
  padding: 0 6px;
  color: var(--text-2);
  font-size: 10px;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: 0.02em;
  text-align: center;
  text-transform: uppercase;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.logo-tile.sm { width: 48px; border-radius: 6px; }
.logo-tile.lg { width: 96px; border-radius: 10px; }
.logo-tile.lg.text span { font-size: 13px; }
.logo-tile.xl { width: 150px; border-radius: 14px; }
.logo-tile.xl.text span { font-size: 16px; }

.avatar {
  flex: none;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1f7aff, #00b3d6);
  color: #fff;
  font-size: 12.5px;
  font-weight: 700;
}

/* ---------- diálogos y avisos ---------- */
dialog {
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  padding: 0;
  border: 1px solid var(--line-2);
  border-radius: var(--r-l);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}
dialog::backdrop { background: rgba(0, 0, 0, 0.72); backdrop-filter: blur(4px); }
dialog > form { display: flex; flex-direction: column; max-height: calc(100vh - 34px); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.dialog-head h2 { font-size: 17px; font-weight: 700; letter-spacing: -0.01em; }
.dialog-body { display: grid; gap: 18px; padding: 22px; overflow: auto; }
.dialog-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 22px; border-top: 1px solid var(--line); }

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 100;
  max-width: calc(100vw - 32px);
  padding: 12px 18px;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  background: var(--surface-3);
  box-shadow: var(--shadow);
  font-size: 14px;
  font-weight: 600;
  opacity: 0;
  transform: translate(-50%, 16px);
  transition: opacity 0.2s, transform 0.2s var(--ease);
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { border-color: rgba(255, 69, 58, 0.6); color: #ffd7d4; }
.toast.warn { max-width: min(640px, calc(100vw - 32px)); border-color: rgba(255, 176, 32, 0.6); color: #ffe3ad; font-weight: 500; line-height: 1.45; }

.empty { grid-column: 1 / -1; padding: 48px 16px; color: var(--text-3); text-align: center; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Ojito para ver la contraseña (lo agrega common.js a cada campo de contraseña). */
.reveal-wrap { position: relative; display: block; }
.reveal-wrap > input:not([type="checkbox"]):not([type="file"]) { padding-right: 46px; }
.reveal-btn { position: absolute; top: 50%; right: 5px; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 8px; color: var(--text-3); transform: translateY(-50%); transition: color 0.15s, background 0.15s; }
.reveal-btn:hover { background: rgba(255, 255, 255, 0.06); color: var(--text); }
.reveal-btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 0; }
.reveal-btn svg { width: 18px; height: 18px; }

/* Logos sin aspect-ratio (Smart TV viejos): un alto mínimo para que no queden aplastados. */
@supports not (aspect-ratio: 16 / 10) { .logo-tile { min-height: 34px; } }

/* Aviso de boot.js cuando la plataforma no arranca en un navegador muy viejo. */
.boot-fail { position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 9999; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px; background: #07080b; color: #f4f5f7; font-family: system-ui, sans-serif; text-align: center; }
.boot-fail h1 { max-width: 760px; margin-bottom: 16px; font-size: 30px; }
.boot-fail p { max-width: 760px; margin-bottom: 12px; color: #a5aab5; font-size: 18px; line-height: 1.5; }
.boot-fail .boot-detail { color: #868c98; font-size: 13px; word-break: break-word; }
