/* dashboard.css — Coldcraft prospect dashboard styles
   Design tokens match the landing page exactly. */

:root {
  --bg: #0a0a0f;
  --bg-elevated: #12121a;
  --bg-card: #16161f;
  --fg: #e8e8ed;
  --fg-muted: #8a8a9a;
  --fg-dim: #5a5a6a;
  --accent: #4af0c0;
  --accent-dim: rgba(74, 240, 192, 0.12);
  --accent-glow: rgba(74, 240, 192, 0.25);
  --border: rgba(255, 255, 255, 0.06);
  --border-hover: rgba(255, 255, 255, 0.12);
  --radius: 12px;
  --radius-sm: 8px;
  --font-display: 'Space Grotesk', sans-serif;
  --font-body: 'DM Sans', sans-serif;
  --danger: #ff4d6d;
  --danger-dim: rgba(255, 77, 109, 0.12);
  --warning: #f59e0b;
  --warning-dim: rgba(245, 158, 11, 0.12);
  --success: #4af0c0;
  --sidebar-w: 220px;
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  min-height: 100vh;
}

/* ---- AUTH SCREENS ---- */
.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(ellipse 80% 60% at 50% 0%, rgba(74,240,192,0.06) 0%, transparent 60%);
}

.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px 36px;
}

.auth-logo {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}

.auth-tagline {
  font-size: 13px;
  color: var(--fg-muted);
  margin-bottom: 32px;
}

.auth-card h2 {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 24px;
  color: var(--fg);
}

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

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-muted);
  margin-bottom: 8px;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 14px;
  padding: 10px 14px;
  outline: none;
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  border-color: rgba(74, 240, 192, 0.4);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

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

.form-group select {
  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='%238a8a9a' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
  padding: 9px 18px;
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: #0a0a0f;
}

.btn-primary:hover {
  background: #5fffd0;
  box-shadow: 0 0 20px var(--accent-glow);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--fg-muted);
  border: 1px solid var(--border);
}

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

.btn-danger {
  background: var(--danger-dim);
  color: var(--danger);
  border: 1px solid rgba(255, 77, 109, 0.2);
}

.btn-danger:hover {
  background: rgba(255, 77, 109, 0.2);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

.btn-full { width: 100%; justify-content: center; }

.auth-switch {
  margin-top: 20px;
  text-align: center;
  font-size: 13px;
  color: var(--fg-muted);
}

.auth-switch a {
  color: var(--accent);
  text-decoration: none;
  cursor: pointer;
}

.auth-switch a:hover { text-decoration: underline; }

/* ---- APP SHELL ---- */
.app-shell {
  display: flex;
  min-height: 100vh;
}

/* ---- SIDEBAR ---- */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--bg-elevated);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0;
  top: 0;
  z-index: 100;
}

.sidebar-header {
  padding: 24px 20px 20px;
  border-bottom: 1px solid var(--border);
}

.sidebar-logo {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.02em;
}

.sidebar-user {
  font-size: 11px;
  color: var(--fg-dim);
  margin-top: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.nav-section {
  margin-bottom: 4px;
}

.nav-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-dim);
  padding: 8px 8px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 8px;
  color: var(--fg-muted);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  user-select: none;
}

.nav-item:hover {
  background: var(--accent-dim);
  color: var(--fg);
}

.nav-item.active {
  background: var(--accent-dim);
  color: var(--accent);
}

.nav-item svg {
  flex-shrink: 0;
  opacity: 0.7;
}

.nav-item.active svg { opacity: 1; }

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

/* ---- MAIN CONTENT ---- */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* ---- PAGE ---- */
.page {
  display: none;
  padding: 32px 36px;
  max-width: 1200px;
  width: 100%;
}

.page.active { display: block; }

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  gap: 16px;
}

.page-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  color: var(--fg);
  letter-spacing: -0.02em;
}

.page-subtitle {
  font-size: 13px;
  color: var(--fg-muted);
  margin-top: 2px;
}

/* ---- STATS GRID ---- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  transition: border-color 0.2s;
}

.stat-card:hover { border-color: var(--border-hover); }

.stat-card-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-muted);
  margin-bottom: 8px;
}

.stat-card-value {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  color: var(--fg);
  line-height: 1;
}

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

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

.search-input {
  flex: 1;
  min-width: 200px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 14px;
  padding: 9px 14px 9px 38px;
  outline: none;
  transition: border-color 0.2s;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238a8a9a' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 12px center;
}

.search-input:focus {
  border-color: rgba(74, 240, 192, 0.4);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.filter-select {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 13px;
  padding: 9px 32px 9px 12px;
  outline: none;
  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='%238a8a9a' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  transition: border-color 0.2s;
}

.filter-select:focus {
  border-color: rgba(74, 240, 192, 0.4);
}

/* ---- PROSPECT TABLE ---- */
.table-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

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

.table th {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--fg-muted);
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
}

.table td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  color: var(--fg);
  vertical-align: middle;
}

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

.table tbody tr {
  transition: background 0.15s;
  cursor: pointer;
}

.table tbody tr:hover { background: var(--accent-dim); }

.prospect-name {
  font-weight: 600;
  font-size: 14px;
}

.prospect-meta {
  font-size: 12px;
  color: var(--fg-muted);
  margin-top: 2px;
}

/* ---- STATUS BADGES ---- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 3px 9px;
  border-radius: 100px;
}

.badge-new        { background: rgba(138,138,154,0.15); color: var(--fg-muted); }
.badge-researched { background: rgba(99,102,241,0.15); color: #a5b4fc; }
.badge-email_drafted { background: var(--warning-dim); color: var(--warning); }
.badge-sent       { background: var(--accent-dim); color: var(--accent); }
.badge-opened     { background: rgba(16,185,129,0.15); color: #6ee7b7; }
.badge-replied    { background: rgba(16,185,129,0.25); color: #34d399; }
.badge-bounced    { background: var(--danger-dim); color: var(--danger); }
.badge-unsubscribed { background: rgba(138,138,154,0.1); color: var(--fg-dim); }

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

.modal-backdrop.open { display: flex; }

.modal {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalIn 0.2s ease;
}

.modal-lg { max-width: 720px; }

@keyframes modalIn {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to   { opacity: 1; transform: none; }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 24px 18px;
  border-bottom: 1px solid var(--border);
}

.modal-title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.modal-close {
  background: none;
  border: none;
  color: var(--fg-muted);
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  padding: 4px;
  border-radius: 4px;
  transition: color 0.15s;
}

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

.modal-body { padding: 24px; }

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

/* ---- DETAIL PANEL ---- */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}

.detail-field label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--fg-muted);
  margin-bottom: 4px;
}

.detail-field span {
  font-size: 14px;
  color: var(--fg);
}

.detail-field a {
  color: var(--accent);
  text-decoration: none;
  font-size: 14px;
}

.detail-field a:hover { text-decoration: underline; }

.research-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  font-size: 13px;
  line-height: 1.7;
  color: var(--fg-muted);
  white-space: pre-wrap;
  margin-top: 8px;
}

/* ---- EMAIL COMPOSER ---- */
.email-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  overflow: hidden;
}

.email-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.email-subject { font-weight: 600; font-size: 14px; }

.email-meta {
  font-size: 12px;
  color: var(--fg-muted);
  margin-top: 2px;
}

.email-body {
  padding: 16px;
  font-size: 13px;
  line-height: 1.7;
  white-space: pre-wrap;
  color: var(--fg);
}

.email-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  background: var(--bg-elevated);
}

/* ---- ACTIVITY FEED ---- */
.activity-feed {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.activity-item:last-child { border-bottom: none; }

.activity-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 14px;
}

.activity-icon.opened  { background: rgba(16,185,129,0.15); }
.activity-icon.replied { background: rgba(16,185,129,0.25); }
.activity-icon.bounced { background: var(--danger-dim); }

.activity-text { font-size: 13px; color: var(--fg); line-height: 1.5; }
.activity-time { font-size: 11px; color: var(--fg-muted); margin-top: 2px; }

/* ---- EMPTY STATES ---- */
.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--fg-muted);
}

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

.empty-state-title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 8px;
}

.empty-state-text { font-size: 13px; max-width: 300px; margin: 0 auto 20px; }

/* ---- LOADING / SPINNER ---- */
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(74,240,192,0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

.loading-row td {
  text-align: center;
  padding: 40px;
  color: var(--fg-muted);
}

/* ---- TOAST ---- */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 18px;
  font-size: 13px;
  color: var(--fg);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  animation: toastIn 0.2s ease;
  max-width: 320px;
}

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

@keyframes toastIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

/* ---- TWO-COL DETAIL LAYOUT ---- */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
}

.section-title {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-muted);
  margin-bottom: 14px;
}

/* ---- PAGINATION ---- */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--fg-muted);
}

/* ---- MISC ---- */
.divider { height: 1px; background: var(--border); margin: 20px 0; }
.text-muted { color: var(--fg-muted); }
.text-accent { color: var(--accent); }
.text-danger { color: var(--danger); }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.gap-8 { gap: 8px; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }

/* ---- CSV IMPORT ---- */
.csv-drop {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 32px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}

.csv-drop:hover, .csv-drop.drag-over {
  border-color: rgba(74,240,192,0.4);
  background: var(--accent-dim);
}
