/* Loquendo Rifas — estructura común del sitio: barra superior, menú lateral, menú inferior,
   modales, avisos y pie de página. Se carga después de tokens.css y components.css.
   Solo usa variables de tokens.css: para cambiar colores, edita tokens.css. */

:root {
  --topbar-h: 68px;
  --bnav-h: 72px;
  --ancho: 1080px;
  --velo: color-mix(in srgb, var(--azul-noche) 78%, transparent);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { min-height: 100vh; padding-bottom: calc(var(--bnav-h) + env(safe-area-inset-bottom, 0px)); -webkit-tap-highlight-color: transparent; }
img { max-width: 100%; }
a { color: var(--celeste-texto); }
a:focus-visible, button:focus-visible, summary:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--tinta-tenue); }

/* Íconos */
.icon { width: 24px; height: 24px; flex: none; fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.icon-sm { width: 18px; height: 18px; }

/* Botón cuadrado de ícono */
.icon-btn { width: 48px; height: 48px; flex: none; display: inline-flex; align-items: center; justify-content: center; border-radius: var(--radius-md);
  border: var(--trazo-fino) solid var(--linea); background: var(--superficie); color: var(--tinta); cursor: pointer; text-decoration: none; transition: background-color 150ms; }
.icon-btn:hover { background: var(--superficie-alta); }

/* Los botones lq-btn también sirven como enlaces */
a.lq-btn { text-decoration: none; }
.lq-btn .icon { margin-top: -3px; }

/* ── Barra superior ─────────────────────────────────────────────────────── */
.topbar { position: sticky; top: 0; z-index: 50; height: var(--topbar-h); display: flex; align-items: center; justify-content: space-between; gap: var(--space-3);
  padding: 0 var(--space-4); background: var(--fondo); border-bottom: var(--trazo-fino) solid var(--linea); }
.topbar-logo { display: flex; align-items: center; min-width: 0; border-radius: var(--radius-sm); }
.topbar-logo img { height: 48px; width: auto; display: block; }
.topbar-actions { display: flex; align-items: center; gap: var(--space-2); }

.user-chip { display: none; align-items: center; gap: var(--space-2); height: 48px; max-width: 220px; padding: 0 var(--space-4) 0 var(--space-1);
  border-radius: var(--radius-full); border: var(--trazo-fino) solid var(--linea); background: var(--superficie); color: var(--tinta);
  font: inherit; font-weight: 800; font-size: 15px; cursor: pointer; }
.user-chip.show { display: inline-flex; }
.user-chip-avatar { width: 36px; height: 36px; flex: none; display: flex; align-items: center; justify-content: center; padding-top: 3px;
  border-radius: var(--radius-full); background: var(--amarillo); color: var(--on-amarillo); border: var(--trazo-fino) solid var(--borde-marca);
  font-family: var(--font-display); font-size: 18px; }
.user-chip-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 520px) {
  .user-chip { padding: 0 var(--space-1); }
  .user-chip-name { display: none; }
  .topbar-logo img { height: 40px; }
}

/* ── Menú lateral ───────────────────────────────────────────────────────── */
.drawer-overlay { position: fixed; inset: 0; z-index: 90; background: var(--velo); opacity: 0; pointer-events: none; transition: opacity 150ms; }
.drawer-overlay.open { opacity: 1; pointer-events: auto; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; z-index: 100; width: min(340px, 88vw); display: flex; flex-direction: column;
  background: var(--superficie); border-left: var(--trazo-fino) solid var(--linea); transform: translateX(100%); transition: transform 200ms; visibility: hidden; }
.drawer.open { transform: none; visibility: visible; }
.drawer-header { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-4); border-bottom: var(--trazo-fino) solid var(--linea); }
.drawer-title { margin: 0; font-family: var(--font-display); font-weight: 400; font-size: 26px; line-height: 28px; padding-top: 4px; text-transform: uppercase; }
.drawer-body { flex: 1; overflow-y: auto; padding: var(--space-3); display: flex; flex-direction: column; gap: var(--space-1); }
.drawer-item { display: flex; align-items: center; gap: var(--space-3); width: 100%; min-height: 52px; padding: var(--space-3); border: 0; border-radius: var(--radius-md);
  background: transparent; color: var(--tinta); font: inherit; font-weight: 800; font-size: 17px; text-align: left; text-decoration: none; cursor: pointer; }
.drawer-item:hover { background: var(--superficie-alta); }
.drawer-item .icon { color: var(--celeste-texto); }
.drawer-divider { height: var(--trazo-fino); margin: var(--space-2) 0; border-radius: var(--radius-full); background: var(--linea); }
.drawer-footer { padding: var(--space-4); border-top: var(--trazo-fino) solid var(--linea); display: flex; flex-direction: column; gap: var(--space-3); }
.drawer-user { display: none; }
.drawer-user.show { display: block; }
.drawer-user-name { font-weight: 800; }
.drawer-user-email { font-size: 15px; line-height: 22px; color: var(--tinta-tenue); word-break: break-all; }
.drawer-help { margin: 0; font-size: 15px; color: var(--tinta-tenue); }

/* ── Menú inferior ──────────────────────────────────────────────────────── */
.bottom-nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; background: var(--superficie); border-top: var(--trazo-fino) solid var(--linea);
  padding-bottom: env(safe-area-inset-bottom, 0px); }
.bottom-nav-inner { display: flex; max-width: 640px; height: var(--bnav-h); margin: 0 auto; }
.bnav-item { position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--space-1);
  border: 0; background: transparent; color: var(--tinta-tenue); font: inherit; font-weight: 800; font-size: 12px; line-height: 16px; letter-spacing: 0.04em;
  text-transform: uppercase; text-decoration: none; white-space: nowrap; cursor: pointer; }
.bnav-item:hover { color: var(--tinta); }
.bnav-item.active { color: var(--tinta); }
.bnav-item.active .icon { color: var(--amarillo); }
.bnav-item.active::before { content: ""; position: absolute; top: 0; left: 28%; right: 28%; height: 5px; border-radius: 0 0 var(--radius-full) var(--radius-full); background: var(--amarillo); }
.bnav-item:focus-visible { box-shadow: none; outline: var(--trazo-fino) solid var(--foco); outline-offset: -6px; border-radius: var(--radius-md); }

/* ── Página ─────────────────────────────────────────────────────────────── */
.page { max-width: var(--ancho); margin: 0 auto; padding: 0 var(--space-4); }
.section { margin-top: var(--space-7); scroll-margin-top: calc(var(--topbar-h) + var(--space-4)); }
.section > .lq-kicker { margin: 0 0 var(--space-5); }
.panel { background: var(--superficie); border: var(--trazo-fino) solid var(--linea); border-radius: var(--radius-lg); box-shadow: var(--sombra-tarjeta); padding: var(--space-5); }
.title { margin: 0; font-family: var(--font-display); font-weight: 400; font-size: 28px; line-height: 32px; padding-top: 4px; text-transform: uppercase; text-wrap: balance; }
.label { font-weight: 800; font-size: 13px; line-height: 18px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--tinta-tenue); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); gap: var(--space-5); }
.back-link { display: inline-flex; align-items: center; gap: var(--space-2); margin-top: var(--space-5); font-weight: 800; text-decoration: none; }

/* Filas de datos (clave / valor) */
.rows { display: flex; flex-direction: column; }
.row { display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-4); padding: var(--space-3) 0; border-bottom: var(--trazo-fino) solid var(--linea); }
.row:last-child { border-bottom: 0; }
.row-key { flex: none; }
.row-val { font-weight: 800; text-align: right; min-width: 0; overflow-wrap: anywhere; }

/* Avisos */
.notice { display: flex; gap: var(--space-3); align-items: flex-start; padding: var(--space-4); border-radius: var(--radius-md);
  border: var(--trazo-fino) solid var(--linea); background: var(--superficie-alta); font-size: 15px; line-height: 22px; }
.notice .icon { color: var(--celeste-texto); margin-top: -1px; }
.notice p { margin: 0; }
.notice p + p { margin-top: var(--space-2); }
.notice-error { border-color: var(--rosa); background: var(--fondo); color: var(--rosa-texto); font-weight: 800; }
.notice-error .icon { color: var(--rosa-texto); }
.link-btn { padding: 0; border: 0; background: none; color: inherit; font: inherit; text-decoration: underline; cursor: pointer; }

/* Carga */
.skel { border-radius: var(--radius-sm); background: var(--superficie-alta); animation: lq-pulse 1.4s ease-in-out infinite; }

/* ── Modales (hoja inferior en móvil, centrados en pantallas grandes) ───── */
.overlay { position: fixed; inset: 0; z-index: 200; display: flex; align-items: flex-end; justify-content: center; background: var(--velo);
  opacity: 0; pointer-events: none; transition: opacity 150ms; }
.overlay.active { opacity: 1; pointer-events: auto; }
.modal { position: relative; width: 100%; max-width: 520px; max-height: 92vh; overflow-y: auto; background: var(--superficie);
  border: var(--trazo-fino) solid var(--linea); border-bottom: 0; border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: var(--space-6) var(--space-5) calc(var(--space-5) + env(safe-area-inset-bottom, 0px)); transform: translateY(24px); transition: transform 200ms;
  display: flex; flex-direction: column; gap: var(--space-4); }
.overlay.active .modal { transform: none; }
.modal-close { position: absolute; top: var(--space-3); right: var(--space-3); }
.modal-title { margin: 0 var(--space-7) 0 0; font-family: var(--font-display); font-weight: 400; font-size: 30px; line-height: 34px; padding-top: 4px; text-transform: uppercase; text-wrap: balance; }
.modal-sub { margin: 0; color: var(--tinta-tenue); }
.modal-actions { display: flex; flex-direction: column; gap: var(--space-3); }
@media (min-width: 640px) {
  .overlay { align-items: center; padding: var(--space-4); }
  .modal { border-radius: var(--radius-lg); border-bottom: var(--trazo-fino) solid var(--linea); box-shadow: var(--sombra-tarjeta); }
}

/* ── Páginas legales (términos, privacidad) ─────────────────────────────── */
.legal { max-width: 720px; margin: 0 auto; padding-top: var(--space-6); display: flex; flex-direction: column; gap: var(--space-5); }
.legal h1 { margin: 0; font-family: var(--font-display); font-weight: 400; font-size: clamp(32px, 6vw, 44px); line-height: 1.1; padding-top: 4px; text-transform: uppercase; text-shadow: var(--sombra-letra); }
.legal-date { margin: calc(var(--space-3) * -1) 0 0; color: var(--tinta-tenue); }
.legal .panel h2 { margin: 0 0 var(--space-3); font-family: var(--font-display); font-weight: 400; font-size: 22px; line-height: 26px; padding-top: 3px; text-transform: uppercase; }
.legal .panel p { margin: 0 0 var(--space-3); }
.legal .panel p:last-child { margin-bottom: 0; }
.legal .panel ul { margin: 0; padding-left: var(--space-5); display: flex; flex-direction: column; gap: var(--space-2); }

/* ── Pie de página ──────────────────────────────────────────────────────── */
.footer { margin-top: var(--space-8); padding: var(--space-6) var(--space-4) var(--space-5); border-top: var(--trazo-fino) solid var(--linea);
  display: flex; flex-direction: column; align-items: center; gap: var(--space-3); text-align: center; color: var(--tinta-tenue); font-size: 15px; line-height: 22px; }
.footer-logo { width: 64px; height: auto; }
.footer p { margin: 0; }
.footer-links { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-2) var(--space-4); }
.footer a { color: var(--tinta-tenue); font-weight: 800; }
.footer a:hover { color: var(--tinta); }
.footer-credit { display: inline-flex; align-items: center; gap: var(--space-1); font-size: 13px; letter-spacing: 0.12em; text-transform: uppercase; text-decoration: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .drawer, .drawer-overlay, .overlay, .modal, .icon-btn { transition: none; }
  .skel { animation: none; }
}
