/* =====================================================================
   Sistema de Eventos — Estilo "Liquid Glass"
   Base blanca minimalista · Acentos #0043A1 y #253775
   ===================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@500;600;700;800&family=Inter:wght@400;500;600&display=swap');

:root {
  --primary:      #0043A1;
  --deep:         #253775;
  --primary-soft: rgba(0, 67, 161, 0.10);
  --ink:          #18233a;
  --muted:        #5a6b85;
  --line:         rgba(37, 55, 117, 0.12);

  --bg:           #f6f8fc;
  --glass-bg:     rgba(255, 255, 255, 0.55);
  --glass-strong: rgba(255, 255, 255, 0.72);
  --glass-border: rgba(255, 255, 255, 0.75);

  --radius:       22px;
  --radius-sm:    14px;
  --shadow:       0 18px 50px -18px rgba(37, 55, 117, 0.35);
  --shadow-soft:  0 8px 30px -12px rgba(37, 55, 117, 0.22);

  --font-display: 'Plus Jakarta Sans', system-ui, sans-serif;
  --font-body:    'Inter', system-ui, sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.55;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Atmósfera: manchas suaves de color que el cristal difumina por detrás */
body::before,
body::after {
  content: '';
  position: fixed;
  z-index: -2;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.55;
  pointer-events: none;
}
body::before {
  width: 46vw; height: 46vw;
  top: -14vw; left: -10vw;
  background: radial-gradient(circle at 30% 30%, rgba(0, 67, 161, 0.55), transparent 70%);
}
body::after {
  width: 42vw; height: 42vw;
  bottom: -16vw; right: -8vw;
  background: radial-gradient(circle at 70% 70%, rgba(37, 55, 117, 0.45), transparent 70%);
}

/* ---------------------------------------------------------------------
   Estructura
   --------------------------------------------------------------------- */
.shell {
  max-width: 1080px;
  margin: 0 auto;
  padding: 28px 22px 80px;
}
.shell--narrow { max-width: 620px; }

/* ---------------------------------------------------------------------
   Cristal
   --------------------------------------------------------------------- */
.glass {
  position: relative;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  overflow: hidden;
}
/* Reflejo especular superior, sello del "liquid glass" */
.glass::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 50%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.65), transparent);
  opacity: 0.7;
  pointer-events: none;
}
.glass > * { position: relative; z-index: 1; }

/* ---------------------------------------------------------------------
   Encabezado / barra de navegación
   --------------------------------------------------------------------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 20px;
  margin-bottom: 28px;
  border-radius: var(--radius-sm);
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--deep);
  text-decoration: none;
  letter-spacing: -0.02em;
}
.brand .mark {
  width: 34px; height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--deep));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.4), 0 6px 16px -6px rgba(0,67,161,0.6);
}
.topbar nav { display: flex; align-items: center; gap: 6px; }
.topbar nav a {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  padding: 8px 14px;
  border-radius: 999px;
  transition: color .2s, background .2s;
}
.topbar nav a:hover,
.topbar nav a.active { color: var(--primary); background: var(--primary-soft); }

/* Botón de hamburguesa (oculto en escritorio) */
.nav-toggle {
  display: none;
  width: 42px; height: 42px;
  place-items: center;
  border: 1px solid var(--glass-border);
  background: var(--glass-strong);
  border-radius: 12px;
  color: var(--deep);
  cursor: pointer;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  transition: background .2s, box-shadow .2s;
}
.nav-toggle:hover { box-shadow: var(--shadow-soft); }
.nav-toggle svg { width: 21px; height: 21px; }
.nav-toggle .ic-close { display: none; }
.nav-toggle.is-open .ic-open { display: none; }
.nav-toggle.is-open .ic-close { display: block; }

/* En móvil: el menú se colapsa en la hamburguesa */
@media (max-width: 640px) {
  .topbar { flex-wrap: wrap; }
  .nav-toggle { display: grid; }
  .topbar nav {
    display: flex;
    flex-basis: 100%;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    max-height: 0;
    opacity: 0;
    visibility: hidden;
    overflow: hidden;
    margin-top: 0;
    padding-top: 0;
    border-top: 0 solid var(--line);
    transition: max-height .28s ease, opacity .2s ease,
                margin-top .28s ease, padding-top .28s ease, visibility .28s;
  }
  .topbar nav.open {
    max-height: 360px;
    opacity: 1;
    visibility: visible;
    margin-top: 10px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
  }
  .topbar nav a {
    padding: 12px 14px;
    border-radius: 12px;
    font-size: 0.98rem;
  }
}

/* ---------------------------------------------------------------------
   Tipografía
   --------------------------------------------------------------------- */
h1, h2, h3 { font-family: var(--font-display); letter-spacing: -0.02em; color: var(--ink); }
h1 { font-size: clamp(1.6rem, 4vw, 2.3rem); font-weight: 800; line-height: 1.1; }
h2 { font-size: 1.3rem; font-weight: 700; }
h3 { font-size: 1.05rem; font-weight: 700; }

.eyebrow {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--primary);
  background: var(--primary-soft);
  padding: 5px 12px;
  border-radius: 999px;
  margin-bottom: 14px;
}
.lead { color: var(--muted); font-size: 1.02rem; }
.muted { color: var(--muted); }

/* ---------------------------------------------------------------------
   Botones
   --------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.92rem;
  padding: 12px 22px;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  text-decoration: none;
  transition: transform .15s ease, box-shadow .2s ease, background .2s ease;
  white-space: nowrap;
}
.btn-primary {
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--deep));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.35), 0 10px 24px -10px rgba(0,67,161,0.7);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: inset 0 1px 0 rgba(255,255,255,0.4), 0 16px 30px -10px rgba(0,67,161,0.75); }
.btn-ghost {
  color: var(--deep);
  background: var(--glass-strong);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(10px);
}
.btn-ghost:hover { transform: translateY(-2px); box-shadow: var(--shadow-soft); }
.btn-block { width: 100%; }
.btn-sm { padding: 8px 16px; font-size: 0.84rem; }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }

/* ---------------------------------------------------------------------
   Formularios
   --------------------------------------------------------------------- */
.field { margin-bottom: 18px; }
.field label {
  display: block;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--deep);
  margin-bottom: 7px;
}
.field .hint { font-size: 0.78rem; color: var(--muted); margin-top: 6px; }

.input, textarea.input, select.input {
  width: 100%;
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--ink);
  padding: 12px 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(8px);
  transition: border-color .2s, box-shadow .2s, background .2s;
}
.input::placeholder { color: #9aa6bd; }
.input:focus, textarea.input:focus, select.input:focus {
  outline: none;
  border-color: var(--primary);
  background: rgba(255, 255, 255, 0.85);
  box-shadow: 0 0 0 4px var(--primary-soft);
}
textarea.input { min-height: 110px; resize: vertical; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 560px) { .grid-2 { grid-template-columns: 1fr; } }

/* ---------------------------------------------------------------------
   Mensajes
   --------------------------------------------------------------------- */
.alert {
  padding: 13px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  margin-bottom: 18px;
  border: 1px solid transparent;
}
.alert-error   { background: rgba(214, 40, 57, 0.08);  color: #b4232f; border-color: rgba(214,40,57,0.2); }
.alert-success { background: rgba(0, 128, 96, 0.10);   color: #0a7a5b; border-color: rgba(0,128,96,0.22); }
.alert-info    { background: var(--primary-soft);      color: var(--primary); border-color: rgba(0,67,161,0.2); }

/* ---------------------------------------------------------------------
   Tarjetas de eventos (listado)
   --------------------------------------------------------------------- */
.event-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  margin-top: 24px;
}
.event-card { padding: 22px; display: flex; flex-direction: column; gap: 12px; transition: transform .2s, box-shadow .2s; }
.event-card:hover { transform: translateY(-4px); box-shadow: 0 26px 60px -22px rgba(37,55,117,0.45); }
.event-card .date-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  align-self: flex-start;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--deep);
  background: rgba(255,255,255,0.6);
  border: 1px solid var(--glass-border);
  padding: 5px 12px;
  border-radius: 999px;
}
.event-card h3 { line-height: 1.25; }
.event-card .loc { font-size: 0.86rem; color: var(--muted); display: flex; gap: 6px; align-items: flex-start; }
.event-card .card-actions { margin-top: auto; display: flex; gap: 8px; flex-wrap: wrap; padding-top: 8px; }
.event-card .count {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.4rem;
  color: var(--primary);
}

/* ---------------------------------------------------------------------
   Mapa
   --------------------------------------------------------------------- */
.map {
  width: 100%;
  height: 320px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--glass-border);
  overflow: hidden;
  z-index: 0;
}
.map--tall { height: 380px; }
.leaflet-container { font-family: var(--font-body); }

/* ---------------------------------------------------------------------
   Tabla de asistentes
   --------------------------------------------------------------------- */
.table-wrap { overflow-x: auto; border-radius: var(--radius-sm); }
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
table.data th, table.data td {
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}
table.data th {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--deep);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
table.data tbody tr:hover { background: rgba(255,255,255,0.5); }
table.data td .pill { font-size: 0.78rem; color: var(--muted); }

/* ---------------------------------------------------------------------
   QR
   --------------------------------------------------------------------- */
.qr-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  text-align: center;
}
.qr-frame {
  padding: 18px;
  background: #fff;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-soft);
  border: 1px solid var(--glass-border);
}
.qr-frame canvas, .qr-frame img { display: block; border-radius: 6px; }
.qr-url {
  font-size: 0.8rem;
  color: var(--muted);
  word-break: break-all;
  background: rgba(255,255,255,0.55);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 12px;
  max-width: 320px;
}

/* ---------------------------------------------------------------------
   Utilidades de maquetación
   --------------------------------------------------------------------- */
.section { padding: 26px; margin-bottom: 22px; }
.stack > * + * { margin-top: 16px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.flex { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.meta-list { display: flex; flex-direction: column; gap: 14px; }
.meta-item { display: flex; gap: 12px; align-items: flex-start; }
.meta-item .ic {
  flex: 0 0 auto;
  width: 38px; height: 38px;
  border-radius: 11px;
  display: grid; place-items: center;
  color: var(--primary);
  background: var(--primary-soft);
}
.meta-item .ic svg { width: 18px; height: 18px; }
.meta-item .k { font-size: 0.76rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.meta-item .v { font-weight: 600; color: var(--ink); }

.empty {
  text-align: center;
  padding: 60px 24px;
  color: var(--muted);
}
.empty svg { width: 46px; height: 46px; color: var(--primary); opacity: .6; margin-bottom: 12px; }

.center { text-align: center; }
.mt-0 { margin-top: 0; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.icon { width: 16px; height: 16px; vertical-align: -2px; }

/* ---------------------------------------------------------------------
   Login centrado
   --------------------------------------------------------------------- */
.auth-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.auth-card { width: 100%; max-width: 400px; padding: 34px; }

/* ---------------------------------------------------------------------
   Footer
   --------------------------------------------------------------------- */
.foot {
  text-align: center;
  color: var(--muted);
  font-size: 0.82rem;
  margin-top: 36px;
}

/* ---------------------------------------------------------------------
   Dashboard
   --------------------------------------------------------------------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 18px;
  margin-bottom: 22px;
}
.stat { padding: 20px 22px; display: flex; flex-direction: column; gap: 6px; }
.stat-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.stat-ic {
  width: 40px; height: 40px;
  border-radius: 12px;
  display: grid; place-items: center;
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--deep));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.35), 0 8px 18px -8px rgba(0,67,161,0.6);
}
.stat-ic svg { width: 19px; height: 19px; }
.stat-trend {
  font-size: 0.76rem; font-weight: 700;
  color: #0a7a5b; background: rgba(0,128,96,0.12);
  padding: 3px 9px; border-radius: 999px;
}
.stat-trend.flat { color: var(--muted); background: rgba(37,55,117,0.08); }
.stat-num {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 2.1rem;
  line-height: 1;
  color: var(--deep);
  letter-spacing: -0.03em;
}
.stat-label { font-size: 0.86rem; color: var(--muted); }

.dash-2 {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 22px;
  margin-bottom: 22px;
  align-items: start;
}
@media (max-width: 820px) { .dash-2 { grid-template-columns: 1fr; } }

/* Spotlight del próximo evento */
.spotlight { padding: 24px; display: flex; gap: 22px; align-items: center; flex-wrap: wrap; }
.spotlight .when {
  flex: 0 0 auto;
  width: 84px; height: 84px;
  border-radius: 18px;
  display: grid; place-items: center; text-align: center;
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--deep));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.35), 0 12px 26px -10px rgba(0,67,161,0.65);
}
.spotlight .when .d { font-family: var(--font-display); font-weight: 800; font-size: 1.9rem; line-height: 1; }
.spotlight .when .m { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.1em; opacity: 0.9; }
.spotlight .info { flex: 1; min-width: 200px; }
.spotlight .info h3 { font-size: 1.25rem; margin-bottom: 4px; }

/* Gráfica de registros */
.chart { width: 100%; }
.chart svg { width: 100%; height: auto; display: block; }
.chart .axis-label { font-size: 11px; fill: var(--muted); font-family: var(--font-body); }
.chart .val-label { font-size: 11px; fill: var(--deep); font-weight: 600; font-family: var(--font-display); }

/* Ranking de eventos */
ol.rank { list-style: none; display: flex; flex-direction: column; gap: 14px; }
ol.rank li { display: flex; align-items: center; gap: 12px; }
ol.rank .rank-n {
  flex: 0 0 auto;
  width: 26px; height: 26px;
  border-radius: 8px;
  display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 700; font-size: 0.82rem;
  color: var(--primary); background: var(--primary-soft);
}
ol.rank .rank-body { flex: 1; min-width: 0; }
ol.rank .rank-title {
  font-size: 0.9rem; font-weight: 600; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-bottom: 5px;
}
ol.rank .rank-bar { height: 7px; border-radius: 999px; background: rgba(37,55,117,0.10); overflow: hidden; }
ol.rank .rank-bar span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--primary), var(--deep)); }
ol.rank .rank-val { flex: 0 0 auto; font-family: var(--font-display); font-weight: 800; color: var(--deep); font-size: 1rem; }

/* Entrada suave de las tarjetas */
.rise { animation: rise .5s cubic-bezier(.2,.7,.2,1) both; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.section-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin: 30px 0 4px; }

/* ---------------------------------------------------------------------
   Accesibilidad
   --------------------------------------------------------------------- */
:focus-visible { outline: 3px solid rgba(0,67,161,0.45); outline-offset: 2px; }

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