:root {
  /* Ocean/Neon Dark Theme */
  --bg-color: #050b14;
  --panel-bg: rgba(13, 22, 45, 0.4);
  --panel-border: rgba(0, 229, 255, 0.15);
  --panel-border-hover: rgba(0, 229, 255, 0.3);
  --card-bg: rgba(10, 16, 34, 0.6);
  
  --text-main: #f0f8ff;
  --text-muted: #849bb4;
  --text-dim: #4B637E;
  
  --primary: #00e5ff;
  --primary-glow: rgba(0, 229, 255, 0.25);
  --secondary: #bd00ff;
  --green: #00ff88;
  --green-glow: rgba(0, 255, 136, 0.2);
  --red: #ff3366;
  --red-glow: rgba(255, 51, 102, 0.2);
  --amber: #ffaa00;
  --amber-glow: rgba(255, 170, 0, 0.2);

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 20px;
  --sidebar-w: 260px;
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  min-height: 100vh;
  font-family: 'Outfit', -apple-system, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  position: relative;
}

/* Background Animated Circles */
.circles-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}
.circle {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.4;
  animation: float 20s infinite alternate;
}
.circle-1 {
  width: 500px;
  height: 500px;
  background: var(--primary);
  top: -10%;
  left: -10%;
  animation-delay: 0s;
}
.circle-2 {
  width: 600px;
  height: 600px;
  background: var(--secondary);
  bottom: -20%;
  right: -10%;
  animation-delay: -5s;
}
.circle-3 {
  width: 300px;
  height: 300px;
  background: var(--green);
  top: 40%;
  left: 50%;
  opacity: 0.15;
  animation-delay: -10s;
}

@keyframes float {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(5%, 10%) scale(1.1); }
  100% { transform: translate(-5%, 5%) scale(0.9); }
}

img, video { display: block; max-width: 100%; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; outline: none; }
.hidden { display: none !important; }

/* ── Typography & Gradients ── */
.gradient-text, .text-gradient {
  background: linear-gradient(135deg, #fff, var(--primary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline-block;
}

/* ── Glassmorphism Utils ── */
.glass-panel {
  background: var(--panel-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--panel-border);
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.4);
}
.glass-panel-inner {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius);
}
.glass-card {
  background: var(--card-bg);
  backdrop-filter: blur(8px);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02);
}

/* ── Animations ── */
.fade-in { animation: fadeIn 0.4s ease forwards; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Layout ── */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

/* ── Sidebar ── */
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 24px 20px;
  z-index: 10;
  border-right: 1px solid var(--panel-border);
  border-radius: 0;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 4px 28px;
  margin-bottom: 12px;
  position: relative;
}
.sidebar-brand::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--panel-border), transparent);
}

.brand-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: grid;
  place-items: center;
  color: white;
  flex-shrink: 0;
  box-shadow: 0 4px 20px rgba(0,229,255,0.4);
}

.brand-text { display: flex; flex-direction: column; }
.brand-name { font-size: 1.25rem; font-weight: 700; letter-spacing: 0.02em; }
.brand-sub { font-size: 0.75rem; color: var(--text-muted); font-weight: 500; }

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}

.nav-item:hover { color: var(--text-main); background: rgba(255, 255, 255, 0.05); }

.nav-item.active {
  color: var(--primary);
  background: var(--primary-glow);
  box-shadow: inset 0 0 0 1px rgba(0, 229, 255, 0.2);
}

.sidebar-status {
  padding: 12px;
  margin-top: 20px;
}
.status-dot-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
}
.status-text { transition: color 0.3s; }
.status-indicator {
  position: relative;
  width: 10px;
  height: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.status-dot {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--text-dim);
  transition: background var(--transition);
}
.status-ping {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--text-dim);
  opacity: 0.6;
}
.status-indicator.online .status-dot { background: var(--green); box-shadow: 0 0 8px var(--green); }
.status-indicator.online .status-ping { background: var(--green); animation: ping 2s cubic-bezier(0, 0, 0.2, 1) infinite; }
.status-indicator.offline .status-dot { background: var(--red); box-shadow: 0 0 8px var(--red); }
.status-indicator.offline .status-ping { background: var(--red); animation: ping 1s cubic-bezier(0, 0, 0.2, 1) infinite; }

@keyframes ping {
  75%, 100% { transform: scale(2.5); opacity: 0; }
}

/* ── Main Content ── */
.content {
  padding: 40px;
  overflow-y: auto;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

.screen { display: none; }
.screen.active-screen { display: flex; flex-direction: column; gap: 32px; }

.screen-header h1 { font-size: 2.2rem; font-weight: 800; letter-spacing: -0.02em; }
.screen-subtitle { color: var(--text-muted); margin-top: 6px; font-size: 1rem; }

/* ── Stats Row ── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 24px;
}

.stat-icon {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  position: relative;
}
.stat-icon.blue-glow { background: rgba(0, 229, 255, 0.1); color: var(--primary); box-shadow: 0 0 20px rgba(0,229,255,0.2); border: 1px solid rgba(0,229,255,0.3); }
.stat-icon.green-glow { background: rgba(0, 255, 136, 0.1); color: var(--green); box-shadow: 0 0 20px rgba(0,255,136,0.2); border: 1px solid rgba(0,255,136,0.3); }

.stat-value { display: block; font-size: 1.8rem; font-weight: 700; }
.stat-label { font-size: 0.85rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; margin-top: 4px; display: block; }

/* ── Quick Actions ── */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
}

.action-card {
  text-align: left;
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 20px;
  border-color: transparent !important;
  transition: transform 0.3s, box-shadow 0.3s, background 0.3s;
  position: relative;
  overflow: hidden;
}
.action-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, rgba(0, 229, 255, 0.3), rgba(189, 0, 255, 0.1));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}
.action-card:hover {
  transform: translateY(-4px);
  background: rgba(20, 28, 50, 0.8);
  box-shadow: 0 12px 40px rgba(0,0,0,0.5), 0 0 20px rgba(0, 229, 255, 0.15);
}

.action-icon-wrap {
  width: 50px;
  height: 50px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  display: grid;
  place-items: center;
  color: var(--primary);
}

.action-content strong { display: block; font-size: 1.1rem; font-weight: 600; margin-bottom: 4px; }
.action-content span { font-size: 0.85rem; color: var(--text-muted); }

.action-arrow {
  margin-left: auto;
  color: var(--text-dim);
  transition: transform 0.3s, color 0.3s;
}
.action-card:hover .action-arrow {
  transform: translateX(5px);
  color: var(--primary);
}

/* ── Panel Header & Lists ── */
.panel { padding: 30px; border-radius: var(--radius-lg); }
.panel-header { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; border-bottom: 1px solid rgba(255,255,255,0.05); padding-bottom: 16px; }
.panel-header h2, .panel-title { font-size: 1.25rem; font-weight: 600; letter-spacing: 0.01em; }

.badge {
  background: var(--primary-glow);
  color: var(--primary);
  border: 1px solid rgba(0, 229, 255, 0.3);
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 700;
}

.people-list { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }

.person-card {
  display: flex;
  align-items: center;
  padding: 16px;
  gap: 16px;
  transition: transform 0.2s, background 0.2s, border-color 0.2s;
}
.person-card:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: var(--panel-border-hover);
  transform: translateY(-2px);
}

.person-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(0,229,255,0.1);
  color: var(--primary);
  display: grid;
  place-items: center;
  border: 1px solid rgba(0,229,255,0.2);
}

.person-name { font-weight: 600; font-size: 0.95rem; }
.person-meta { font-size: 0.8rem; color: var(--text-muted); margin-top: 2px; }

.btn-delete {
  margin-left: auto;
  color: var(--text-dim);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  transition: all 0.2s;
}
.btn-delete:hover {
  background: var(--red-glow);
  color: var(--red);
}

.empty-state { text-align: center; padding: 40px 20px; color: var(--text-muted); grid-column: 1 / -1; }
.empty-state svg { color: var(--text-dim); margin-bottom: 12px; }
.empty-state p { font-size: 1.1rem; font-weight: 500; color: var(--text-main); }

/* ── Forms ── */
.form-layout { display: flex; flex-direction: column; gap: 24px; }
.form-group { display: flex; flex-direction: column; gap: 10px; }
.form-group > label { font-size: 0.9rem; font-weight: 500; color: var(--text-muted); }

input[type="text"] {
  background: rgba(0,0,0,0.2);
  border: 1px solid rgba(255,255,255,0.1);
  color: white;
  padding: 14px 18px;
  border-radius: var(--radius);
  font-size: 1rem;
  transition: border-color 0.3s, box-shadow 0.3s;
}
input[type="text"]:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

/* Source Tabs */
.source-tabs { display: flex; border-radius: var(--radius); padding: 4px; gap: 4px; }
.source-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px;
  border-radius: calc(var(--radius) - 2px);
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.9rem;
  transition: all 0.3s;
}
.source-tab:hover:not(.active) { color: var(--text-main); background: rgba(255,255,255,0.05); }
.source-tab.active { background: rgba(255,255,255,0.1); color: white; box-shadow: 0 2px 10px rgba(0,0,0,0.2); }
.source-tab.active svg { color: var(--primary); }

/* Droppers */
.drop-zone {
  position: relative;
  height: 240px;
  border: 2px dashed rgba(255,255,255,0.15);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  overflow: hidden;
  background: rgba(0,0,0,0.1);
}
.drop-zone:hover, .drop-zone.dragover {
  border-color: var(--primary);
  background: var(--primary-glow);
}
.file-input { position: absolute; inset: 0; opacity: 0; cursor: pointer; z-index: 10; }
.drop-zone-content { text-align: center; pointer-events: none; z-index: 2; }
.drop-icon {
  width: 60px;
  height: 60px;
  margin: 0 auto 16px;
  background: rgba(255,255,255,0.05);
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--text-muted);
}
.drop-zone:hover .drop-icon { color: var(--primary); background: rgba(0,229,255,0.1); transform: scale(1.05); transition: 0.3s; }
.preview-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 5; }

/* Camera */
.camera-viewport {
  position: relative;
  height: 320px;
  background: #000;
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}
.camera-viewport video { width: 100%; height: 100%; object-fit: cover; }
.camera-still { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 5; }
.camera-overlay { position: absolute; text-align: center; color: var(--text-dim); }
.camera-overlay svg { margin-bottom: 15px; opacity: 0.7; }
.scanner-overlay {
  position: absolute;
  inset: 10%;
  border: 2px solid var(--primary);
  border-radius: 20px;
  z-index: 3;
  box-shadow: 0 0 20px rgba(0,229,255,0.3), inset 0 0 20px rgba(0,229,255,0.3);
}
.scanner-overlay::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--primary);
  box-shadow: 0 0 10px var(--primary);
  animation: scan 2.5s infinite linear;
}
@keyframes scan { 0% { top: 0; } 50% { top: 100%; } 100% { top: 0; } }

.camera-controls { display: flex; gap: 12px; margin-top: 16px; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 20px;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 600;
  transition: all 0.3s;
  flex: 1;
}
.btn:disabled { opacity: 0.5; pointer-events: none; }
.btn-primary { background: white; color: black; }
.btn-primary:active { transform: scale(0.98); }
.glow-button {
  background: linear-gradient(135deg, var(--primary), #0099ff);
  color: white;
  border: none;
  box-shadow: 0 4px 15px var(--primary-glow);
}
.glow-button:hover:not(:disabled) { box-shadow: 0 6px 25px rgba(0,229,255,0.4); transform: translateY(-2px); }
.btn-secondary { background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.1); }
.btn-secondary:hover:not(:disabled) { background: rgba(255,255,255,0.15); border-color: rgba(255,255,255,0.2); }
.btn-ghost { background: transparent; border: 1px solid rgba(255,255,255,0.1); color: var(--text-muted); }
.btn-ghost:hover:not(:disabled) { border-color: var(--text-main); color: white; }

/* Grid Verify */
.verify-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; align-items: stretch; }

.result-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px;
  transition: all 0.4s ease;
}
.result-icon-container { position: relative; margin-bottom: 20px; }
.result-icon {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255,255,255,0.05);
  color: var(--text-dim);
  transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.result-tag {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  padding: 6px 16px;
  border-radius: 20px;
  background: rgba(255,255,255,0.1);
  color: var(--text-dim);
  margin-bottom: 16px;
}
.result-panel h3 { font-size: 1.8rem; font-weight: 800; margin-bottom: 8px; }
.result-panel p { color: var(--text-muted); max-width: 80%; }

.result-panel.matched { border-color: rgba(0, 255, 136, 0.3); box-shadow: inset 0 0 80px rgba(0,255,136,0.05); }
.result-panel.matched .result-icon { background: var(--green-glow); color: var(--green); transform: scale(1.1); box-shadow: 0 0 30px var(--green-glow); }
.result-panel.matched .result-tag { background: var(--green-glow); color: var(--green); }

.result-panel.unmatched { border-color: rgba(255, 170, 0, 0.3); }
.result-panel.unmatched .result-icon { background: var(--amber-glow); color: var(--amber); }
.result-panel.unmatched .result-tag { background: var(--amber-glow); color: var(--amber); }

.result-panel.error { border-color: rgba(255, 51, 102, 0.3); }
.result-panel.error .result-icon { background: var(--red-glow); color: var(--red); }
.result-panel.error .result-tag { background: var(--red-glow); color: var(--red); }

/* Toasts */
.toast-container { position: fixed; bottom: 24px; right: 24px; display: flex; flex-direction: column; gap: 10px; z-index: 1000; }
.toast {
  padding: 16px 20px;
  border-radius: var(--radius);
  background: rgba(20, 25, 40, 0.95);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.1);
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  color: white;
  font-size: 0.95rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 12px;
  animation: slideIn 0.3s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}
.toast.success { border-left: 4px solid var(--green); }
.toast.error { border-left: 4px solid var(--red); }
.toast.fadeOut { animation: slideOut 0.3s cubic-bezier(0.2, 0.8, 0.2, 1) forwards; }

@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes slideOut { from { transform: translateX(0); opacity: 1; } to { transform: translateX(100%); opacity: 0; } }

/* Loaders */
.loader-wave { display: flex; gap: 5px; height: 30px; align-items: center; justify-content: center; padding: 20px; }
.wave-bar { width: 4px; height: 100%; background: var(--primary); border-radius: 2px; animation: wave 1s infinite ease-in-out; }
.wave-bar:nth-child(2) { animation-delay: 0.1s; background: var(--secondary); }
.wave-bar:nth-child(3) { animation-delay: 0.2s; background: var(--primary); }
@keyframes wave { 0%, 100% { height: 30%; } 50% { height: 100%; box-shadow: 0 0 10px var(--primary); } }

/* Utility Margins */
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }

/* Responsive */
@media (max-width: 960px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; bottom: 0; left: 0; right: 0; height: auto; top: auto; flex-direction: row; align-items: center; padding: 12px 16px; border-right: none; border-top: 1px solid var(--panel-border); background: rgba(5, 11, 20, 0.9); z-index: 100; justify-content: center; }
  .sidebar-brand, .sidebar-status { display: none; }
  .sidebar-nav { flex-direction: row; width: auto; gap: 10px; }
  .nav-item span { display: none; }
  .nav-item { padding: 14px; border-radius: 12px; }
  .content { padding: 24px 20px 100px; }
  .verify-grid { grid-template-columns: 1fr; }
}
@media (max-width: 500px) {
  .stats-row { grid-template-columns: 1fr; }
  .camera-controls { flex-wrap: wrap; }
  .camera-controls .btn { width: 100%; flex: 100%; }
}
