/* PigeonHQ App Styles */
/* NOTE: app.css loads AFTER theme.css. app.css CSS variables extend/override :root for the
   app shell and auth pages. Landing page (#landing) explicitly sets its own font-family on
   every text element via .lp-* classes, so it is not affected by the body font rule below. */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0f1117;
  --bg2: #161b27;
  --bg3: #1e2536;
  --border: rgba(255,255,255,0.08);
  --border2: rgba(255,255,255,0.12);
  --text: #e8eaf0;
  --text2: #9ba3b8;
  --text3: #6b7491;
  --amber: #F59E0B;
  --amber-dim: rgba(245,158,11,0.15);
  --blue: #3b82f6;
  --blue-dim: rgba(59,130,246,0.15);
  --green: #22c55e;
  --green-dim: rgba(34,197,94,0.15);
  --purple: #a855f7;
  --purple-dim: rgba(168,85,247,0.15);
  --red: #ef4444;
  --red-dim: rgba(239,68,68,0.12);
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
}

/* Global body: neutral base. App shell and auth pages explicitly set font/color/bg on their
   own wrapper elements. Landing page .lp-* classes all declare font-family explicitly. */
body { font-size: 14px; line-height: 1.6; -webkit-font-smoothing: antialiased; }

/* Auth pages — explicitly set font so they don't depend on body inheritance */
.auth-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; background: var(--bg); color: var(--text); font-family: 'Plus Jakarta Sans', 'Inter', sans-serif; }
.auth-card { width: 100%; max-width: 420px; background: var(--bg2); border: 1px solid var(--border2); border-radius: 16px; padding: 40px; }
.auth-logo { display: flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 700; color: var(--text); text-decoration: none; margin-bottom: 28px; }
.auth-logo span { color: var(--text); }
.auth-title { font-size: 22px; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.auth-sub { color: var(--text2); font-size: 14px; margin-bottom: 28px; }
.auth-form { display: flex; flex-direction: column; gap: 16px; }
.auth-switch { text-align: center; color: var(--text2); font-size: 13px; margin-top: 20px; }
.auth-switch a { color: var(--amber); text-decoration: none; font-weight: 500; }
.auth-switch a:hover { text-decoration: underline; }

/* App layout — explicitly set font/bg/color for the app shell */
#app { font-family: 'Plus Jakarta Sans', 'Inter', sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; }
.app-body { min-height: 100vh; font-family: 'Plus Jakarta Sans', 'Inter', sans-serif; background: var(--bg); color: var(--text); }
.app-wrapper { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar { width: 220px; min-height: 100vh; background: var(--bg2); border-right: 1px solid var(--border); display: flex; flex-direction: column; flex-shrink: 0; position: fixed; top: 0; left: 0; height: 100%; z-index: 10; }
.sidebar-header { padding: 20px 18px 16px; border-bottom: 1px solid var(--border); }
.sidebar-logo { display: flex; align-items: center; gap: 10px; font-size: 16px; font-weight: 700; color: var(--text); text-decoration: none; }
.sidebar-nav { flex: 1; padding: 12px 10px; display: flex; flex-direction: column; gap: 2px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--radius-sm); color: var(--text2); text-decoration: none; font-size: 13.5px; font-weight: 500; transition: all 0.15s; }
.nav-item:hover { color: var(--text); background: var(--bg3); }
.nav-item.active { color: var(--amber); background: var(--amber-dim); }
.sidebar-footer { padding: 16px; border-top: 1px solid var(--border); }
.user-info { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.user-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--amber); color: #000; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; flex-shrink: 0; }
.user-name { font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-email { font-size: 11px; color: var(--text3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Main */
.app-main { margin-left: 220px; flex: 1; padding: 32px 36px; min-height: 100vh; }

/* Page header */
.page-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 32px; gap: 20px; }
.breadcrumb { font-size: 12px; color: var(--text3); text-decoration: none; display: block; margin-bottom: 6px; }
.breadcrumb:hover { color: var(--text2); }
.page-title { font-size: 24px; font-weight: 700; color: var(--text); }
.page-sub { color: var(--text2); font-size: 13px; margin-top: 4px; }

/* Stats grid */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 36px; }
.stat-card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; display: flex; align-items: center; gap: 16px; }
.stat-icon { width: 44px; height: 44px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.stat-icon--blue { background: var(--blue-dim); color: var(--blue); }
.stat-icon--amber { background: var(--amber-dim); color: var(--amber); }
.stat-icon--green { background: var(--green-dim); color: var(--green); }
.stat-icon--purple { background: var(--purple-dim); color: var(--purple); }
.stat-value { font-size: 28px; font-weight: 700; line-height: 1; color: var(--text); }
.stat-label { font-size: 12px; color: var(--text2); margin-top: 4px; }

/* Section */
.section { margin-bottom: 36px; }
.section-title { font-size: 16px; font-weight: 600; color: var(--text); margin-bottom: 16px; }

/* Campaigns list */
.campaigns-list { display: flex; flex-direction: column; gap: 8px; }
.campaign-card { display: flex; align-items: center; justify-content: space-between; background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 20px; text-decoration: none; color: var(--text); transition: all 0.15s; gap: 20px; }
.campaign-card:hover { border-color: var(--border2); background: var(--bg3); }
.campaign-name { font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.campaign-meta { font-size: 12px; color: var(--text2); }
.campaign-card-right { display: flex; align-items: center; gap: 20px; flex-shrink: 0; }
.campaign-stat { font-size: 12px; color: var(--text2); text-align: center; }
.campaign-stat .count { font-size: 16px; font-weight: 700; color: var(--text); display: block; }

/* Status badges */
.status-badge { display: inline-flex; align-items: center; padding: 3px 8px; border-radius: 20px; font-size: 11px; font-weight: 600; text-transform: capitalize; white-space: nowrap; }
.status-badge--lg { font-size: 13px; padding: 5px 12px; }
.status-draft { background: var(--bg3); color: var(--text2); border: 1px solid var(--border); }
.status-finding_prospects { background: var(--blue-dim); color: var(--blue); }
.status-prospects_found { background: var(--amber-dim); color: var(--amber); }
.status-active { background: var(--green-dim); color: var(--green); }
.status-sent { background: var(--green-dim); color: var(--green); }
.status-draft.status-badge { background: var(--bg3); color: var(--text3); }
.status-error { background: var(--red-dim); color: var(--red); }
.status-none { background: var(--bg3); color: var(--text3); }

/* Forms */
.form-card { background: var(--bg2); border: 1px solid var(--border); border-radius: 14px; padding: 32px; max-width: 800px; }
.form-section { margin-bottom: 32px; }
.form-section:last-of-type { margin-bottom: 0; }
.form-section-title { font-size: 13px; font-weight: 600; color: var(--text2); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 16px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.form-row { display: flex; flex-direction: column; gap: 16px; margin-bottom: 16px; }
.form-row--2 { flex-direction: row; }
.form-row--2 .form-group { flex: 1; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: 13px; font-weight: 500; color: var(--text2); }
.required { color: var(--red); }
.form-group input, .form-group select, .form-group textarea { background: var(--bg3); border: 1px solid var(--border2); border-radius: var(--radius-sm); padding: 10px 12px; color: var(--text); font-family: inherit; font-size: 14px; outline: none; transition: border-color 0.15s; width: 100%; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { border-color: var(--amber); }
.form-group input::placeholder, .form-group textarea::placeholder { color: var(--text3); }
.form-group select option { background: var(--bg3); }
.form-group textarea { resize: vertical; min-height: 80px; }
.form-actions { display: flex; align-items: center; justify-content: flex-end; gap: 12px; padding-top: 24px; margin-top: 24px; border-top: 1px solid var(--border); }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px; border-radius: var(--radius-sm); font-family: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer; border: none; transition: all 0.15s; text-decoration: none; white-space: nowrap; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary { background: var(--amber); color: #000; }
.btn-primary:hover:not(:disabled) { background: #fbbf24; }
.btn-secondary { background: var(--bg3); color: var(--text); border: 1px solid var(--border2); }
.btn-secondary:hover:not(:disabled) { background: var(--bg2); border-color: var(--amber); color: var(--amber); }
.btn-ghost { background: transparent; color: var(--text2); border: 1px solid var(--border); }
.btn-ghost:hover:not(:disabled) { background: var(--bg3); color: var(--text); }
.btn-full { width: 100%; justify-content: center; padding: 11px 16px; font-size: 14px; }
.logout-btn { background: none; border: none; color: var(--text3); cursor: pointer; font-size: 12px; padding: 0; font-family: inherit; }
.logout-btn:hover { color: var(--text); }

/* Action bar */
.action-bar { display: flex; align-items: center; justify-content: space-between; background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 20px; margin-bottom: 20px; gap: 16px; }
.action-bar-left { display: flex; align-items: center; gap: 24px; }
.action-bar-right { display: flex; align-items: center; gap: 10px; }
.action-stat { text-align: center; }
.action-stat .count { font-size: 20px; font-weight: 700; color: var(--text); display: block; line-height: 1.2; }
.action-stat .label { font-size: 11px; color: var(--text3); }

/* ICP summary */
.icp-summary { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; }
.icp-chip { background: var(--bg2); border: 1px solid var(--border); border-radius: 6px; padding: 6px 12px; font-size: 12px; color: var(--text2); }
.icp-chip strong { color: var(--text); }

/* Tables */
.prospects-table-wrap, .emails-table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
.prospects-table, .emails-table { width: 100%; border-collapse: collapse; }
.prospects-table th, .emails-table th { text-align: left; padding: 11px 14px; font-size: 11px; font-weight: 600; color: var(--text3); text-transform: uppercase; letter-spacing: 0.05em; background: var(--bg2); border-bottom: 1px solid var(--border); white-space: nowrap; }
.prospects-table td, .emails-table td { padding: 12px 14px; border-bottom: 1px solid var(--border); color: var(--text); font-size: 13px; vertical-align: middle; }
.prospects-table tr:last-child td, .emails-table tr:last-child td { border-bottom: none; }
.prospects-table tbody tr:hover, .emails-table tbody tr:hover { background: var(--bg3); }
.prospect-name { font-weight: 600; }
.prospect-email, .subject-preview { color: var(--text2); font-size: 12px; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.subject-cell { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Alerts */
.alert { padding: 12px 14px; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 16px; }
.alert-error { background: var(--red-dim); color: var(--red); border: 1px solid rgba(239,68,68,0.25); }
.alert-success { background: var(--green-dim); color: var(--green); border: 1px solid rgba(34,197,94,0.25); }

/* Status messages */
.status-message { padding: 12px 16px; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 16px; font-weight: 500; }
.status-message--info { background: var(--blue-dim); color: var(--blue); }
.status-message--success { background: var(--green-dim); color: var(--green); }
.status-message--error { background: var(--red-dim); color: var(--red); }
.hidden { display: none; }

/* Empty state */
.empty-state { text-align: center; padding: 48px 20px; color: var(--text2); display: flex; flex-direction: column; align-items: center; gap: 12px; background: var(--bg2); border: 1px dashed var(--border2); border-radius: var(--radius); }
.empty-state a { color: var(--amber); text-decoration: none; font-weight: 500; }
.empty-state a:hover { text-decoration: underline; }

/* Responsive */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .app-main { margin-left: 0; padding: 20px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .form-row--2 { flex-direction: column; }
  .action-bar { flex-direction: column; align-items: stretch; }
  .action-bar-right { flex-wrap: wrap; }
}
