/* WolfTech LeadGen Intelligence Platform — Premium Dark Theme */

:root {
  --bg-primary: #0a0e17;
  --bg-secondary: #111827;
  --bg-card: #1a1f2e;
  --bg-card-hover: #222840;
  --bg-input: #1e2336;
  --border: #2a3142;
  --border-glow: rgba(99, 102, 241, 0.3);
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent: #6366f1;
  --accent-hover: #818cf8;
  --accent-glow: rgba(99, 102, 241, 0.15);
  --hot: #ef4444;
  --hot-bg: rgba(239, 68, 68, 0.12);
  --warm: #f59e0b;
  --warm-bg: rgba(245, 158, 11, 0.12);
  --cool: #06b6d4;
  --cool-bg: rgba(6, 182, 212, 0.12);
  --cold: #64748b;
  --cold-bg: rgba(100, 116, 139, 0.12);
  --success: #10b981;
  --error: #ef4444;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.4);
  --transition: 200ms cubic-bezier(0.4, 0, 0.2, 1);
}

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

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

/* ===== Navigation ===== */
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 64px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-logo {
  font-size: 24px;
  filter: drop-shadow(0 0 8px rgba(99, 102, 241, 0.5));
}

.nav-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.nav-subtitle {
  font-weight: 400;
  color: var(--accent);
}

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

.nav-tab {
  padding: 8px 16px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}

.nav-tab:hover {
  color: var(--text-primary);
  background: var(--bg-card);
}

.nav-tab.active {
  color: var(--accent);
  background: var(--accent-glow);
}

.nav-status {
  font-size: 13px;
  color: var(--success);
}

/* ===== Views ===== */
.view { display: none; padding: 24px; max-width: 1400px; margin: 0 auto; animation: fadeIn 300ms ease; }
.view.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ===== Dashboard Grid ===== */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  transition: all var(--transition);
}

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

.card.span-2 { grid-column: span 2; }
.card.span-4 { grid-column: span 4; }

.card-title {
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

/* ===== Stat Cards ===== */
.stat-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 24px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  transition: all var(--transition);
  cursor: pointer;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.gradient-blue { background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(59, 130, 246, 0.08)); }
.gradient-fire { background: linear-gradient(135deg, rgba(239, 68, 68, 0.15), rgba(249, 115, 22, 0.08)); }
.gradient-amber { background: linear-gradient(135deg, rgba(245, 158, 11, 0.15), rgba(234, 179, 8, 0.08)); }
.gradient-teal { background: linear-gradient(135deg, rgba(6, 182, 212, 0.15), rgba(20, 184, 166, 0.08)); }

.stat-icon { font-size: 32px; }
.stat-value { font-size: 28px; font-weight: 800; letter-spacing: -0.02em; }
.stat-label { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }

/* ===== Funnel Chart ===== */
.funnel { display: flex; flex-direction: column; gap: 8px; }
.funnel-stage {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-input);
}
.funnel-bar {
  height: 24px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--accent), var(--accent-hover));
  transition: width 500ms ease;
  min-width: 2px;
}
.funnel-label { font-size: 13px; color: var(--text-secondary); min-width: 120px; }
.funnel-count { font-size: 13px; font-weight: 600; color: var(--text-primary); min-width: 70px; text-align: right; }

/* ===== Opportunity Bars ===== */
.opportunity-bars { display: flex; flex-direction: column; gap: 10px; }
.opp-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.opp-label { font-size: 13px; color: var(--text-secondary); min-width: 180px; }
.opp-bar-bg {
  flex: 1;
  height: 20px;
  background: var(--bg-input);
  border-radius: 4px;
  overflow: hidden;
}
.opp-bar {
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, #6366f1, #a78bfa);
  transition: width 500ms ease;
}
.opp-count { font-size: 13px; font-weight: 600; min-width: 50px; text-align: right; }

/* ===== Geo Chart ===== */
.geo-chart { display: flex; flex-direction: column; gap: 12px; }
.geo-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  font-size: 14px;
}
.geo-value { font-weight: 700; color: var(--accent); }

/* ===== Source List ===== */
.source-list { display: flex; flex-direction: column; gap: 8px; max-height: 300px; overflow-y: auto; }
.source-item {
  display: flex;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  font-size: 13px;
}
.source-name { color: var(--text-primary); }
.source-count { color: var(--accent); font-weight: 600; }

/* ===== Filters ===== */
.filters {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.filter-input, .filter-select {
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: all var(--transition);
}

.filter-input { flex: 1; min-width: 250px; }
.filter-input:focus, .filter-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

/* ===== Buttons ===== */
.btn {
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-primary {
  background: var(--accent);
  color: white;
}
.btn-primary:hover { background: var(--accent-hover); transform: translateY(-1px); }

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

/* ===== Results Meta ===== */
.results-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  font-size: 13px;
  color: var(--text-secondary);
}

.pagination { display: flex; gap: 4px; }
.pagination button {
  padding: 6px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
}
.pagination button.active { background: var(--accent); color: white; border-color: var(--accent); }
.pagination button:hover:not(.active) { border-color: var(--accent); }

/* ===== Leads Table ===== */
.leads-table { width: 100%; }

.lead-row {
  display: grid;
  grid-template-columns: 2fr 2fr 80px 100px 140px 100px;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  align-items: center;
  cursor: pointer;
  transition: all var(--transition);
}

.lead-row:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-glow);
  transform: translateX(4px);
}

.lead-row.header {
  background: transparent;
  border: none;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  cursor: default;
}
.lead-row.header:hover { transform: none; background: transparent; }

.lead-domain {
  font-weight: 600;
  color: var(--text-primary);
}

.lead-company {
  color: var(--text-secondary);
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lead-score {
  font-weight: 700;
  font-size: 16px;
}

.tier-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.tier-HOT { background: var(--hot-bg); color: var(--hot); }
.tier-WARM { background: var(--warm-bg); color: var(--warm); }
.tier-COOL { background: var(--cool-bg); color: var(--cool); }
.tier-COLD { background: var(--cold-bg); color: var(--cold); }

.lead-service {
  font-size: 12px;
  color: var(--accent);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lead-geo {
  font-size: 12px;
  color: var(--text-muted);
}

/* ===== Modal ===== */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.modal.active { display: flex; }

.modal-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%;
  max-width: 900px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  position: relative;
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 28px;
  cursor: pointer;
  z-index: 1;
}
.modal-close:hover { color: var(--text-primary); }

.modal-body { padding: 32px; }

.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.detail-domain { font-size: 24px; font-weight: 800; }
.detail-company { font-size: 16px; color: var(--text-secondary); margin-top: 4px; }

.detail-section {
  margin-bottom: 24px;
}

.detail-section h3 {
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
  margin-bottom: 12px;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 8px;
}

.detail-item {
  display: flex;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--bg-input);
  border-radius: 6px;
  font-size: 13px;
}

.detail-key { color: var(--text-secondary); }
.detail-val { color: var(--text-primary); font-weight: 500; }
.detail-val.yes { color: var(--success); }
.detail-val.no { color: var(--error); }

.detail-brief {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 20px;
  font-size: 14px;
  line-height: 1.7;
  white-space: pre-wrap;
}

.opp-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.opp-chip {
  padding: 4px 12px;
  background: var(--accent-glow);
  border: 1px solid var(--accent);
  border-radius: 20px;
  font-size: 12px;
  color: var(--accent-hover);
}

/* ===== Pipeline Monitor ===== */
.pipeline-monitor { max-width: 800px; margin: 0 auto; }
.pipeline-stages { display: flex; flex-direction: column; gap: 12px; }
.pipeline-stage {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.pipeline-num {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-glow);
  border: 1px solid var(--accent);
  border-radius: 50%;
  font-size: 14px;
  font-weight: 700;
  color: var(--accent);
}
.pipeline-info { flex: 1; }
.pipeline-name { font-weight: 600; font-size: 15px; }
.pipeline-desc { font-size: 13px; color: var(--text-secondary); }
.pipeline-count { font-size: 20px; font-weight: 700; color: var(--accent); }

/* ===== Add Form ===== */
.add-form-container {
  max-width: 600px;
  margin: 0 auto;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
}

.add-form-container h2 { margin-bottom: 24px; }

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-group input, .form-group textarea {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: all var(--transition);
}

.form-group input:focus, .form-group textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-group textarea { min-height: 100px; resize: vertical; }

.add-result {
  margin-top: 16px;
  padding: 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  display: none;
}
.add-result.success { display: block; background: rgba(16, 185, 129, 0.1); color: var(--success); }
.add-result.error { display: block; background: rgba(239, 68, 68, 0.1); color: var(--error); }

.loading {
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
  font-size: 14px;
}

/* ===== Responsive ===== */
@media (max-width: 1024px) {
  .dashboard-grid { grid-template-columns: repeat(2, 1fr); }
  .card.span-2 { grid-column: span 2; }
}

@media (max-width: 768px) {
  .dashboard-grid { grid-template-columns: 1fr; }
  .card.span-2 { grid-column: span 1; }
  .nav { flex-wrap: wrap; height: auto; padding: 12px; gap: 8px; }
  .nav-tabs { order: 3; width: 100%; overflow-x: auto; }
  .lead-row { grid-template-columns: 1fr 1fr; }
  .filters { flex-direction: column; }
}

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