/* ============================================================
   SISTEMA DE ASISTENCIA BIOMÉTRICA — Estilos globales
   Paleta enterprise, touch-friendly, responsive (360px+)
   ============================================================ */

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

/* ── Variables ─────────────────────────────────────────────── */
:root {
  --primary:        #1a56db;
  --primary-dark:   #1e429f;
  --primary-light:  #e8f0fe;
  --success:        #0f9f6e;
  --success-light:  #def7ec;
  --warning:        #c27803;
  --warning-light:  #fdf6b2;
  --error:          #e02424;
  --error-light:    #fde8e8;
  --info:           #1c64f2;
  --info-light:     #e1effe;

  --bg:             #f3f4f6;
  --surface:        #ffffff;
  --surface-alt:    #f9fafb;
  --text-primary:   #111928;
  --text-secondary: #6b7280;
  --text-muted:     #9ca3af;
  --border:         #e5e7eb;
  --border-dark:    #d1d5db;

  --radius:         8px;
  --radius-lg:      12px;
  --radius-xl:      16px;
  --shadow:         0 1px 3px rgba(0,0,0,0.10), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md:      0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
  --shadow-lg:      0 10px 15px rgba(0,0,0,0.08), 0 4px 6px rgba(0,0,0,0.05);

  --navbar-h:       60px;
  --font:           'Inter', system-ui, -apple-system, sans-serif;
}

/* ── Reset & Base ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; -webkit-tap-highlight-color: transparent; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text-primary);
  min-height: 100vh;
  padding-top: var(--navbar-h);
  line-height: 1.5;
}

/* ── Navbar ────────────────────────────────────────────────── */
.navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--navbar-h);
  background: var(--primary);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 8px;
  z-index: 100;
  box-shadow: var(--shadow-md);
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  margin-right: auto;
}

.navbar-brand svg { flex-shrink: 0; }

.nav-links {
  display: flex;
  gap: 4px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: var(--radius);
  color: rgba(255,255,255,0.80);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
  min-height: 40px;
}

.nav-link:hover { background: rgba(255,255,255,0.12); color: #fff; }
.nav-link.active { background: rgba(255,255,255,0.20); color: #fff; }

/* ── Main Container ────────────────────────────────────────── */
.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 20px 16px 32px;
}

.page-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 20px;
}

/* ── Cards ─────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  overflow: hidden;
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.card-body { padding: 20px; }

/* ── Botones ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  min-height: 48px;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s, opacity 0.15s;
  text-decoration: none;
  white-space: nowrap;
  -webkit-user-select: none;
  user-select: none;
}

.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); }

.btn-success { background: var(--success); color: #fff; }
.btn-success:hover:not(:disabled) { background: #0a7a54; }

.btn-danger { background: var(--error); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #c81e1e; }

.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 1.5px solid var(--primary);
}
.btn-outline:hover:not(:disabled) { background: var(--primary-light); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}
.btn-ghost:hover:not(:disabled) { background: var(--bg); }

.btn-sm { padding: 8px 14px; min-height: 36px; font-size: 13px; }
.btn-lg { padding: 16px 28px; min-height: 56px; font-size: 17px; font-weight: 600; }
.btn-full { width: 100%; }

/* ── Spinner ────────────────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2.5px solid rgba(255,255,255,0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}
.spinner-dark {
  border-color: rgba(26,86,219,0.3);
  border-top-color: var(--primary);
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Formularios ────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-group:last-child { margin-bottom: 0; }

label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

input[type="text"],
input[type="date"],
input[type="number"],
select {
  display: block;
  width: 100%;
  padding: 11px 14px;
  min-height: 48px;
  background: var(--surface);
  border: 1.5px solid var(--border-dark);
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 15px;
  color: var(--text-primary);
  transition: border-color 0.15s, box-shadow 0.15s;
  -webkit-appearance: none;
  appearance: none;
}

input:focus, select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,86,219,0.12);
}

input::placeholder { color: var(--text-muted); }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 480px) { .form-row { grid-template-columns: 1fr; } }

/* ── Tablas ─────────────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

thead th {
  padding: 10px 14px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  background: var(--surface-alt);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--surface-alt); }

/* ── Badges ─────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 600;
}

.badge-success { background: var(--success-light); color: #065f46; }
.badge-warning { background: var(--warning-light); color: #92400e; }
.badge-error   { background: var(--error-light);   color: #9b1c1c; }
.badge-info    { background: var(--info-light);     color: #1e40af; }

/* ── Toast ──────────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}

.toast {
  padding: 12px 20px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  color: #fff;
  box-shadow: var(--shadow-lg);
  min-width: 240px;
  max-width: min(420px, calc(100vw - 32px));
  text-align: center;
  animation: toast-in 0.25s ease;
  pointer-events: auto;
}

.toast-success { background: var(--success); }
.toast-error   { background: var(--error); }
.toast-warning { background: var(--warning); }
.toast-info    { background: var(--info); }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.toast.fade-out {
  animation: toast-out 0.3s ease forwards;
}

@keyframes toast-out {
  to { opacity: 0; transform: translateY(8px); }
}

/* ── Empty State ────────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
}

.empty-icon {
  width: 56px;
  height: 56px;
  background: var(--bg);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  color: var(--text-muted);
}

.empty-state p { color: var(--text-secondary); font-size: 14px; }

/* ── Search Box ─────────────────────────────────────────────── */
.search-wrap {
  position: relative;
}

.search-wrap input {
  padding-left: 40px;
}

.search-wrap .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

/* ── Status Panel ───────────────────────────────────────────── */
.status-panel {
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 15px;
  font-weight: 500;
  transition: all 0.3s ease;
}

.status-panel.success { background: var(--success-light); color: #065f46; }
.status-panel.error   { background: var(--error-light);   color: #9b1c1c; }
.status-panel.warning { background: var(--warning-light); color: #92400e; }
.status-panel.info    { background: var(--info-light);    color: #1e40af; }
.status-panel.idle    { background: var(--bg);            color: var(--text-secondary); }

.status-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.status-panel.success .status-icon { background: #d1fae5; }
.status-panel.error   .status-icon { background: #fee2e2; }
.status-panel.warning .status-icon { background: #fef9c3; }
.status-panel.info    .status-icon { background: #dbeafe; }
.status-panel.idle    .status-icon { background: #e5e7eb; }

/* ── Fingerprint Preview ────────────────────────────────────── */
.fp-preview-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.fp-circle {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  border: 3px dashed var(--border-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-alt);
  overflow: hidden;
  transition: border-color 0.3s;
  flex-shrink: 0;
}

.fp-circle.has-image {
  border-style: solid;
  border-color: var(--primary);
}

.fp-circle img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.fp-circle .fp-placeholder {
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}

.quality-bar-wrap {
  width: 140px;
}

.quality-label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.quality-bar {
  height: 6px;
  border-radius: 99px;
  background: var(--border);
  overflow: hidden;
}

.quality-bar-fill {
  height: 100%;
  border-radius: 99px;
  background: var(--success);
  transition: width 0.4s ease;
}

.quality-bar-fill.mid  { background: var(--warning); }
.quality-bar-fill.low  { background: var(--error); }

/* ── Summary Card ───────────────────────────────────────────── */
.summary-card {
  background: var(--primary);
  color: #fff;
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.summary-number {
  font-size: 40px;
  font-weight: 700;
  line-height: 1;
}

.summary-label { font-size: 14px; opacity: 0.85; margin-top: 4px; }

/* ── Date range row ─────────────────────────────────────────── */
.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
}

.filter-row .form-group { margin-bottom: 0; flex: 1; min-width: 140px; }

/* ── Enrollment steps ───────────────────────────────────────── */
.sample-dots {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.sample-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--border-dark);
  background: transparent;
  transition: background 0.2s, border-color 0.2s;
}

.sample-dot.captured { background: var(--success); border-color: var(--success); }
.sample-dot.current  { border-color: var(--primary); }

/* ── Responsive helpers ─────────────────────────────────────── */
.hidden { display: none !important; }

@media (max-width: 600px) {
  .navbar-brand span { display: none; }
  .nav-link span { display: none; }
  .nav-link { padding: 8px; }
}
