/* ==========================================================================
   Invitaciones RANMAN — estilos (mobile first)
   --c1 / --c2 = colores del evento, inyectados por el layout.
   ========================================================================== */

:root {
    --c1: #1F3A5F;
    --c2: #C9A227;
    --ink: #1c2230;
    --muted: #6b7280;
    --radius: 18px;
}

html { -webkit-text-size-adjust: 100%; }
body { color: var(--ink); }

/* ---------- Botones de marca ---------- */
.btn-brand {
    --bs-btn-color: #fff;
    --bs-btn-bg: var(--c1);
    --bs-btn-border-color: var(--c1);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: var(--c1);
    --bs-btn-hover-border-color: var(--c1);
    --bs-btn-active-bg: var(--c1);
    --bs-btn-active-color: #fff;
    --bs-btn-disabled-bg: var(--c1);
    --bs-btn-disabled-border-color: var(--c1);
    font-weight: 600;
    letter-spacing: .02em;
}
.btn-brand:hover { filter: brightness(1.1); }
.btn-outline-brand {
    --bs-btn-color: var(--c1);
    --bs-btn-border-color: var(--c1);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: var(--c1);
    --bs-btn-hover-border-color: var(--c1);
    --bs-btn-active-bg: var(--c1);
    --bs-btn-active-color: #fff;
    font-weight: 600;
}
.btn-lg { min-height: 52px; }

/* ---------- Páginas públicas ---------- */
body.public {
    background: linear-gradient(180deg, var(--c1) 0, var(--c1) 240px, #f3f4f6 240px);
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}
.public-main {
    width: 100%;
    max-width: 560px;
    margin: 0 auto;
    padding: max(16px, env(safe-area-inset-top)) 14px 24px;
    flex: 1;
}
.public-footer { text-align: center; font-size: .75rem; color: var(--muted); padding: 12px 0 max(16px, env(safe-area-inset-bottom)); }

.evento-hero {
    color: #fff;
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 14px;
}
.evento-hero-body { padding: 4px 4px 0; }
.evento-logo { max-height: 56px; max-width: 180px; object-fit: contain; margin-bottom: 10px; }
.evento-kicker { text-transform: uppercase; letter-spacing: .12em; font-size: .72rem; opacity: .85; margin: 0 0 4px; }
.evento-titulo { font-size: 1.6rem; font-weight: 700; line-height: 1.15; margin: 0 0 10px; }
.evento-datos { list-style: none; padding: 0; margin: 0 0 8px; font-size: .95rem; }
.evento-datos li { display: flex; gap: 8px; align-items: baseline; margin-bottom: 2px; }
.evento-datos .ico { width: 1.2em; text-align: center; }
.evento-descripcion { font-size: .9rem; opacity: .9; margin: 6px 0 0; }

.card-registro {
    background: #fff;
    border-radius: var(--radius);
    padding: 22px 18px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, .12);
}
.card-login { margin-top: 8vh; }
.card-registro .form-control-lg, .card-registro .form-select-lg { font-size: 1rem; min-height: 50px; } /* 16px evita zoom en iOS */

.estado-icono {
    width: 72px; height: 72px; border-radius: 50%;
    margin: 0 auto 12px; display: flex; align-items: center; justify-content: center;
    font-size: 1.8rem; font-weight: 700; color: #fff;
}
.estado-verde { background: #16a34a; }
.estado-ambar { background: #d97706; }
.estado-rojo { background: #dc2626; }

/* ---------- Invitación ---------- */
.invitacion-wrap { padding-top: 4px; }
.invitacion-card {
    background: #fff;
    border-radius: 22px;
    overflow: hidden;
    box-shadow: 0 16px 40px rgba(15, 23, 42, .18);
    text-align: center;
}
.inv-banda { background: var(--c1); padding: 20px 16px; min-height: 76px; display: flex; align-items: center; justify-content: center; border-bottom: 5px solid var(--c2); }
.inv-logo { max-height: 60px; max-width: 70%; object-fit: contain; }
.inv-marca { color: #fff; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.inv-cuerpo { padding: 20px 20px 8px; }
.inv-kicker { text-transform: uppercase; letter-spacing: .3em; font-size: .72rem; color: var(--c2); font-weight: 700; margin: 0 0 4px; }
.inv-evento { font-size: 1.5rem; font-weight: 800; color: var(--c1); line-height: 1.15; margin: 0 0 16px; }
.inv-para { margin: 0 0 16px; display: flex; flex-direction: column; gap: 2px; }
.inv-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); }
.inv-nombre { font-size: 1.35rem; }
.inv-pase { font-size: .9rem; color: var(--muted); }
.inv-detalles {
    display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px;
    text-align: left; background: #f8fafc; border-radius: 14px; padding: 14px; margin: 0 0 18px;
}
.inv-detalles div { min-width: 0; }
.inv-detalles .inv-full { grid-column: 1 / -1; }
.inv-detalles dt { font-size: .68rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 600; }
.inv-detalles dd { margin: 0; font-weight: 600; font-size: .92rem; overflow-wrap: anywhere; }
.inv-qr { margin: 0 auto 12px; }
.inv-qr img { width: 220px; height: 220px; max-width: 100%; image-rendering: pixelated; border: 1px solid #e5e7eb; border-radius: 12px; }
.inv-qr p { font-size: .82rem; color: var(--muted); margin: 6px 0 0; }
.inv-mensaje { font-size: .92rem; color: #374151; margin: 0 0 12px; }
.inv-pie { background: #f1f5f9; font-size: .78rem; color: var(--muted); padding: 10px; }

.inv-acciones { display: grid; gap: 10px; margin-top: 18px; }

.inv-preview { position: fixed; inset: 0; background: rgba(15, 23, 42, .75); z-index: 1050; display: flex; align-items: center; justify-content: center; padding: 16px; }
.inv-preview-box { background: #fff; border-radius: 16px; padding: 16px; max-width: 420px; width: 100%; max-height: 92vh; overflow: auto; text-align: center; }
.inv-preview-box img { width: 100%; border-radius: 12px; box-shadow: 0 4px 14px rgba(0, 0, 0, .15); -webkit-touch-callout: default; }

@media print {
    body.public { background: #fff !important; }
    .inv-acciones, .public-footer, .alert, .inv-preview { display: none !important; }
    .public-main { max-width: 100%; padding: 0; }
    .invitacion-card { box-shadow: none; border: 1px solid #ddd; max-width: 480px; margin: 0 auto; }
    .invitacion-card, .inv-banda, .inv-detalles, .inv-pie { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ---------- Panel administrativo ---------- */
body.admin { background: #f3f4f6; --c1: #1F3A5F; }
.bg-admin { background: #1F3A5F; }
.form-card { max-width: 640px; }
.img-preview { max-height: 56px; max-width: 140px; object-fit: contain; background: #f1f5f9; border-radius: 8px; padding: 4px; }
.link-card { border-left: 5px solid var(--c1); }

.stats-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.stats-grid .stat:first-child { grid-column: 1 / -1; }
.stat { background: #fff; border-radius: 12px; padding: 12px 14px; border: 1px solid #e5e7eb; border-top: 4px solid var(--bs-secondary); }
.stat-primary { border-top-color: var(--bs-primary); }
.stat-success { border-top-color: var(--bs-success); }
.stat-warning { border-top-color: var(--bs-warning); }
.stat-danger { border-top-color: var(--bs-danger); }
.stat-valor { font-size: 1.7rem; font-weight: 700; line-height: 1.1; }
.stat-label { font-size: .7rem; letter-spacing: .08em; color: var(--muted); font-weight: 600; }
@media (min-width: 768px) {
    .stats-grid { grid-template-columns: repeat(5, 1fr); }
    .stats-grid .stat:first-child { grid-column: auto; }
}

/* ---------- Check-in ---------- */
body.checkin { background: #0f172a; color: #fff; min-height: 100vh; min-height: 100dvh; }
.checkin-top {
    display: flex; justify-content: space-between; align-items: center;
    padding: max(10px, env(safe-area-inset-top)) 14px 10px; background: #020617;
}
.checkin-eventos { padding: 18px 14px; max-width: 560px; margin: 0 auto; }
.checkin-evento-btn {
    width: 100%; text-align: left; border: 1px solid #334155; background: #1e293b; color: #fff;
    border-radius: 14px; padding: 16px; display: flex; flex-direction: column; gap: 4px;
}
.checkin-evento-btn.hoy { border-color: #22c55e; }
.checkin-evento-btn .nombre { font-weight: 700; font-size: 1.05rem; }
.checkin-evento-btn .meta { font-size: .85rem; color: #94a3b8; }

.scanner { max-width: 560px; margin: 0 auto; padding: 10px 12px 24px; }
.scanner-evento { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; }
.scanner-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 10px; text-align: center; }
.scanner-stats div { background: #1e293b; border-radius: 12px; padding: 8px 4px; }
.scanner-stats span { display: block; font-size: 1.5rem; font-weight: 700; }
.scanner-stats small { color: #94a3b8; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; }
.scanner-view { position: relative; background: #000; border-radius: 16px; overflow: hidden; aspect-ratio: 1 / 1; }
#reader { width: 100%; height: 100%; }
#reader video { object-fit: cover; width: 100% !important; height: 100% !important; }
.scanner-placeholder { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 20px; }
.scanner-controls { display: flex; gap: 8px; justify-content: center; margin: 10px 0; }
.scanner-historial li { display: flex; justify-content: space-between; gap: 8px; padding: 8px 10px; border-radius: 10px; background: #1e293b; margin-bottom: 6px; font-size: .9rem; }
.scanner-historial li .h { color: #94a3b8; font-variant-numeric: tabular-nums; }
.scanner-historial li.ok { border-left: 4px solid #22c55e; }
.scanner-historial li.warn { border-left: 4px solid #f59e0b; }
.scanner-historial li.error { border-left: 4px solid #ef4444; }

.resultado {
    position: fixed; inset: 0; z-index: 2000; display: flex; flex-direction: column; align-items: center; justify-content: center;
    text-align: center; padding: 24px; color: #fff; background: #334155; cursor: pointer;
}
.resultado.ok { background: #15803d; }
.resultado.warn { background: #b45309; }
.resultado.error { background: #b91c1c; }
.resultado-estatico { position: static; min-height: calc(100dvh - 60px); cursor: default; }
.resultado-icono { font-size: 5rem; line-height: 1; font-weight: 700; }
.resultado-titulo { font-size: 1.8rem; font-weight: 800; letter-spacing: .03em; margin-top: 8px; }
.resultado-nombre { font-size: 1.6rem; font-weight: 600; margin-top: 18px; }
.resultado-detalle { font-size: 1.25rem; margin-top: 10px; line-height: 1.5; font-variant-numeric: tabular-nums; }
.resultado-mensaje { font-size: 1rem; margin-top: 12px; opacity: .9; max-width: 420px; }
.resultado-barra { width: 60%; max-width: 280px; height: 5px; background: rgba(255, 255, 255, .25); border-radius: 3px; margin-top: 26px; overflow: hidden; }
.resultado-barra span { display: block; height: 100%; width: 0; background: #fff; }
.resultado-barra span.run { animation: barra var(--dur, 2500ms) linear forwards; }
@keyframes barra { from { width: 0; } to { width: 100%; } }

@media (min-width: 576px) {
    .card-registro { padding: 28px; }
    .evento-titulo { font-size: 2rem; }
}
