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

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

:root {
  --bg-primary: #0a0e1a;
  --bg-secondary: #111827;
  --bg-card: rgba(17, 24, 39, 0.8);
  --bg-card-hover: rgba(30, 41, 59, 0.9);
  --bg-glass: rgba(255, 255, 255, 0.03);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(99, 102, 241, 0.3);

  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --accent-purple: #818cf8;
  --accent-blue: #38bdf8;
  --accent-teal: #2dd4bf;
  --accent-pink: #f472b6;
  --accent-orange: #fb923c;

  --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --gradient-blue: linear-gradient(135deg, #38bdf8 0%, #818cf8 100%);
  --gradient-teal: linear-gradient(135deg, #2dd4bf 0%, #38bdf8 100%);
  --gradient-pink: linear-gradient(135deg, #f472b6 0%, #fb923c 100%);

  --status-identified: #10b981;
  --status-verification: #f59e0b;
  --status-notfound: #ef4444;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 30px rgba(99, 102, 241, 0.15);

  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  overflow-x: hidden;
}

/* ========== ANIMATED BACKGROUND ========== */
body::before {
  content: '';
  position: fixed;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at 20% 50%, rgba(99, 102, 241, 0.08) 0%, transparent 50%),
              radial-gradient(circle at 80% 20%, rgba(56, 189, 248, 0.06) 0%, transparent 50%),
              radial-gradient(circle at 40% 80%, rgba(45, 212, 191, 0.05) 0%, transparent 50%);
  animation: bgFloat 20s ease-in-out infinite;
  z-index: -1;
}

@keyframes bgFloat {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  33% { transform: translate(20px, -20px) rotate(1deg); }
  66% { transform: translate(-10px, 10px) rotate(-1deg); }
}

/* ========== LAYOUT ========== */
.app-container {
  display: flex;
  min-height: 100vh;
}

/* ========== SIDEBAR ========== */
.sidebar {
  width: 260px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  padding: 24px 0;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: var(--transition);
}

.sidebar-logo {
  padding: 0 24px 24px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 8px;
}

.sidebar-logo h1 {
  font-size: 18px;
  font-weight: 700;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.5px;
}

.sidebar-logo p {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.sidebar-nav {
  flex: 1;
  padding: 8px 12px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: var(--transition);
  margin-bottom: 4px;
}

.nav-link:hover {
  background: var(--bg-glass);
  color: var(--text-primary);
  transform: translateX(4px);
}

.nav-link.active {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(129, 140, 248, 0.1));
  color: var(--accent-purple);
  border: 1px solid rgba(99, 102, 241, 0.2);
}

.nav-icon {
  font-size: 18px;
  width: 24px;
  text-align: center;
}

/* ========== MAIN CONTENT ========== */
.main-content {
  flex: 1;
  margin-left: 260px;
  padding: 32px;
  min-height: 100vh;
}

.page-header {
  margin-bottom: 32px;
}

.page-header h2 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 6px;
}

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

/* ========== CARDS ========== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: var(--transition);
  backdrop-filter: blur(10px);
}

.card:hover {
  border-color: var(--border-glow);
  box-shadow: var(--shadow-glow);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  border-radius: 3px 3px 0 0;
}

.stat-card.purple::before { background: var(--gradient-primary); }
.stat-card.blue::before { background: var(--gradient-blue); }
.stat-card.teal::before { background: var(--gradient-teal); }
.stat-card.pink::before { background: var(--gradient-pink); }

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-glow);
}

.stat-card .stat-icon {
  font-size: 28px;
  margin-bottom: 12px;
}

.stat-card .stat-value {
  font-size: 36px;
  font-weight: 800;
  letter-spacing: -1px;
  line-height: 1;
}

.stat-card.purple .stat-value { color: var(--accent-purple); }
.stat-card.blue .stat-value { color: var(--accent-blue); }
.stat-card.teal .stat-value { color: var(--accent-teal); }
.stat-card.pink .stat-value { color: var(--accent-pink); }

.stat-card .stat-label {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 6px;
  font-weight: 500;
}

/* ========== STATUS BADGES ========== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.badge.identified {
  background: rgba(16, 185, 129, 0.15);
  color: var(--status-identified);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge.verification {
  background: rgba(245, 158, 11, 0.15);
  color: var(--status-verification);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge.notfound {
  background: rgba(239, 68, 68, 0.15);
  color: var(--status-notfound);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.badge.pending {
  background: rgba(148, 163, 184, 0.15);
  color: var(--text-secondary);
  border: 1px solid rgba(148, 163, 184, 0.3);
}

.badge.verified {
  background: rgba(16, 185, 129, 0.15);
  color: var(--status-identified);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge.rejected {
  background: rgba(239, 68, 68, 0.15);
  color: var(--status-notfound);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
}

.badge.identified .badge-dot { background: var(--status-identified); }
.badge.verification .badge-dot { background: var(--status-verification); }
.badge.notfound .badge-dot { background: var(--status-notfound); }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ========== TABLES ========== */
.table-container {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead {
  background: rgba(99, 102, 241, 0.08);
}

th {
  padding: 14px 16px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border-color);
}

td {
  padding: 14px 16px;
  font-size: 14px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
}

tr:hover td {
  background: var(--bg-glass);
}

tr:last-child td {
  border-bottom: none;
}

/* ========== FORMS ========== */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-control {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  transition: var(--transition);
  outline: none;
}

.form-control:focus {
  border-color: var(--accent-purple);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.form-control::placeholder {
  color: var(--text-muted);
}

select.form-control {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 8.825L1.175 4 2.238 2.938 6 6.7 9.763 2.937 10.825 4z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-right: 40px;
}

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

/* ========== BUTTONS ========== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--gradient-primary);
  color: white;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
  box-shadow: 0 6px 25px rgba(99, 102, 241, 0.5);
  transform: translateY(-2px);
}

.btn-secondary {
  background: var(--bg-glass);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-glow);
}

.btn-success {
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
}

.btn-success:hover {
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
  transform: translateY(-2px);
}

.btn-danger {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: white;
}

.btn-danger:hover {
  box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
  transform: translateY(-2px);
}

.btn-sm {
  padding: 6px 14px;
  font-size: 12px;
  border-radius: var(--radius-sm);
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius-sm);
}

/* ========== MATCH SCORE BAR ========== */
.score-bar-container {
  display: flex;
  align-items: center;
  gap: 10px;
}

.score-bar {
  flex: 1;
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 100px;
  overflow: hidden;
}

.score-bar-fill {
  height: 100%;
  border-radius: 100px;
  transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.score-bar-fill.high { background: var(--gradient-teal); }
.score-bar-fill.medium { background: linear-gradient(135deg, #f59e0b, #fb923c); }
.score-bar-fill.low { background: linear-gradient(135deg, #ef4444, #f472b6); }

.score-value {
  font-size: 14px;
  font-weight: 700;
  min-width: 45px;
  text-align: right;
}

.score-value.high { color: var(--accent-teal); }
.score-value.medium { color: var(--accent-orange); }
.score-value.low { color: var(--accent-pink); }

/* ========== SEARCH QUERIES ========== */
.query-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.query-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.2);
  border-radius: 100px;
  font-size: 12px;
  color: var(--accent-blue);
  font-family: 'JetBrains Mono', monospace;
}

/* ========== CANDIDATE CARDS ========== */
.candidate-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 12px;
  transition: var(--transition);
}

.candidate-card:hover {
  border-color: var(--border-glow);
  box-shadow: var(--shadow-glow);
}

.candidate-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.candidate-source {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: rgba(129, 140, 248, 0.1);
  border-radius: 100px;
  font-size: 11px;
  color: var(--accent-purple);
  font-weight: 600;
}

.candidate-actions {
  display: flex;
  gap: 8px;
}

/* ========== TOAST / NOTIFICATION ========== */
.toast {
  position: fixed;
  top: 24px;
  right: 24px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-md);
  padding: 16px 24px;
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  transform: translateX(120%);
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  max-width: 400px;
}

.toast.show {
  transform: translateX(0);
}

.toast.success {
  border-left: 3px solid var(--status-identified);
}

.toast.error {
  border-left: 3px solid var(--status-notfound);
}

/* ========== LOADING ========== */
.loading-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--accent-purple);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.loading-overlay {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 40px;
  color: var(--text-secondary);
}

/* ========== EMPTY STATE ========== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state .empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state h3 {
  font-size: 18px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.empty-state p {
  font-size: 14px;
}

/* ========== EVIDENCE LINK ========== */
.evidence-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--accent-blue);
  text-decoration: none;
  font-size: 13px;
  transition: var(--transition);
}

.evidence-link:hover {
  color: var(--accent-purple);
  text-decoration: underline;
}

/* ========== MODAL ========== */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 500;
  align-items: center;
  justify-content: center;
}

.modal-overlay.show {
  display: flex;
}

.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 32px;
  width: 90%;
  max-width: 500px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

.modal-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 24px;
}

/* ========== SECTION TITLE ========== */
.section-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ========== FILTER BAR ========== */
.filter-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  align-items: center;
}

.filter-bar .form-control {
  max-width: 220px;
}

/* ========== ANIMATIONS ========== */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-in {
  animation: fadeInUp 0.5s ease forwards;
}

.animate-in:nth-child(1) { animation-delay: 0.05s; }
.animate-in:nth-child(2) { animation-delay: 0.1s; }
.animate-in:nth-child(3) { animation-delay: 0.15s; }
.animate-in:nth-child(4) { animation-delay: 0.2s; }
.animate-in:nth-child(5) { animation-delay: 0.25s; }

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
    padding: 16px;
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .mobile-menu-btn {
    display: flex !important;
  }
}

.mobile-menu-btn {
  display: none;
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 200;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 10px;
  color: var(--text-primary);
  cursor: pointer;
  font-size: 20px;
}

/* ========== UTILITY ========== */
.text-center { text-align: center; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.gap-12 { gap: 12px; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-wrap { flex-wrap: wrap; }
