/* ── La Gran Tambora — Styles ─────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;600;700;900&family=Crimson+Pro:ital,wght@0,300;0,400;0,600;1,400&family=DM+Sans:wght@300;400;500;600&display=swap');

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

:root {
  --bg:       #0c0b09;
  --bg2:      #111009;
  --bg3:      #191710;
  --card:     #141209;
  --border:   #2a2518;
  --gold:     #c9920a;
  --gold2:    #e8a90d;
  --gold3:    #f5c842;
  --gold-dim: rgba(201,146,10,.12);
  --muted:    #6b6045;
  --text:     #e8dfc8;
  --green:    #4caf6e;
  --red:      #e05a5a;
  --sidebar-w: 220px;
  --rt-w:      300px;
  --radius:    12px;
}

html, body { height: 100%; }
body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  overflow-x: hidden;
}

/* ── SIDEBAR ─────────────────────────────────────────────── */
.sidebar {
  position: fixed; top: 0; left: 0;
  width: var(--sidebar-w); height: 100vh;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  z-index: 100;
  transition: transform .3s ease;
  
}

.sidebar-logo {
  display: flex; align-items: center; gap: 10px;
  padding: 24px 20px 20px;
  border-bottom: 1px solid var(--border);
}
.logo-crown {
  font-size: 26px; color: var(--gold);
  text-shadow: 0 0 20px rgba(201,146,10,.5);
  line-height: 1;
}
.logo-small {
  font-family: 'Cinzel', serif;
  font-size: 9px; letter-spacing: 3px; color: var(--muted);
  line-height: 1; margin-bottom: 2px;
}
.logo-big {
  font-family: 'Cinzel', serif;
  font-size: 18px; font-weight: 900; letter-spacing: 2px;
  color: var(--gold);
  text-shadow: 0 0 30px rgba(201,146,10,.4);
  line-height: 1;
}

.sidebar-nav { padding: 16px 0; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 11px 18px; cursor: pointer;
  color: var(--muted); font-size: 13px; font-weight: 500;
  border-radius: 9px; margin: 2px 10px;
  transition: all .2s; text-decoration: none;
  letter-spacing: .3px;
}
.nav-item svg { width: 17px; height: 17px; flex-shrink: 0; }
.nav-item:hover { color: var(--text); background: var(--bg3); }
.nav-item.active {
  color: var(--gold);
  background: var(--gold-dim);
  border: 1px solid rgba(201,146,10,.2);
}

.sidebar-event-card {
  margin: 8px 12px 0;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.event-label {
  font-family: 'Cinzel', serif;
  font-size: 9px; letter-spacing: 2px; color: var(--muted);
  margin-bottom: 8px;
}
.event-icon { color: var(--gold); margin-bottom: 6px; }
.event-icon svg { width: 18px; height: 18px; }
.event-name {
  font-family: 'Cinzel', serif;
  font-size: 14px; font-weight: 700; color: var(--gold);
  margin-bottom: 6px;
}
.event-date-label { font-size: 11px; color: var(--muted); }
.event-date { font-size: 13px; color: var(--gold2); font-weight: 500; }

.export-btn {
  display: flex; align-items: center; gap: 8px;
  margin: 12px 12px 20px;
  padding: 11px 16px; border-radius: 9px;
  background: transparent;
  border: 1px solid rgba(201,146,10,.35);
  color: var(--gold); font-family: inherit; font-size: 13px;
  cursor: pointer; transition: all .2s;
}
.export-btn:hover { background: var(--gold-dim); border-color: var(--gold); }

/* ── REALTIME PANEL ──────────────────────────────────────── */
.rt-panel {
  position: fixed; top: 0; right: 0;
  width: var(--rt-w); height: 100vh;
  background: var(--bg2);
  border-left: 1px solid var(--border);
  display: flex; flex-direction: column;
  z-index: 90; padding: 24px 0 0;
  overflow: hidden;
}
.rt-panel-hdr {
  display: flex; align-items: center; gap: 8px;
  font-family: 'Cinzel', serif;
  font-size: 11px; letter-spacing: 1.5px; color: var(--muted);
  padding: 0 20px 16px;
  border-bottom: 1px solid var(--border);
}
.rt-icon { color: var(--gold); }
.rt-list { flex: 1;  padding: 12px 0; }
.rt-empty { color: var(--muted); text-align: center; padding: 24px; font-size: 13px; }

.rt-item {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid rgba(42,37,24,.6);
  transition: background .2s;
  animation: rtSlideIn .3s ease;
}
@keyframes rtSlideIn { from{opacity:0;transform:translateY(-8px)} to{opacity:1;transform:none} }
.rt-item:hover { background: rgba(201,146,10,.04); }

.rt-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; font-size: 11px; font-weight: 700;
}
.rt-avatar.acceso { background: rgba(76,175,110,.15); border: 1px solid rgba(76,175,110,.3); color: var(--green); }
.rt-avatar.registro { background: var(--gold-dim); border: 1px solid rgba(201,146,10,.3); color: var(--gold); }
.rt-avatar svg { width: 16px; height: 16px; }

.rt-info { flex: 1; min-width: 0; }
.rt-name { font-weight: 600; font-size: 13px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rt-action-ok  { font-size: 12px; color: var(--green); font-weight: 500; }
.rt-action-reg { font-size: 12px; color: var(--gold);  font-weight: 500; }
.rt-sucursal   { font-size: 11px; color: var(--muted); }
.rt-time { font-size: 11px; color: var(--muted); white-space: nowrap; }

.ver-todas-btn {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  margin: 0; padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: none; border-bottom: none; border-left: none; border-right: none;
  color: var(--gold); font-family: inherit; font-size: 13px;
  cursor: pointer; transition: color .2s;
}
.ver-todas-btn:hover { color: var(--gold3); }

/* ── MAIN ────────────────────────────────────────────────── */
.main {
  margin-left: var(--sidebar-w);
  margin-right: var(--rt-w);
  min-height: 100vh;
  padding: 28px;
}

.page { display: none; animation: fadeIn .3s ease; }
.page.active { display: block; }
@keyframes fadeIn { from{opacity:0;transform:translateY(6px)} to{opacity:1;transform:none} }

/* ── HERO ────────────────────────────────────────────────── */
.page-hero {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 24px; position: relative;
}
.hero-title {
  font-family: 'Cinzel', serif;
  font-size: 28px; font-weight: 700; color: var(--text);
  margin-bottom: 4px;
}
.hero-sub { color: var(--muted); font-size: 13px; }
.hero-right { text-align: right; }
.live-pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: 'Cinzel', serif;
  font-size: 11px; letter-spacing: 1.5px; color: var(--green);
  font-weight: 600;
}
.live-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--green); display: inline-block;
  animation: pulse 2s infinite;
}
@keyframes pulse { 0%,100%{opacity:1;transform:scale(1)} 50%{opacity:.4;transform:scale(1.4)} }
.live-sub { font-size: 11px; color: var(--muted); margin-top: 4px; }

.hero-drum {
  position: absolute; right: -10px; top: -20px;
  width: 110px; height: 110px;
  background: radial-gradient(ellipse at 40% 40%, rgba(201,146,10,.25) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

/* ── STAT CARDS ──────────────────────────────────────────── */
.stats-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.stat-icon-wrap {
  width: 44px; height: 44px; border-radius: 12px;
  border: 1px solid rgba(201,146,10,.25);
  background: var(--gold-dim);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 12px;
}
.stat-icon-wrap svg { width: 22px; height: 22px; color: var(--gold); }
.stat-label {
  font-family: 'Cinzel', serif;
  font-size: 9px; letter-spacing: 1.5px; color: var(--muted);
  margin-bottom: 6px;
}
.stat-number {
  font-family: 'Cinzel', serif;
  font-size: 42px; font-weight: 900; color: var(--text);
  line-height: 1; margin-bottom: 4px;
}
.stat-number.gold { color: var(--gold2); }
.stat-desc { font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.stat-change {
  display: flex; align-items: center; gap: 4px;
  color: var(--green); font-size: 12px; font-weight: 600;
}

/* ── MID ROW ─────────────────────────────────────────────── */
.mid-row { display: grid; grid-template-columns: 1fr 280px; gap: 14px; margin-bottom: 14px; }

.chart-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
}
.chart-card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.chart-card-title {
  font-family: 'Cinzel', serif;
  font-size: 10px; letter-spacing: 1.5px; color: var(--muted);
}
.period-select {
  display: flex; align-items: center; gap: 5px;
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: 7px; padding: 5px 10px;
  font-size: 12px; color: var(--text); cursor: pointer;
}
.chart-wrap { position: relative; height: 200px; }
.chart-wrap canvas { position: absolute; inset: 0; width: 100% !important; height: 100% !important; }

.donut-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
  display: flex; flex-direction: column; align-items: center;
}
.donut-center-wrap {
  position: relative; margin: 16px auto;
  width: 160px; height: 160px;
}
.donut-label {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
}
.donut-num {
  font-family: 'Cinzel', serif;
  font-size: 28px; font-weight: 900; color: var(--gold2);
  line-height: 1;
}
.donut-sub { font-size: 11px; color: var(--muted); }
.donut-legend { width: 100%; }
.legend-item {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--muted);
  padding: 5px 0; border-bottom: 1px solid rgba(42,37,24,.5);
}
.legend-item:last-child { border-bottom: none; }
.legend-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.gold-dot { background: var(--gold2); }
.grey-dot { background: #2e2a20; }
.legend-val { margin-left: auto; font-weight: 600; color: var(--text); }

/* ── BOTTOM ROW ──────────────────────────────────────────── */
.bottom-row { margin-bottom: 14px; }
.metrics-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.metric-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
  display: flex; gap: 16px; align-items: flex-start;
}
.metric-icon {
  width: 44px; height: 44px; border-radius: 12px;
  background: var(--gold-dim); border: 1px solid rgba(201,146,10,.2);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.metric-icon svg { width: 20px; height: 20px; color: var(--gold); }
.metric-icon.clock { background: rgba(201,146,10,.08); }
.metric-label {
  font-family: 'Cinzel', serif;
  font-size: 8.5px; letter-spacing: 1.5px; color: var(--muted);
  margin-bottom: 4px;
}
.metric-big {
  font-family: 'Cinzel', serif;
  font-size: 28px; font-weight: 900; color: var(--text);
  line-height: 1; margin-bottom: 4px;
}
.metric-big.gold { color: var(--gold2); }
.metric-sub { font-size: 11px; color: var(--muted); margin-bottom: 8px; }
.metric-bar-wrap {
  height: 4px; background: var(--bg3); border-radius: 2px;
  margin-top: 6px;
}
.metric-bar {
  height: 100%; background: linear-gradient(90deg, var(--gold), var(--gold3));
  border-radius: 2px; transition: width .6s ease;
}

.auto-update-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 16px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 12px; color: var(--muted);
}
.auto-update-bar svg { color: var(--gold); }

/* ── REGISTROS / TABLAS ──────────────────────────────────── */
.toolbar {
  display: flex; gap: 12px; margin-bottom: 16px; flex-wrap: wrap;
}
.search-box {
  flex: 1; display: flex; align-items: center; gap: 8px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 9px; padding: 0 14px;
}
.search-box svg { width: 15px; height: 15px; color: var(--muted); flex-shrink: 0; }
.search-box input {
  flex: 1; background: none; border: none; outline: none;
  color: var(--text); font-family: inherit; font-size: 13px; padding: 11px 0;
}
.search-box input::placeholder { color: var(--muted); }

.btn-gold {
  display: flex; align-items: center; gap: 7px;
  padding: 10px 18px; border-radius: 9px;
  background: var(--gold); color: #0c0b09;
  font-family: inherit; font-size: 13px; font-weight: 700;
  border: none; cursor: pointer; white-space: nowrap;
  transition: background .2s;
}
.btn-gold:hover { background: var(--gold2); }

.btn-ghost {
  padding: 10px 18px; border-radius: 9px;
  background: transparent; border: 1px solid var(--border);
  color: var(--text); font-family: inherit; font-size: 13px;
  cursor: pointer; transition: border-color .2s;
}
.btn-ghost:hover { border-color: var(--gold); }

.table-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
}
.realtime-hdr {
  display: flex; align-items: center; gap: 8px;
  font-family: 'Cinzel', serif;
  font-size: 10px; letter-spacing: 1.5px; color: var(--muted);
  margin-bottom: 16px;
}
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th {
  text-align: left; font-size: 11px; font-weight: 500;
  color: var(--muted); padding: 0 0 12px;
  border-bottom: 1px solid var(--border);
  font-family: 'Cinzel', serif; letter-spacing: .5px;
}
tbody tr { border-bottom: 1px solid rgba(42,37,24,.5); }
tbody tr:last-child { border-bottom: none; }
tbody td { padding: 12px 0; font-size: 13px; }
.td-empty { text-align: center; color: var(--muted); padding: 28px 0 !important; }

.qr-chip {
  font-family: monospace; font-size: 12px; font-weight: 700;
  background: var(--gold-dim); color: var(--gold);
  padding: 2px 8px; border-radius: 5px; letter-spacing: 1px;
}
.badge-ok {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 5px;
  background: rgba(76,175,110,.1); color: var(--green);
  font-size: 11px; font-weight: 600;
}
.badge-deny {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 5px;
  background: rgba(224,90,90,.1); color: var(--red);
  font-size: 11px; font-weight: 600;
}
.btn-icon {
  background: none; border: none; cursor: pointer;
  color: var(--muted); padding: 4px; border-radius: 5px;
  transition: all .15s;
}
.btn-icon:hover { color: var(--gold); background: var(--gold-dim); }
.btn-icon.danger:hover { color: var(--red); background: rgba(224,90,90,.1); }

.pager { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.pager-info { color: var(--muted); font-size: 12px; }
.pager-btn {
  background: var(--bg3); border: 1px solid var(--border);
  color: var(--text); padding: 6px 14px; border-radius: 7px;
  cursor: pointer; font-family: inherit; font-size: 12px;
  transition: border-color .2s;
}
.pager-btn:hover { border-color: var(--gold); }
.pager-btn:disabled { opacity: .35; cursor: default; }

/* ── SCAN ────────────────────────────────────────────────── */
.scan-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.qr-input-row { display: flex; gap: 8px; }
.qr-input {
  flex: 1; background: var(--bg3); border: 1px solid var(--border);
  border-radius: 9px; padding: 11px 14px;
  color: var(--text); font-family: monospace; font-size: 16px;
  letter-spacing: 3px; text-transform: uppercase; outline: none;
  transition: border-color .2s;
}
.qr-input:focus { border-color: var(--gold); }
.form-group { margin-top: 14px; }
.form-label { display: block; font-size: 11px; color: var(--muted); margin-bottom: 6px; letter-spacing: .5px; }
.form-input, .form-select {
  width: 100%; background: var(--bg3); border: 1px solid var(--border);
  border-radius: 9px; padding: 11px 14px;
  color: var(--text); font-family: inherit; font-size: 13px; outline: none;
  transition: border-color .2s;
}
.form-input:focus, .form-select:focus { border-color: var(--gold); }
.scan-result { margin-top: 16px; padding: 16px; border-radius: 9px; }
.scan-result.ok   { background: rgba(76,175,110,.1);  border: 1px solid rgba(76,175,110,.3); }
.scan-result.fail { background: rgba(224,90,90,.1);   border: 1px solid rgba(224,90,90,.3);  }

/* ── MODAL ───────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.75); backdrop-filter: blur(4px);
  z-index: 200; display: none; align-items: center; justify-content: center; padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 16px; width: 100%; max-width: 460px;
  animation: slideUp .25s ease;
}
@keyframes slideUp { from{opacity:0;transform:translateY(20px)} to{opacity:1;transform:none} }
.modal-hdr {
  padding: 20px 22px 16px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-hdr h2 {
  font-family: 'Cinzel', serif;
  font-size: 16px; font-weight: 700; color: var(--gold);
}
.modal-body { padding: 20px 22px; }
.modal-footer {
  padding: 16px 22px; border-top: 1px solid var(--border);
  display: flex; gap: 10px; justify-content: flex-end;
}

/* ── TOAST ───────────────────────────────────────────────── */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 300; display: flex; flex-direction: column; gap: 8px; }
.toast {
  padding: 11px 18px; border-radius: 9px;
  font-size: 13px; font-weight: 500; min-width: 200px;
  animation: toastIn .3s ease;
}
.toast.ok   { background: rgba(76,175,110,.15);  border: 1px solid rgba(76,175,110,.4);  color: var(--green); }
.toast.err  { background: rgba(224,90,90,.15);   border: 1px solid rgba(224,90,90,.4);   color: var(--red); }
.toast.info { background: var(--gold-dim);        border: 1px solid rgba(201,146,10,.3);  color: var(--gold2); }
@keyframes toastIn { from{opacity:0;transform:translateX(20px)} to{opacity:1;transform:none} }

/* ── MOBILE ──────────────────────────────────────────────── */
.mobile-topbar {
  display: none;
  position: fixed; top: 0; left: 0; right: 0; height: 56px;
  background: var(--bg2); border-bottom: 1px solid var(--border);
  align-items: center; justify-content: space-between;
  padding: 0 16px; z-index: 100;
}
.mobile-logo { display: flex; align-items: center; gap: 8px; }
.burger, .bell-btn {
  background: none; border: none; cursor: pointer;
  color: var(--text); padding: 6px;
}
.burger svg, .bell-btn svg { width: 20px; height: 20px; display: block; }
.overlay-bg {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.6); z-index: 99;
}
.overlay-bg.show { display: block; }

/* ── RESPONSIVE ──────────────────────────────────────────── */
@media (max-width: 1200px) {
  .rt-panel { display: none; }
  .main { margin-right: 0; }
}
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: none; }
  .main { margin-left: 0; padding: 16px; padding-top: 72px; }
  .mobile-topbar { display: flex; }
  .mid-row { grid-template-columns: 1fr; }
  .stats-row { grid-template-columns: 1fr; }
  .metrics-row { grid-template-columns: 1fr; }
  .scan-grid { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .toolbar { flex-direction: column; }
}
