/* TickEvent — Estilos principales */
@import url('https://fonts.googleapis.com/css2?family=Sora:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --primary:     #0ea5e9;
  --primary-dark:#0284c7;
  --accent:      #f97316;
  --success:     #22c55e;
  --warning:     #eab308;
  --danger:      #ef4444;
  --bg:          #0f172a;
  --bg-card:     #1e293b;
  --bg-sidebar:  #0f172a;
  --border:      #334155;
  --text:        #e2e8f0;
  --text-muted:  #94a3b8;
  --sidebar-w:   260px;
}

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

body {
  font-family: 'Sora', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 14px;
}

/* ── SIDEBAR ── */
.sidebar {
  position: fixed; top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  z-index: 1000;
  transition: transform .3s ease;
}
.sidebar-brand {
  padding: 24px 20px 20px;
  border-bottom: 1px solid var(--border);
}
.sidebar-brand .logo-text {
  font-size: 22px; font-weight: 700; color: var(--primary);
  letter-spacing: -0.5px;
}
.sidebar-brand .logo-sub {
  font-size: 11px; color: var(--text-muted); margin-top: 2px;
}
.sidebar-nav { flex: 1; padding: 16px 0; overflow-y: auto; }
.nav-section-label {
  font-size: 10px; font-weight: 600; letter-spacing: 1.2px;
  color: var(--text-muted); text-transform: uppercase;
  padding: 12px 20px 6px;
}
.sidebar-nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 20px; color: var(--text-muted);
  text-decoration: none; font-size: 13.5px; font-weight: 500;
  border-left: 3px solid transparent;
  transition: all .2s;
}
.sidebar-nav a:hover, .sidebar-nav a.active {
  color: var(--text); background: rgba(14,165,233,.08);
  border-left-color: var(--primary);
}
.sidebar-nav a .nav-icon { width: 18px; text-align: center; font-size: 15px; }
.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
}
.user-info { display: flex; align-items: center; gap: 10px; }
.user-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--primary); display: flex; align-items: center;
  justify-content: center; font-weight: 700; font-size: 13px; color: #fff;
  flex-shrink: 0;
}
.user-name { font-size: 13px; font-weight: 600; }
.user-role { font-size: 11px; color: var(--text-muted); }

/* ── MAIN CONTENT ── */
.main-content {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  padding: 0;
}
.topbar {
  height: 56px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; position: sticky; top: 0; z-index: 100;
}
.topbar-title { font-size: 16px; font-weight: 600; }
.hamburger {
  display: none; background: none; border: none;
  color: var(--text); font-size: 20px; cursor: pointer;
}
.page-body { padding: 24px; }

/* ── CARDS ── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  font-weight: 600; font-size: 14px;
  display: flex; align-items: center; gap: 8px;
}
.card-body { padding: 20px; }

/* ── STAT CARDS ── */
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  display: flex; align-items: center; gap: 16px;
}
.stat-icon {
  width: 48px; height: 48px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center; font-size: 22px;
}
.stat-icon.blue  { background: rgba(14,165,233,.15); color: var(--primary); }
.stat-icon.green { background: rgba(34,197,94,.15);  color: var(--success); }
.stat-icon.orange{ background: rgba(249,115,22,.15); color: var(--accent);  }
.stat-icon.purple{ background: rgba(168,85,247,.15); color: #a855f7; }
.stat-value { font-size: 28px; font-weight: 700; line-height: 1; }
.stat-label { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* ── FORMS ── */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 12px; font-weight: 600; color: var(--text-muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .5px; }
.form-control, .form-select {
  width: 100%; padding: 10px 14px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text); font-family: inherit; font-size: 14px;
  transition: border-color .2s;
}
.form-control:focus, .form-select:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(14,165,233,.15);
}
.form-select option { background: var(--bg-card); }

/* ── BOTONES ── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 18px; border-radius: 8px; border: none;
  font-family: inherit; font-size: 13.5px; font-weight: 600;
  cursor: pointer; text-decoration: none; transition: all .2s;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: #fff; }
.btn-danger  { background: var(--danger);  color: #fff; }
.btn-secondary { background: var(--border); color: var(--text); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-outline {
  background: transparent; border: 1px solid var(--border); color: var(--text);
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }

/* ── TABLAS ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--border); }
th { font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .6px; }
tr:hover td { background: rgba(255,255,255,.02); }

/* ── BADGES ── */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 600;
}
.badge-success { background: rgba(34,197,94,.15);  color: var(--success); }
.badge-danger  { background: rgba(239,68,68,.15);  color: var(--danger);  }
.badge-warning { background: rgba(234,179,8,.15);  color: var(--warning); }
.badge-info    { background: rgba(14,165,233,.15); color: var(--primary); }
.badge-muted   { background: rgba(148,163,184,.15);color: var(--text-muted); }

/* ── ALERTS ── */
.alert {
  padding: 12px 16px; border-radius: 8px; font-size: 13.5px;
  margin-bottom: 16px; display: flex; align-items: flex-start; gap: 10px;
}
.alert-success { background: rgba(34,197,94,.1);  border: 1px solid rgba(34,197,94,.3);  color: #86efac; }
.alert-danger  { background: rgba(239,68,68,.1);  border: 1px solid rgba(239,68,68,.3);  color: #fca5a5; }
.alert-warning { background: rgba(234,179,8,.1);  border: 1px solid rgba(234,179,8,.3);  color: #fde047; }
.alert-info    { background: rgba(14,165,233,.1); border: 1px solid rgba(14,165,233,.3); color: #7dd3fc; }

/* ── ESCÁNER QR ── */
.scanner-container {
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  position: relative;
}
.scanner-overlay {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none; z-index: 10;
}
.scan-frame {
  width: 220px; height: 220px;
  border: 2px solid var(--primary);
  border-radius: 12px;
  box-shadow: 0 0 0 4000px rgba(0,0,0,.5);
  position: relative;
}
.scan-frame::before {
  content: '';
  position: absolute; top: -1px; left: -1px; right: -1px;
  height: 3px; background: var(--primary);
  animation: scan-line 2s linear infinite;
  border-radius: 2px;
}
@keyframes scan-line {
  0%   { top: 0; }
  50%  { top: calc(100% - 3px); }
  100% { top: 0; }
}
#reader { width: 100% !important; border: none !important; }
#reader video { width: 100% !important; object-fit: cover; }

/* ── RESULTADO VALIDACIÓN ── */
.result-card {
  border-radius: 16px; padding: 24px; text-align: center;
  transition: all .4s ease;
}
.result-card.success { background: rgba(34,197,94,.1);  border: 2px solid var(--success); }
.result-card.danger  { background: rgba(239,68,68,.1);  border: 2px solid var(--danger); }
.result-card.warning { background: rgba(234,179,8,.1);  border: 2px solid var(--warning); }
.result-icon { font-size: 56px; line-height: 1; margin-bottom: 12px; }
.result-name { font-size: 20px; font-weight: 700; margin-bottom: 4px; }
.result-rut  { font-family: 'JetBrains Mono', monospace; color: var(--text-muted); }

/* ── UPLOAD ZONE ── */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: 12px; padding: 40px 20px;
  text-align: center; cursor: pointer;
  transition: all .2s; color: var(--text-muted);
}
.upload-zone:hover, .upload-zone.dragover {
  border-color: var(--primary); color: var(--primary);
  background: rgba(14,165,233,.05);
}
.upload-icon { font-size: 40px; margin-bottom: 12px; }

/* ── LOGIN ── */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--bg);
  background-image: radial-gradient(ellipse 80% 50% at 50% -20%, rgba(14,165,233,.15), transparent);
}
.login-card {
  width: 100%; max-width: 400px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px; padding: 40px;
}
.login-logo { text-align: center; margin-bottom: 32px; }
.login-logo .tick { font-size: 36px; }
.login-logo .brand { font-size: 28px; font-weight: 700; color: var(--primary); }

/* ── PROGRESS BAR ── */
.progress { background: var(--border); border-radius: 4px; height: 6px; overflow: hidden; }
.progress-bar { height: 100%; background: var(--primary); border-radius: 4px; transition: width .3s; }

/* ── MOBILE ── */
.sidebar-backdrop {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.6); z-index: 999;
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .sidebar-backdrop.show { display: block; }
  .main-content { margin-left: 0; }
  .hamburger { display: flex; }
  .page-body { padding: 16px; }
  .stat-grid { grid-template-columns: 1fr 1fr !important; }
  .hide-mobile { display: none !important; }
}

/* ── UTILIDADES ── */
.grid { display: grid; }
.g-2  { gap: 8px; }
.g-3  { gap: 12px; }
.g-4  { gap: 16px; }
.g-5  { gap: 20px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.mb-5 { margin-bottom: 20px; }
.text-muted   { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.text-primary { color: var(--primary); }
.text-center  { text-align: center; }
.text-sm { font-size: 12px; }
.font-mono { font-family: 'JetBrains Mono', monospace; }
.fw-600 { font-weight: 600; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.w-100 { width: 100%; }
.rounded { border-radius: 8px; }
