/* ── Huntwire App Styles ─────────────────────────────────────── */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --ink: #0a0a0a;
  --ink-light: #111111;
  --ink-card: #161616;
  --smoke: #f5f3f0;
  --smoke-dim: #e8e4df;
  --ember: #ff5722;
  --ember-glow: #ff7a50;
  --ember-dim: rgba(255, 87, 34, 0.15);
  --slate: #6b6b6b;
  --wire: #2a2a2a;
  --border: #1e1e1e;
  --success: #22c55e;
  --success-dim: rgba(34, 197, 94, 0.15);
  --warning: #f59e0b;
  --warning-dim: rgba(245, 158, 11, 0.15);
  --info: #3b82f6;
  --info-dim: rgba(59, 130, 246, 0.15);
  --danger: #ef4444;
  --danger-dim: rgba(239, 68, 68, 0.15);
  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 14px;
  --transition: 0.2s ease;
  --sidebar-width: 240px;
}

body {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--ink);
  color: var(--smoke-dim);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── Layout ──────────────────────────────────────────────────── */
.app-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-width);
  background: var(--ink);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  transition: transform var(--transition);
}

.sidebar-logo {
  padding: 24px 24px 32px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--smoke);
  letter-spacing: -0.5px;
  text-decoration: none;
  display: block;
}

.sidebar-logo span { color: var(--ember); }

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

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 16px;
  border-radius: var(--radius);
  color: var(--slate);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  margin-bottom: 2px;
}

.nav-item:hover { color: var(--smoke-dim); background: rgba(255,255,255,0.04); }
.nav-item.active { color: var(--smoke); background: var(--ember-dim); }
.nav-item.active svg { color: var(--ember); }
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
  color: var(--slate);
}

.sidebar-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--ember-dim);
  color: var(--ember);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.75rem;
  font-family: 'Space Grotesk', sans-serif;
}

.sidebar-user-name { color: var(--smoke-dim); font-weight: 500; }
.sidebar-user-email { font-size: 0.78rem; color: var(--slate); }

.logout-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--slate);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.78rem;
  margin-top: 10px;
  transition: all var(--transition);
  width: 100%;
}

.logout-btn:hover { border-color: var(--danger); color: var(--danger); }

.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
}

.page-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 40px 40px 60px;
}

/* ── Typography ──────────────────────────────────────────────── */
.page-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--smoke);
  letter-spacing: -0.5px;
  margin-bottom: 8px;
}

.page-subtitle {
  font-size: 0.95rem;
  color: var(--slate);
  margin-bottom: 32px;
}

h3 {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  color: var(--smoke);
}

/* ── Cards ───────────────────────────────────────────────────── */
.card {
  background: var(--ink-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: border-color var(--transition);
}

.card:hover { border-color: #2a2a2a; }

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.card-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  color: var(--smoke);
}

/* ── Stats Grid ──────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--ink-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
}

.stat-card-label {
  font-size: 0.78rem;
  color: var(--slate);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  margin-bottom: 8px;
}

.stat-card-value {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 2rem;
  font-weight: 700;
  color: var(--smoke);
  letter-spacing: -1px;
}

.stat-card-value.ember { color: var(--ember); }

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.88rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--ember);
  color: white;
}
.btn-primary:hover { background: var(--ember-glow); transform: translateY(-1px); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-secondary {
  background: transparent;
  color: var(--smoke-dim);
  border: 1px solid var(--border);
}
.btn-secondary:hover { border-color: var(--slate); color: var(--smoke); }

.btn-ghost {
  background: transparent;
  color: var(--slate);
  padding: 8px 14px;
}
.btn-ghost:hover { color: var(--smoke-dim); background: rgba(255,255,255,0.04); }

.btn-danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--danger);
}
.btn-danger:hover { background: var(--danger-dim); }

.btn-sm {
  padding: 6px 14px;
  font-size: 0.82rem;
}

.btn-xs {
  padding: 4px 10px;
  font-size: 0.78rem;
}

/* ── Forms ────────────────────────────────────────────────────── */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--smoke-dim);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 11px 16px;
  background: var(--ink);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--smoke-dim);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.92rem;
  transition: border-color var(--transition);
  outline: none;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--ember);
}

.form-input::placeholder, .form-textarea::placeholder {
  color: #444;
}

.form-select {
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%236b6b6b' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

.form-select option {
  background: var(--ink);
  color: var(--smoke-dim);
}

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

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

.form-hint {
  font-size: 0.78rem;
  color: var(--slate);
  margin-top: 4px;
}

/* ── Badges ──────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.badge-new { background: var(--info-dim); color: var(--info); }
.badge-contacted { background: var(--warning-dim); color: var(--warning); }
.badge-replied { background: var(--success-dim); color: var(--success); }
.badge-qualified { background: var(--ember-dim); color: var(--ember); }
.badge-disqualified { background: var(--danger-dim); color: var(--danger); }
.badge-draft { background: rgba(255,255,255,0.06); color: var(--slate); }
.badge-sent { background: var(--success-dim); color: var(--success); }
.badge-approved { background: var(--info-dim); color: var(--info); }
.badge-active { background: var(--success-dim); color: var(--success); }

/* ── Table ───────────────────────────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  text-align: left;
  padding: 12px 16px;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--slate);
  border-bottom: 1px solid var(--border);
  font-weight: 600;
}

.data-table td {
  padding: 14px 16px;
  font-size: 0.9rem;
  border-bottom: 1px solid #131313;
  vertical-align: middle;
}

.data-table tr:hover td { background: rgba(255,255,255,0.02); }

.data-table .name-cell {
  font-weight: 600;
  color: var(--smoke);
}

.data-table .company-cell { color: var(--smoke-dim); }
.data-table .muted-cell { color: var(--slate); font-size: 0.85rem; }

/* ── Empty State ─────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 64px 24px;
  color: var(--slate);
}

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

.empty-state h3 {
  font-family: 'Space Grotesk', sans-serif;
  color: var(--smoke-dim);
  margin-bottom: 8px;
}

.empty-state p {
  font-size: 0.9rem;
  max-width: 400px;
  margin: 0 auto 24px;
  line-height: 1.6;
}

/* ── Modal / Drawer ──────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}

.modal {
  background: var(--ink-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  width: 90%;
  max-width: 600px;
  max-height: 85vh;
  overflow-y: auto;
  animation: slideUp 0.25s ease;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.modal-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--smoke);
}

.modal-close {
  background: none;
  border: none;
  color: var(--slate);
  cursor: pointer;
  font-size: 1.4rem;
  padding: 4px;
  line-height: 1;
  transition: color var(--transition);
}

.modal-close:hover { color: var(--smoke); }

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

/* ── Email Preview ───────────────────────────────────────────── */
.email-preview {
  background: var(--ink);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-top: 12px;
}

.email-preview-subject {
  font-weight: 600;
  color: var(--smoke);
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.email-preview-body {
  white-space: pre-wrap;
  font-size: 0.9rem;
  color: var(--smoke-dim);
  line-height: 1.7;
}

/* ── Prospect Card ───────────────────────────────────────────── */
.prospect-card {
  background: var(--ink-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: all var(--transition);
}

.prospect-card:hover { border-color: #2a2a2a; }

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

.prospect-name {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  color: var(--smoke);
  font-size: 1rem;
}

.prospect-meta {
  font-size: 0.85rem;
  color: var(--slate);
  margin-top: 2px;
}

.prospect-research {
  font-size: 0.85rem;
  color: var(--smoke-dim);
  line-height: 1.6;
  margin: 12px 0;
  padding: 12px;
  background: var(--ink);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--ember);
}

.prospect-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}

/* ── Campaign Card ───────────────────────────────────────────── */
.campaign-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
}

.campaign-card {
  background: var(--ink-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  cursor: pointer;
  transition: all var(--transition);
}

.campaign-card:hover {
  border-color: var(--ember);
  transform: translateY(-2px);
}

.campaign-card-name {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--smoke);
  margin-bottom: 8px;
}

.campaign-card-meta {
  display: flex;
  gap: 16px;
  font-size: 0.82rem;
  color: var(--slate);
  margin-bottom: 12px;
}

.campaign-card-stats {
  display: flex;
  gap: 20px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.campaign-stat {
  text-align: center;
}

.campaign-stat-val {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--ember);
}

.campaign-stat-label {
  font-size: 0.72rem;
  color: var(--slate);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

/* ── Auth Page ───────────────────────────────────────────────── */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--ink);
}

.auth-container {
  width: 100%;
  max-width: 400px;
  padding: 24px;
}

.auth-logo {
  text-align: center;
  margin-bottom: 40px;
}

.auth-logo a {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 2rem;
  font-weight: 700;
  color: var(--smoke);
  letter-spacing: -1px;
  text-decoration: none;
}

.auth-logo a span { color: var(--ember); }

.auth-tagline {
  font-size: 0.9rem;
  color: var(--slate);
  margin-top: 8px;
}

.auth-card {
  background: var(--ink-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
}

.auth-card h2 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--smoke);
  margin-bottom: 24px;
}

.auth-switch {
  text-align: center;
  margin-top: 20px;
  font-size: 0.88rem;
  color: var(--slate);
}

.auth-switch a {
  color: var(--ember);
  cursor: pointer;
  text-decoration: none;
  font-weight: 600;
}

.auth-switch a:hover { color: var(--ember-glow); }

.auth-submit {
  width: 100%;
  padding: 13px;
  margin-top: 8px;
}

.auth-error {
  background: var(--danger-dim);
  color: var(--danger);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  margin-bottom: 16px;
}

/* ── Loading ─────────────────────────────────────────────────── */
.loading {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--slate);
  font-size: 0.9rem;
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--ember);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

.loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(10, 10, 10, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-lg);
  z-index: 10;
}

/* ── Toolbar ─────────────────────────────────────────────────── */
.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  gap: 12px;
  flex-wrap: wrap;
}

.toolbar-left { display: flex; align-items: center; gap: 12px; }
.toolbar-right { display: flex; align-items: center; gap: 10px; }

/* ── Breadcrumb ──────────────────────────────────────────────── */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--slate);
  margin-bottom: 20px;
}

.breadcrumb a {
  color: var(--slate);
  text-decoration: none;
  transition: color var(--transition);
}

.breadcrumb a:hover { color: var(--ember); }
.breadcrumb-sep { color: #333; }

/* ── Score Bar ───────────────────────────────────────────────── */
.score-bar {
  width: 60px;
  height: 6px;
  background: var(--wire);
  border-radius: 3px;
  overflow: hidden;
  display: inline-block;
  vertical-align: middle;
  margin-right: 6px;
}

.score-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width var(--transition);
}

.score-high .score-bar-fill { background: var(--success); }
.score-mid .score-bar-fill { background: var(--warning); }
.score-low .score-bar-fill { background: var(--danger); }

/* ── Prospect Grid ───────────────────────────────────────────── */
.prospect-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

/* ── Animations ──────────────────────────────────────────────── */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

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

.fade-in {
  animation: fadeIn 0.3s ease;
}

/* ── Toast ───────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--ink-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 20px;
  font-size: 0.88rem;
  color: var(--smoke-dim);
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  animation: slideUp 0.3s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

.toast-success { border-left: 3px solid var(--success); }
.toast-error { border-left: 3px solid var(--danger); }
.toast-info { border-left: 3px solid var(--info); }

/* ── Mobile ──────────────────────────────────────────────────── */
.mobile-header {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  background: var(--ink);
  border-bottom: 1px solid var(--border);
  z-index: 99;
  align-items: center;
  padding: 0 16px;
  justify-content: space-between;
}

.mobile-menu-btn {
  background: none;
  border: none;
  color: var(--smoke-dim);
  font-size: 1.4rem;
  cursor: pointer;
  padding: 4px;
}

.mobile-logo {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--smoke);
}

.mobile-logo span { color: var(--ember); }

@media (max-width: 768px) {
  .mobile-header { display: flex; }

  .sidebar {
    transform: translateX(-100%);
    width: 280px;
  }

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

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

  .page-container { padding: 24px 16px 40px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .campaign-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }

  .data-table { font-size: 0.82rem; }
  .data-table th, .data-table td { padding: 10px 10px; }
  .hide-mobile { display: none; }
}

/* ── Scrollbar ───────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #2a2a2a; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #3a3a3a; }

/* ── Misc ────────────────────────────────────────────────────── */
.text-ember { color: var(--ember); }
.text-success { color: var(--success); }
.text-slate { color: var(--slate); }
.text-smoke { color: var(--smoke); }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.flex { display: flex; }
.items-center { align-items: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }

.divider {
  height: 1px;
  background: var(--border);
  margin: 24px 0;
}

/* ── Tab / Pill Nav ──────────────────────────────────────────── */
.tab-nav {
  display: flex;
  gap: 4px;
  background: var(--ink);
  padding: 4px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin-bottom: 24px;
  overflow-x: auto;
}

.tab-item {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--slate);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  border: none;
  background: none;
}

.tab-item:hover { color: var(--smoke-dim); }
.tab-item.active { background: var(--ember-dim); color: var(--ember); }
