/* ═══════════════════════════════════════════════════════════════════
   Quattro Lead Miner — Dark Sci-Fi Theme
   Deep Blue / Charcoal / Emerald Accent
   ═══════════════════════════════════════════════════════════════════ */

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

:root {
  --bg-primary: #0a0e1a;
  --bg-secondary: #111827;
  --bg-card: #1a2332;
  --bg-hover: #1f2a3f;
  --bg-input: #0d1322;
  --border-color: #2a3a50;
  --border-focus: #3b82f6;
  --text-primary: #e8edf5;
  --text-secondary: #8b9bb5;
  --text-muted: #506380;
  --accent: #10b981;
  --accent-dim: #059669;
  --blue: #3b82f6;
  --blue-dim: #2563eb;
  --verified: #10b981;
  --catchall: #f59e0b;
  --invalid: #ef4444;
  --unverified: #6b7280;
  --radius: 8px;
  --radius-sm: 4px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  --transition: 200ms ease;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

html {
  font-size: 15px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── Scrollbar ─────────────────────────────────────────────── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}
::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ── Navbar ────────────────────────────────────────────────── */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 2rem;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
  gap: 1rem;
  flex-wrap: wrap;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.nav-logo {
  font-size: 2rem;
  color: var(--accent);
  text-shadow: 0 0 20px rgba(16, 185, 129, 0.3);
  line-height: 1;
}

.nav-title h1 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--text-primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.nav-subtitle {
  font-size: 0.7rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 500;
}

/* ── Stats ─────────────────────────────────────────────────── */
.nav-stats {
  display: flex;
  gap: 1.5rem;
}

.stat-item {
  text-align: center;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  min-width: 70px;
}

.stat-item.verified { border-left: 3px solid var(--verified); }
.stat-item.catchall { border-left: 3px solid var(--catchall); }
.stat-item.invalid  { border-left: 3px solid var(--invalid); }

.stat-value {
  font-family: var(--font-mono);
  font-size: 1.15rem;
  font-weight: 700;
  display: block;
  line-height: 1.3;
}

.stat-label {
  font-size: 0.65rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  border: none;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn .icon {
  font-size: 0.9rem;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover {
  background: var(--accent-dim);
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.25);
}

.btn-secondary {
  background: var(--blue);
  color: #fff;
}
.btn-secondary:hover {
  background: var(--blue-dim);
  box-shadow: 0 0 20px rgba(59, 130, 246, 0.25);
}

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

.btn-clear {
  background: transparent;
  color: var(--text-muted);
  border: none;
  padding: 0.25rem 0.5rem;
  font-size: 0.8rem;
}
.btn-clear:hover {
  color: var(--text-primary);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.nav-actions {
  display: flex;
  gap: 0.5rem;
}

/* ── Filter Bar ────────────────────────────────────────────── */
.filter-bar {
  display: flex;
  align-items: flex-end;
  gap: 1rem;
  padding: 1rem 2rem;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  flex-wrap: wrap;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.filter-group label {
  font-size: 0.7rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}

.filter-select,
.filter-input {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  color: var(--text-primary);
  padding: 0.5rem 0.75rem;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  min-width: 160px;
  transition: border-color var(--transition);
}

.filter-select:focus,
.filter-input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.search-group {
  flex: 1;
  min-width: 240px;
}

.search-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 0.75rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  pointer-events: none;
}

.search-wrapper .filter-input {
  padding-left: 2rem;
  padding-right: 2.5rem;
  width: 100%;
}

.search-wrapper .btn-clear {
  position: absolute;
  right: 0.25rem;
}

/* ── Table ─────────────────────────────────────────────────── */
.table-container {
  margin: 1rem 2rem;
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border-color);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.table-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
}

.table-title {
  font-weight: 600;
  font-size: 0.95rem;
}

.table-meta {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-family: var(--font-mono);
}

.table-scroll {
  overflow-x: auto;
  max-height: 65vh;
  overflow-y: auto;
}

.leads-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.leads-table thead {
  position: sticky;
  top: 0;
  z-index: 10;
}

.leads-table th {
  background: var(--bg-secondary);
  padding: 0.65rem 0.75rem;
  text-align: left;
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.leads-table td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid rgba(42, 58, 80, 0.4);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

.leads-table tbody tr {
  transition: background var(--transition);
}

.leads-table tbody tr:hover {
  background: var(--bg-hover);
}

.leads-table tbody tr.selected {
  background: rgba(16, 185, 129, 0.08);
}

.col-select { width: 40px; text-align: center; }
.col-select input { accent-color: var(--accent); }
.col-name { min-width: 130px; }
.col-title { min-width: 140px; }
.col-company { min-width: 150px; }
.col-industry { min-width: 120px; }
.col-email { min-width: 200px; }
.col-phone { min-width: 120px; }
.col-status { min-width: 110px; }
.col-source { min-width: 100px; }

/* ── Badges ────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.6rem;
  border-radius: 99px;
  font-size: 0.75rem;
  font-weight: 500;
}

.badge-verified {
  background: rgba(16, 185, 129, 0.12);
  color: var(--verified);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.badge-catchall {
  background: rgba(245, 158, 11, 0.12);
  color: var(--catchall);
  border: 1px solid rgba(245, 158, 11, 0.2);
}

.badge-invalid {
  background: rgba(239, 68, 68, 0.12);
  color: var(--invalid);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.badge-unverified {
  background: rgba(107, 114, 128, 0.12);
  color: var(--unverified);
  border: 1px solid rgba(107, 114, 128, 0.2);
}

.industry-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 99px;
  background: rgba(59, 130, 246, 0.1);
  color: var(--blue);
  font-size: 0.75rem;
  font-weight: 500;
}

/* ── Pagination ────────────────────────────────────────────── */
.table-footer {
  padding: 0.75rem 1.25rem;
  border-top: 1px solid var(--border-color);
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  flex-wrap: wrap;
}

.page-btn {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.35rem 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all var(--transition);
}

.page-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.page-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.page-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* ── Empty / Loading States ────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 3rem;
  color: var(--text-muted);
}

.empty-state .empty-icon {
  font-size: 3rem;
  margin-bottom: 0.5rem;
  opacity: 0.5;
}

.empty-state h3 {
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 0.25rem;
}

.empty-state p {
  font-size: 0.85rem;
}

.loading-row td {
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
}

/* ── Toast ─────────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast {
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow);
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  animation: slideUp 300ms ease;
  max-width: 400px;
}

.toast-success { border-left: 4px solid var(--verified); }
.toast-error   { border-left: 4px solid var(--invalid); }
.toast-info    { border-left: 4px solid var(--blue); }

@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 900px) {
  .navbar {
    flex-direction: column;
    align-items: stretch;
    padding: 0.75rem 1rem;
  }
  .nav-stats {
    justify-content: center;
  }
  .nav-actions {
    justify-content: center;
  }
  .filter-bar {
    flex-direction: column;
    align-items: stretch;
    padding: 0.75rem 1rem;
  }
  .search-group { min-width: unset; }
  .table-container {
    margin: 0.5rem 0.75rem;
  }
}
