/* Estilo común de las páginas para externos (apuntarse y portal).

   Son HTML estático fuera de la web app, así que no pasan por Tailwind: los
   tokens se copian a mano de hosting/web/src/index.css. Si allí cambia un
   color, hay que cambiarlo también aquí.

   El modo oscuro sigue al sistema: un externo no tiene cuenta donde guardar
   la preferencia, y la web la guarda por navegador en otro dominio. */

:root {
  --font-sans: "Barlow", system-ui, sans-serif;
  --font-display: "Barlow Condensed", system-ui, sans-serif;

  --bg: #f2f2f3;
  --surface: #e9e9ea;
  --surface-2: #e7e7ea;
  --ink: #0f3460;
  --ink-2: #5d5d60;
  --ink-3: #7a7a7d;
  --ink-4: #98989b;
  --line: #0f346029;
  --hover: #0f34600d;
  --on-accent: #f2f2f3;

  --accent: #5980a6;
  --accent-strong: #416180;
  --accent-ink: #2c455d;
  --accent-tint: #eef6ff;
  --accent-tint-2: #d6ebff;

  --danger: #416180;
  --danger-ink: #2c455d;
  --danger-tint: #eef6ff;
  --warn-ink: #424244;

  /* El globo de los demás en el chat: blanco, no `surface`, que casi no se
     separa del fondo. */
  --bubble-other: #ffffff;
  --bubble-mine: #b9cde2;
  --bubble-mine-ink: #0f3460;

  --status-ink-mix: #000000;
  --shadow-panel: 0 12px 32px rgb(43 43 45 / 0.22);

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171c;
    --surface: #1b1f25;
    --surface-2: #1f242b;
    --ink: #e3eaf3;
    --ink-2: #a3a8b0;
    --ink-3: #868b93;
    --ink-4: #686d75;
    --line: #e3eaf324;
    --hover: #e3eaf30d;
    --on-accent: #0f1419;

    --accent: #6187ad;
    --accent-strong: #86a8ca;
    --accent-ink: #b4cde6;
    --accent-tint: #1a2633;
    --accent-tint-2: #22344a;

    --danger: #86a8ca;
    --danger-ink: #b4cde6;
    --danger-tint: #1a2633;
    --warn-ink: #c4c8ce;

    --bubble-other: #2f343c;
    --bubble-mine: #34506d;
    --bubble-mine-ink: #ffffff;

    --status-ink-mix: #ffffff;
    --shadow-panel: 0 12px 32px rgb(0 0 0 / 0.5);

    color-scheme: dark;
  }
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
}
/* Como en la web: en móvil todo el texto un 10% más grande. */
@media (width < 64rem) {
  html { -webkit-text-size-adjust: 110%; text-size-adjust: 110%; }
}
body { min-height: 100dvh; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; }
button, input, textarea { font: inherit; color: inherit; }
.hidden { display: none !important; }

/* ── Barra superior con la marca ─────────────────────────────────────── */

.topbar {
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 640px;
  margin: 0 auto;
  height: 56px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}
/* El emblema como silueta rellena con el color del texto, igual que el
   LogoMark de la web: el SVG no trae color. 4:3, como el original. */
.logo-mark {
  display: block;
  flex-shrink: 0;
  width: 43px;
  height: 32px;
  background: var(--ink);
  -webkit-mask: url(/logo-lexludi.svg) center / contain no-repeat;
  mask: url(/logo-lexludi.svg) center / contain no-repeat;
}
.brand-name {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  line-height: 1;
}

/* ── Página ──────────────────────────────────────────────────────────── */

.page {
  max-width: 640px;
  margin: 0 auto;
  padding: 28px 16px 48px;
}

.eyebrow {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent-strong);
  margin-bottom: 8px;
}
.title-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-bottom: 16px;
}
.page-title {
  font-size: 34px;
  line-height: 1.05;
  letter-spacing: -0.015em;
  overflow-wrap: anywhere;
}
@media (width >= 64rem) {
  .page-title { font-size: 40px; }
}

.facts {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 15px;
}
.facts li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.icon {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  margin-top: 2px;
  color: var(--ink-2);
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.description {
  margin-top: 16px;
  font-size: 15px;
  line-height: 1.6;
  white-space: pre-wrap;
}

.section { margin-top: 28px; }
.section-label {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-2);
}
.section-toggle {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  text-align: left;
}
.section-toggle:hover { color: var(--ink); }
.chevron {
  width: 15px;
  height: 15px;
  margin-left: auto;
  transition: transform 0.2s ease-out;
}
.section-toggle[aria-expanded="true"] .chevron { transform: rotate(180deg); }
.section-body { margin-top: 10px; }
.hint {
  margin-top: 10px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--ink-3);
}

/* ── Etiquetas ───────────────────────────────────────────────────────── */

/* El color de cada estado sale de `--status` y se mezcla como en
   QuedadaStatusBadge: fondo claro del color y el texto en una versión más
   oscura (más clara en el tema oscuro). */
.status-badge {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  border-radius: 4px;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 500;
  line-height: 17px;
  letter-spacing: 0.02em;
  background: color-mix(in srgb, var(--status) 14%, transparent);
  color: color-mix(in srgb, var(--status) 70%, var(--status-ink-mix));
}
.status-open { --status: #1565c0; }
.status-full { --status: #e65100; }
.status-started { --status: #4caf50; }
.status-cancelled { --status: #e94560; }
.status-finished { --status: #607d8b; }

/* El contador de plazas de una mesa, con los tonos de la ficha de la web. */
.chip {
  flex-shrink: 0;
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  background: var(--accent-tint);
  color: var(--accent-ink);
}
.chip-joined { background: var(--accent); color: var(--on-accent); }
.chip-full { background: var(--surface-2); color: var(--warn-ink); }

/* ── Listas (juegos, asistentes) ─────────────────────────────────────── */

.rows {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  font-size: 15px;
}
.row + .row { border-top: 1px solid var(--line); }
.row-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.row-note {
  flex-shrink: 0;
  font-size: 12px;
  color: var(--ink-3);
}
label.row { cursor: pointer; }
label.row.is-disabled { cursor: not-allowed; opacity: 0.5; }

.thumb {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  object-fit: cover;
  background: var(--bg);
}
.thumb-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: var(--ink-3);
  border-radius: 4px;
}

.avatar {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--accent);
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--accent-ink);
}
.avatar-round { border-radius: 9999px; width: 36px; height: 36px; font-size: 13px; }

.link-btn {
  flex-shrink: 0;
  background: none;
  border: none;
  padding: 2px 4px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--accent-strong);
}
.link-btn:hover { text-decoration: underline; }
.link-btn.is-quiet { color: var(--ink-2); font-weight: 400; }
.link-btn:disabled { opacity: 0.5; cursor: default; }

/* Checkbox propio, como el de ui.tsx: el input nativo sin su aspecto. */
.check {
  appearance: none;
  -webkit-appearance: none;
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border: 1.5px solid var(--ink-3);
  border-radius: 6px;
  background: var(--bg) center / 14px no-repeat;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s;
}
.check:hover { border-color: var(--ink-2); }
.check:checked {
  border-color: var(--accent);
  background-color: var(--accent);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 8.5l3 3 6-7' fill='none' stroke='%23f2f2f3' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
.check:focus-visible { outline: 2px solid color-mix(in srgb, var(--accent) 40%, transparent); outline-offset: 1px; }
.check:disabled { cursor: not-allowed; }

/* ── Formularios y botones ───────────────────────────────────────────── */

.form-title { font-size: 22px; line-height: 1.15; margin-bottom: 4px; }
.form-sub { font-size: 14px; color: var(--ink-2); margin-bottom: 18px; }
.field-label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  color: var(--ink-2);
}
.field-label .opt { color: var(--ink-3); }
.field {
  display: block;
  width: 100%;
  height: 44px;
  margin-bottom: 16px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: transparent;
  font-size: 15px;
  outline: none;
  transition: border-color 0.15s;
}
textarea.field { height: auto; min-height: 76px; padding: 10px 12px; resize: vertical; line-height: 1.45; }
.field::placeholder { color: var(--ink-3); }
.field:focus { border-color: var(--accent); }
.field:disabled { opacity: 0.6; }

.btn {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 40px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: transparent;
  font-size: 15px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}
.btn:hover { background: var(--hover); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn:disabled { cursor: not-allowed; opacity: 0.5; }
.btn-primary { border-color: var(--accent); background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { border-color: var(--accent-strong); background: var(--accent-strong); }
.btn-primary:disabled:hover { border-color: var(--accent); background: var(--accent); }
.btn-lg { height: 48px; padding: 0 20px; font-size: 16px; }
.btn-block { width: 100%; }

/* ── Avisos y estados ────────────────────────────────────────────────── */

.notice {
  padding: 10px 14px;
  font-size: 14px;
  line-height: 1.5;
  background: var(--danger-tint);
  color: var(--danger-ink);
}
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
}
.state {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 40px 24px;
  text-align: center;
}
.state-title { font-family: var(--font-display); font-size: 22px; font-weight: 600; }
.state-text { margin: 6px auto 0; max-width: 28rem; font-size: 14px; line-height: 1.5; color: var(--ink-2); }

.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 80px 0;
  font-size: 14px;
  color: var(--ink-2);
}
.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid color-mix(in srgb, var(--ink) 12%, transparent);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Diálogo de confirmación ─────────────────────────────────────────── */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgb(0 0 0 / 0.4);
}
.dialog {
  width: 100%;
  max-width: 24rem;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  box-shadow: var(--shadow-panel);
}
.dialog-title { font-size: 22px; line-height: 1.15; margin-bottom: 8px; }
.dialog-text { font-size: 14px; line-height: 1.5; color: var(--ink-2); margin-bottom: 24px; }
.dialog-actions { display: flex; gap: 8px; }
.dialog-actions .btn { flex: 1; }
