/* Sistema de diseño compartido de las webs de StreamMate (portada y Estadísticas LUB).
   Tokens y componentes copiados de switcher/public/css/base.css para que las tres webs se
   vean iguales; acá se agregan solo las piezas que switcher no tiene: navegación del sitio,
   selector de idioma, pie de página y tablas. Si cambia base.css, actualizar este archivo. */

:root {
  --bg-1: #35505a;
  --bg-2: #7c9ca6;
  --bg-3: #a9c3cb;
  --ink: #172026;
  --ink-2: #2b3a41;
  --ink-3: #50626b;
  --ink-inv: #f4f8fa;
  --accent: #4285f4;
  --accent-2: #2a64c4;
  --teal: #1fb2a6;
  --teal-2: #0b7a72;
  --ok: #1b8a4c;
  --ok-ink: #0a4a28;
  --warn: #ffb300;
  --danger: #d93025;
  --danger-ink: #8f1d16;
  --glass: rgba(255, 255, 255, .62);
  --glass-strong: rgba(255, 255, 255, .78);
  --glass-solid: rgba(255, 255, 255, .92);
  --glass-dark: rgba(23, 32, 38, .62);
  --line: rgba(255, 255, 255, .45);
  --rule: rgba(23, 32, 38, .1);
  --shadow: 0 8px 24px rgba(10, 30, 40, .18);
  --radius: 14px;
  --radius-sm: 8px;
  --blur: 12px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --page-max: 1200px;
  --gutter: 24px;
}

/* ---------- Reset ---------- */

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

html { height: 100%; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.4;
  color: var(--ink);
  background: var(--bg-2);
}

/* Fondo fijo en un pseudo-elemento: background-attachment: fixed se ignora en móvil */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(900px 400px at 100% 0%, rgba(31, 178, 166, .22), transparent 60%),
    linear-gradient(160deg, var(--bg-1) 0%, var(--bg-2) 55%, var(--bg-3) 100%);
}

[hidden] { display: none !important; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

a { color: #1b3a8a; }
a:hover { color: #0f2560; }

h1, h2, h3 { line-height: 1.25; }

button, input, select, textarea { font: inherit; color: inherit; }

/* ---------- Glass: el blur vive en un pseudo-elemento, nunca en el contenedor ---------- */

.app-bar, .card, .menu-panel {
  position: relative;
  isolation: isolate;
}
.app-bar::before, .card::before, .menu-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background: var(--glass);
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
}
.app-bar::before { background: var(--glass-dark); }
.menu-panel::before { background: rgba(23, 32, 38, .9); }

/* ---------- Cabecera ---------- */

.app-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 20px;
  padding: 10px var(--gutter);
  color: var(--ink-inv);
  border-bottom: 1px solid rgba(255, 255, 255, .18);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink-inv);
}
.brand:hover { color: var(--ink-inv); }
.brand-logo { display: block; height: 40px; width: auto; }
.brand-mark { display: none; height: 32px; width: auto; }
.brand .role {
  font-weight: 500;
  font-size: 13px;
  color: rgba(244, 248, 250, .82);
  padding: 3px 9px;
  border: 1px solid rgba(255, 255, 255, .28);
  border-radius: 999px;
  white-space: nowrap;
}

.app-bar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

/* Navegación del sitio dentro de la cabecera */
.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
}
.site-nav a {
  padding: 6px 11px;
  border-radius: 999px;
  font-size: 13px;
  color: rgba(244, 248, 250, .86);
  text-decoration: none;
  white-space: nowrap;
}
.site-nav a:hover { color: #fff; background: rgba(255, 255, 255, .12); }
.site-nav a[aria-current="page"] {
  color: #fff;
  background: linear-gradient(135deg, rgba(42, 100, 196, .9), rgba(11, 122, 114, .9));
  border: 1px solid rgba(255, 255, 255, .3);
}
.site-nav a:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

/* Selector de idioma: dos botones en una píldora, el activo con el degradado de marca */
.lang-switch {
  display: inline-flex;
  padding: 1px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .12);
  border: 1px solid rgba(255, 255, 255, .25);
}
.lang-switch button {
  appearance: none;
  cursor: pointer;
  border: 0;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 10px;
  line-height: 16px;
  font-weight: 600;
  letter-spacing: .04em;
  color: rgba(244, 248, 250, .75);
  background: transparent;
}
.lang-switch button:hover { color: #fff; }
.lang-switch button[aria-pressed="true"] {
  color: #fff;
  background: linear-gradient(135deg, var(--accent-2), var(--teal-2));
}
.lang-switch button:focus-visible { outline: 2px solid #fff; outline-offset: 1px; }

/* ---------- Menú desplegable (details nativo) ---------- */

.menu { position: relative; }
.menu summary {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 13px;
  color: #fff;
  background: linear-gradient(135deg, rgba(42, 100, 196, .9), rgba(11, 122, 114, .9));
  border: 1px solid rgba(255, 255, 255, .3);
  user-select: none;
}
.menu summary::-webkit-details-marker { display: none; }
.menu summary::after {
  content: "";
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid rgba(255, 255, 255, .9);
}
.menu[open] summary::after { transform: rotate(180deg); }
.menu summary:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

.menu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 220px;
  max-width: calc(100vw - 32px);
  padding: 8px;
  border-radius: var(--radius);
  border: 1px solid rgba(255, 255, 255, .2);
  box-shadow: 0 14px 34px rgba(5, 20, 30, .35);
  color: var(--ink-inv);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.menu-panel a {
  padding: 8px 12px;
  border-radius: 10px;
  color: var(--ink-inv);
  text-decoration: none;
}
.menu-panel a:hover, .menu-panel a[aria-current="page"] { background: rgba(255, 255, 255, .12); }

/* ---------- Píldoras ---------- */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 13px;
  white-space: nowrap;
  color: var(--ink-inv);
  background: rgba(255, 255, 255, .14);
  border: 1px solid rgba(255, 255, 255, .22);
}

/* ---------- Tarjetas ---------- */

.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px;
}
.card h2 { margin: 0 0 10px; font-size: 16px; }
.card h3 { margin: 0 0 8px; font-size: 15px; }
/* Tarjeta casi opaca para tablas y texto denso */
.card-solid::before { background: var(--glass-solid); }

.card select, .card input[type="text"], .card input[type="number"], .card input[type="search"] {
  font-size: 13px;
  padding: 5px 8px;
  border-radius: 7px;
  border: 1px solid rgba(23, 32, 38, .22);
  background: rgba(255, 255, 255, .85);
  color: var(--ink);
}

.hint { font-size: 12px; color: var(--ink-3); }

/* ---------- Botones ---------- */

.btn {
  appearance: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  padding: 7px 13px;
  border-radius: 9px;
  border: 1px solid transparent;
  color: var(--ink);
  background: var(--glass-strong);
  text-decoration: none;
  transition: filter .15s, box-shadow .15s;
}
.btn:hover { filter: brightness(1.05); color: var(--ink); }
.btn:active { filter: brightness(.95); }
.btn:disabled { opacity: .6; cursor: default; filter: none; }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.btn-primary, .btn-primary:hover {
  color: #fff;
  background: linear-gradient(135deg, var(--accent-2), var(--teal-2));
  box-shadow: 0 4px 12px rgba(31, 100, 180, .28);
}
.btn-ghost {
  background: rgba(255, 255, 255, .55);
  border-color: rgba(255, 255, 255, .7);
}
.btn-lg { font-size: 15px; padding: 11px 20px; border-radius: 11px; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn[aria-pressed="true"] {
  color: #fff;
  background: linear-gradient(135deg, var(--accent-2), var(--teal-2));
  box-shadow: 0 0 0 3px rgba(255, 255, 255, .55), 0 4px 12px rgba(31, 100, 180, .28);
}

/* ---------- Pares clave/valor, barras, chips ---------- */

.kv {
  font-size: 13px;
  margin: 4px 0;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  align-items: baseline;
}
.kv > b { min-width: 110px; font-weight: 600; }

.bar-track {
  height: 6px;
  border-radius: 3px;
  background: rgba(23, 32, 38, .14);
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--accent), var(--teal));
}

.chip {
  display: inline-block;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .65);
  border: 1px solid rgba(23, 32, 38, .15);
}

/* ---------- Tablas ---------- */

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.table th, .table td {
  padding: 6px 8px;
  text-align: right;
  white-space: nowrap;
  border-bottom: 1px solid var(--rule);
}
.table th:first-child, .table td:first-child { text-align: left; }
.table thead th {
  position: sticky;
  top: 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-2);
  background: rgba(244, 248, 250, .96);
  border-bottom: 2px solid rgba(23, 32, 38, .18);
}
.table tbody tr:hover { background: rgba(66, 133, 244, .06); }

/* ---------- Layout de página y pie ---------- */

.page {
  width: 100%;
  max-width: calc(var(--page-max) + 2 * var(--gutter));
  margin: 0 auto;
  padding: 22px var(--gutter) 40px;
  flex: 1;
}

.site-footer {
  padding: 18px var(--gutter);
  font-size: 12px;
  color: rgba(244, 248, 250, .85);
  background: rgba(23, 32, 38, .55);
  border-top: 1px solid rgba(255, 255, 255, .15);
}
.site-footer-inner {
  max-width: var(--page-max);
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 20px;
}
.site-footer a { color: #dbe8ee; }
.site-footer a:hover { color: #fff; }
.site-footer .spacer { flex: 1; }

/* ---------- Responsive y preferencias ---------- */

@media (max-width: 600px) {
  :root { --blur: 0px; --gutter: 16px; }
  .app-bar { padding: 8px 12px; gap: 8px; }
  .brand-logo, .brand .role { display: none; }
  .brand-mark { display: block; }
  .pill { font-size: 11px; padding: 4px 8px; }
  .menu summary { font-size: 12px; padding: 5px 10px; }
}

@media (prefers-reduced-transparency: reduce) {
  :root { --glass: rgba(255, 255, 255, .9); --glass-strong: rgba(255, 255, 255, .95); --glass-dark: rgba(23, 32, 38, .9); }
  .app-bar::before, .card::before, .menu-panel::before { backdrop-filter: none; -webkit-backdrop-filter: none; }
}

@supports not (backdrop-filter: blur(1px)) {
  :root { --glass: rgba(255, 255, 255, .9); --glass-strong: rgba(255, 255, 255, .95); --glass-dark: rgba(23, 32, 38, .9); }
}

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