/*
  Estilos compartidos de la app /evento/ (pantallas posteriores al login).

  Reutiliza los tokens de la pantalla de login (evento/index.html):
  colores, tipografía del sistema, mayúsculas con tracking de 0.22em,
  esquinas rectas, bordes de 1px y botón sólido con texto invertido.
  La pantalla de login conserva sus estilos en línea y no usa este archivo.
*/

:root {
  --bg: #ffffff;
  --ink: #161616;
  --muted: #6a6a6a;
  --error: #b3261e;
  --hair: #cfcfcf; /* línea fina para marcos y separadores */
  --page-top: 12px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161616;
    --ink: #f2f2f2;
    --muted: #a0a0a0;
    --error: #ff8a80;
    --hair: #3a3a3a;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Oculta la página hasta confirmar que hay sesión (ver evento.js). */
.pending body { visibility: hidden; }

[hidden] { display: none !important; }

/* PR3: acceso individual con los mismos colores y tipografía de la aplicación. */
.pr3-auth { width: min(600px, 100%); max-width: 600px; margin: 0 auto; padding: 28px 24px 72px; text-align: left; }
.pr3-auth h1 { font-size: clamp(32px,7vw,48px); letter-spacing: -.03em; text-transform: none; }
.pr3-auth .lead { margin-bottom: 24px; text-align: left; }
.pr3-auth #pr3-login { width: 100%; max-width: none; margin: 28px 0 20px; }
.pr3-auth .field { margin-bottom: 20px; }
.pr3-auth .signup-login { margin-top: 28px; font-size: 14px; }
.pr3-auth a { text-underline-offset: 4px; }
@media (max-width:520px) { .pr3-auth { padding-inline: 20px; padding-bottom: 56px; } }
.pr3-auth label { display: block; margin: 0 0 8px; font-size: 14px; line-height: 1.5; }
.pr3-auth input { display: block; width: 100%; min-height: 48px; padding: 12px 14px; border: 1px solid var(--hair); border-radius: 0; background: #fff; color: #111; font: inherit; font-size: 16px; }
.pr3-auth-actions { display: flex; gap: 12px; margin-top: 20px; }
.pr3-auth-actions .btn { min-width: 0; flex: 1; padding-inline: 12px; letter-spacing: .08em; text-align: center; }
.pr3-auth-actions button { margin-top: 0; }
.pr3-auth input { color-scheme: light; background: #fff; color: #000; caret-color: #000; }
.pr3-auth input::placeholder { color: #000; opacity: 1; }
@media (max-width: 360px) { .pr3-auth-actions .btn { font-size: 12px; padding-inline: 8px; } }
.pr3-notice { max-width: 960px; margin: 24px auto; padding: 0 24px; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

/* ---------- Header ---------- */
.bar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--hair);
}
.brand {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  text-decoration: none;
}
.brand small {
  margin-left: 12px;
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.22em;
  color: var(--muted);
}
.bar-action {
  padding: 0;
  font-family: inherit;
  font-size: 13px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
  background: none;
  border: 0;
  cursor: pointer;
}
.bar-action:disabled { opacity: 0.5; cursor: default; }
.bar-action:hover:not(:disabled) { color: var(--ink); }

/* Error al cerrar sesión: franja bajo el header. */
.bar-msg {
  margin: 0;
  padding: 12px 24px;
  font-size: 14px;
  color: var(--error);
  border-bottom: 1px solid var(--hair);
}
.bar-msg:empty { display: none; }

/* ---------- Contenido ---------- */
main {
  flex: 1;
  width: min(720px, 100%);
  margin: 0 auto;
  padding: var(--page-top) 24px 72px;
}
h1 {
  margin: 0 0 12px;
  font-size: clamp(22px, 5vw, 30px);
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}
p.lead {
  max-width: 46ch;
  margin: 0 0 32px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.5;
}

/* ---------- Botones (mismo lenguaje que el login) ---------- */
.btn {
  display: inline-block;
  min-width: 240px;
  padding: 16px 24px;
  font-family: inherit;
  font-size: 15px;
  letter-spacing: 0.22em;
  text-align: center;
  text-decoration: none;
  text-transform: uppercase;
  color: var(--bg);
  background: var(--ink);
  border: 1px solid var(--ink);
  border-radius: 0;
  cursor: pointer;
}
.btn:hover { background: transparent; color: var(--ink); }

/* Acción secundaria: mismo botón, invertido. */
.btn.ghost { background: transparent; color: var(--ink); }
.btn.ghost:hover { background: var(--ink); color: var(--bg); }

/* ---------- Estado vacío ---------- */
.empty {
  margin-top: 56px;
}
.frame {
  position: relative;
  aspect-ratio: 3 / 2;
  border: 1px solid var(--hair);
}
/* Esquinas de visor: marcan el encuadre de la foto que todavía no existe. */
.frame i {
  position: absolute;
  width: 22px;
  height: 22px;
  border: 0 solid var(--ink);
}
.frame i:nth-child(1) { top: -1px;    left: -1px;  border-width: 2px 0 0 2px; }
.frame i:nth-child(2) { top: -1px;    right: -1px; border-width: 2px 2px 0 0; }
.frame i:nth-child(3) { bottom: -1px; left: -1px;  border-width: 0 0 2px 2px; }
.frame i:nth-child(4) { bottom: -1px; right: -1px; border-width: 0 2px 2px 0; }

.empty h2 {
  margin: 24px 0 8px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}
.empty p {
  max-width: 46ch;
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.5;
}

/* ---------- Lista de eventos ---------- */
.events {
  display: grid;
  gap: 12px;
  margin: 56px 0 0;
  padding: 0;
  list-style: none;
}
.event {
  border: 1px solid var(--hair);
}
.event:hover,
.event:focus-within { border-color: var(--ink); }
.event a {
  position: relative;
  display: block;
  padding: 20px 52px 20px 20px;
  color: inherit;
  text-decoration: none;
}
.event a::after {
  content: "\2192";
  position: absolute;
  top: 18px;
  right: 20px;
  font-size: 18px;
  color: var(--muted);
}
.event:hover a::after,
.event:focus-within a::after { color: var(--ink); }
.event h2 {
  margin: 0 0 12px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}
.event-expired { display: inline-block; margin-inline-start: .45em; color: var(--error); }
.event p {
  margin: 0;
  font-size: 14px;
  line-height: 1.7;
  color: var(--muted);
}

/* ---------- Formulario (mismo lenguaje que el campo del login) ---------- */
.form { max-width: 520px; }
.field {
  margin: 0 0 24px;
  padding: 0;
  border: 0;
  min-width: 0;
}
.field label,
.field legend {
  display: block;
  margin: 0 0 8px;
  padding: 0;
  font-size: 14px;
}
.field input[type="text"],
.field input[type="date"],
.field input[type="time"] {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 52px;
  padding: 14px 16px;
  font-size: 16px; /* evita el zoom automático en iOS */
  font-family: inherit;
  text-align: left;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--ink);
  border-radius: 0;
  -webkit-appearance: none;
  appearance: none;
}
.field input::-webkit-date-and-time-value { text-align: left; }
.date-picker { position: relative; }
.field .date-picker input { color: transparent; }
.date-picker input::-webkit-datetime-edit { opacity: 0; }
/* The entire field opens Chromium's native picker. */
.date-picker input::-webkit-calendar-picker-indicator {
  position: absolute;
  inset: 0;
  width: auto;
  height: auto;
  margin: 0;
  padding: 0;
  opacity: 0;
  cursor: pointer;
}
.date-picker-value {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-inline: 17px;
  pointer-events: none;
}
.date-picker-value[data-empty] { color: var(--muted); }
.date-picker-value::after {
  content: "";
  width: 16px;
  height: 16px;
  background: currentColor;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.75' stroke-linecap='round'%3E%3Crect x='3' y='5' width='18' height='16' rx='2'/%3E%3Cpath d='M3 10h18M8 3v4m8-4v4'/%3E%3C/svg%3E") center / contain no-repeat;
}
.field input[aria-invalid="true"] { border-color: var(--error); }
.field-error {
  margin: 8px 0 0;
  font-size: 14px;
  color: var(--error);
}
.field-error:empty { display: none; }

.when { display: grid; gap: 24px; }
.when .field { margin-bottom: 0; }
.when { margin-bottom: 24px; }

/* Estilo de las fotos: opciones tipo botón, una por fila. */
.choices { display: grid; gap: 8px; }
.choice { position: relative; display: block; }
.choice input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
}
.choice span {
  display: block;
  padding: 14px 16px;
  font-size: 15px;
  text-align: left;
  border: 1px solid var(--ink);
  cursor: pointer;
}
.choice input:not(:checked) + span:hover { background: var(--hair); }
.choice input:checked + span { color: var(--bg); background: var(--ink); }
.choice input:focus-visible + span { outline: 2px solid var(--ink); outline-offset: 3px; }

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 32px;
}
.form-msg {
  min-height: 1.4em;
  margin: 16px 0 0;
  font-size: 14px;
  color: var(--error);
}

@media (min-width: 521px) {
  .when { grid-template-columns: 1fr 1fr; gap: 16px; }
}

/* ---------- Detalle de un evento ---------- */
.eyebrow {
  margin: 0 0 12px;
  font-size: 12px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
}
.detail h1 {
  margin-bottom: 20px;
  font-size: clamp(20px, 5vw, 26px);
  overflow-wrap: anywhere;
}
.status {
  display: inline-block;
  margin: 0;
  padding: 6px 12px;
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  border: 1px solid var(--ink);
}
.facts {
  margin: 32px 0;
  border-top: 1px solid var(--hair);
}
.fact {
  padding: 18px 0;
  border-bottom: 1px solid var(--hair);
}
.fact dt {
  margin: 0 0 6px;
  font-size: 12px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
}
.fact dd {
  margin: 0;
  font-size: 20px;
  line-height: 1.3;
}
/* Espacio reservado para las herramientas del evento (todavía sin acciones). */
.tools {
  margin: 0 0 32px;
  padding: 20px;
  border: 1px dashed var(--hair);
}
.tools h2 {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
}
.tools p {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--muted);
}

@media (min-width: 521px) {
  .fact {
    display: grid;
    grid-template-columns: 220px 1fr;
    align-items: baseline;
  }
  .fact dt { margin: 0; }
}

/* ---------- Compartir evento ---------- */
.share {
  margin: 0 0 32px;
  padding: 28px 24px;
  border: 1px solid var(--hair);
  text-align: center;
}
.share h2 {
  margin: 0 0 8px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}
.share-lead,
.share-hint {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--muted);
}
.share-lead { margin-bottom: 28px; }
.share-hint { margin-top: 20px; }
.qr-pdf-download{margin-top:24px;}
.qr-pdf-download .btn{max-width:100%;font-size:13px;letter-spacing:.1em;}
.qr-pdf-help{margin:10px 0 0;color:var(--muted);font-size:12px;}
.share-or {
  margin: 24px 0 20px;
  font-size: 12px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
}

/* QR: siempre negro sobre blanco (también en modo oscuro) para que escanee bien. */
.qr-frame {
  position: relative;
  width: min(100%, 320px);
  margin: 0 auto;
  padding: 14px;
}
.qr-frame i {
  position: absolute;
  width: 22px;
  height: 22px;
  border: 0 solid var(--ink);
}
.qr-frame i:nth-child(1) { top: 0;    left: 0;  border-width: 2px 0 0 2px; }
.qr-frame i:nth-child(2) { top: 0;    right: 0; border-width: 2px 2px 0 0; }
.qr-frame i:nth-child(3) { bottom: 0; left: 0;  border-width: 0 0 2px 2px; }
.qr-frame i:nth-child(4) { bottom: 0; right: 0; border-width: 0 2px 2px 0; }
.qr { background: #ffffff; line-height: 0; }
.qr svg { display: block; width: 100%; height: auto; }

.share-url {
  margin: 0 0 16px;
  padding: 12px 14px;
  font-size: 14px;
  line-height: 1.5;
  text-align: left;
  word-break: break-all;
  border: 1px solid var(--hair);
  -webkit-user-select: all;
  user-select: all;
}
.share-msg {
  margin: 14px 0 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--error);
}
.share-msg:empty { display: none; }

/* ---------- Gestión del evento (Paso 6) ---------- */
.status-note {
  margin: 16px 0 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--muted);
}
.status-note:empty { display: none; }

/* Información + botón Editar. */
.manage { margin: 0 0 32px; }
.manage .facts { margin-bottom: 24px; }
.saved-msg {
  margin: 14px 0 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--muted);
}
.saved-msg:empty { display: none; }

/* Formulario de edición dentro del detalle (reutiliza .form, .field, .choices). */
.edit { margin: 32px 0; }

/* Copiar link + Vista previa, lado a lado cuando entran. */
.share-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

/* Acciones: eliminar con confirmación. */
.danger-zone {
  margin: 0 0 32px;
  padding: 20px;
  border: 1px solid var(--hair);
}
.danger-zone h2 {
  margin: 0 0 16px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
}
.btn.danger {
  color: var(--error);
  background: transparent;
  border-color: var(--error);
}
.btn.danger:hover { color: var(--bg); background: var(--error); }
.confirm-title {
  margin: 0 0 8px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}
.confirm-text {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--muted);
}
.confirm .actions { margin-top: 20px; }
.confirm .form-msg { margin-top: 12px; }

/* ---------- Móvil ---------- */
@media (max-width: 520px) {
  :root { --page-top: 8px; }
  .bar { padding: 16px 20px; }
  .bar-msg { padding: 12px 20px; }
  .brand small { display: block; margin: 4px 0 0; }
  main { padding: var(--page-top) 20px 56px; }
  .btn { display: block; width: 100%; min-width: 0; }
  .empty { margin-top: 40px; }
  .events { margin-top: 40px; }
  .actions .btn { width: 100%; }
  .share { padding: 24px 14px; }
  .qr-pdf-download > .btn + .btn { margin-block-start: 8px; }
}

@media (prefers-reduced-motion: no-preference) {
  .btn, .bar-action { transition: background-color 0.15s, color 0.15s; }
}

/* Navegación secundaria común: detalle, creación y galerías. */
.nav-back{
  display:inline-flex;align-items:center;min-height:44px;margin:0 0 12px -8px;padding:0 8px;
  font:inherit;font-size:12px;letter-spacing:.22em;text-transform:uppercase;text-decoration:none;
  color:var(--muted);background:none;border:0;cursor:pointer;
}
.nav-back:hover{color:var(--ink);}
.nav-back:focus-visible{outline:2px solid var(--ink);outline-offset:3px;}
.reveal-badge{
  display:inline-block;margin:0;padding:7px 11px;border:1px solid var(--hair);
  font-size:12px;line-height:1.6;letter-spacing:.04em;color:var(--muted);
}
.reveal-badge[data-revealed="true"]{color:#315747;border-color:#c3d4cb;background:#f0f5f2;}
.reveal-badge[data-status="expired"]{color:var(--error);border-color:var(--error);background:transparent;}

/* El aviso es un hermano de main: vacío no debe reservar espacio. */
p.pr3-notice{margin:var(--page-top) auto 0;}
.pr3-notice:empty{display:none;}
/* Las reglas locales del invitado centran el contenido en toda la altura.
   Compactar solo las pantallas normales; cámara y galería conservan su layout. */
body:not(.cam-live):not(.gal-open) main.guest{justify-content:flex-start;padding-top:var(--page-top);}
body:not(.cam-live):not(.gal-open) main.guest .frame{padding-top:20px;padding-bottom:20px;}
body #gal #gal-back{margin-bottom:12px;}

/* Solo la confirmación del nombre tiene una composición centrada y más aire.
   Sin :has, conserva el diseño compacto anterior como alternativa. */
body:not(.cam-live):not(.gal-open) main.guest:has(#found:not([hidden]) #g-ready:not([hidden])){
  justify-content:center;
  padding-top:24px;
  padding-bottom:24px;
}
body:not(.cam-live):not(.gal-open) main.guest:has(#found:not([hidden]) #g-ready:not([hidden])) #found>.frame{
  padding-top:32px;
  padding-bottom:32px;
}


/* Mis eventos: el CTA tiene el mismo aire antes y después, sin espacio de línea inline. */
.events-page > .btn { display:block; width:fit-content; max-width:100%; }
.events-page > .events,
.events-page > .empty { margin-top:32px; }
@media (max-width:520px) {
  .events-page > .btn { width:100%; }
}

/* Capacidad simultánea de la cuenta. */
.capacity-box{max-width:640px;margin:28px auto;padding:22px;border:1px solid var(--hair);text-align:left;}
.capacity-box h2{margin:0 0 12px;font-size:18px;letter-spacing:0;}
.capacity-box p{margin:0 0 12px;font-size:14px;line-height:1.6;}
.capacity-box #capacity-summary{font-size:18px;color:var(--ink);}
.capacity-box .capacity-help{color:var(--muted);font-size:13px;}
.capacity-box a{display:inline-block;padding:8px 0;color:var(--ink);text-underline-offset:4px;}
.events-page>#create-event{display:block;margin-inline:auto;}
.btn:disabled{opacity:.5;cursor:not-allowed;}


.bar.account-header{align-items:center;}
.account-menu{position:relative;margin-left:auto;}
.account-menu-toggle{display:none;}
.account-menu-items{display:flex;align-items:center;gap:18px;}
.account-menu-items #account-tools{display:flex;margin:0;}
.account-menu-items .bar-action{display:inline-flex;align-items:center;min-height:44px;text-decoration:none;white-space:nowrap;}
@media(max-width:760px){
 .bar.account-header{gap:16px;flex-wrap:nowrap;}
 .account-menu-toggle{display:flex;align-items:center;justify-content:center;list-style:none;width:44px;height:44px;cursor:pointer;color:var(--ink);background:transparent;border:1px solid var(--hair);border-radius:4px;padding:10px;}
 .account-menu-toggle svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:1.5;}
 .account-menu-toggle::-webkit-details-marker{display:none;}
 .account-menu-toggle:focus-visible{outline:2px solid var(--ink);outline-offset:3px;}
 .account-menu-items{position:absolute;top:calc(100% + 8px);right:0;z-index:30;display:block;width:230px;max-width:calc(100vw - 40px);padding:6px;background:var(--bg);border:1px solid var(--hair);box-shadow:0 8px 24px #0002;}
 .account-menu-items #account-tools{display:block;}
 .account-menu-items .bar-action{display:flex;width:100%;padding:12px;text-align:left;font-size:13px;letter-spacing:.04em;min-height:44px;}
 .account-menu-items .bar-action:hover{background:var(--hair);}
}


.qr-pdf-download .share-msg:not([data-error="true"]){color:var(--muted);}
