/* Outpace App UI — dashboard, campaigns, prospects */
/* Design tokens inherited from theme.css */

/* ============ APP LAYOUT ============ */
.app-body {
  display: flex;
  min-height: 100vh;
  background: var(--bg-primary);
}

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

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

.brand-logo {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-primary);
  text-decoration: none;
  letter-spacing: -0.02em;
}

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

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 20px;
  font-size: 0.88rem;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: 0;
  transition: background 0.15s, color 0.15s;
  cursor: pointer;
}

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

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

.nav-section-label {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 16px 20px 6px;
  cursor: default;
}

.nav-section-label:hover {
  background: none;
  color: var(--text-muted);
}

.nav-campaign {
  padding-left: 28px;
  font-size: 0.84rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.campaign-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
}

.campaign-dot.running {
  background: var(--accent);
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

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

.btn-new-campaign {
  width: 100%;
  padding: 10px;
  background: var(--accent-dim);
  border: 1px solid rgba(0, 232, 123, 0.25);
  border-radius: var(--radius);
  color: var(--accent);
  font-family: var(--font-display);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-new-campaign:hover {
  background: rgba(0, 232, 123, 0.2);
}

/* ============ MAIN ============ */
.app-main {
  flex: 1;
  margin-left: 220px;
  padding: 40px 48px;
  max-width: 1100px;
  min-height: 100vh;
}

/* ============ PAGE HEADER ============ */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 36px;
  gap: 16px;
}

.back-link {
  font-size: 0.84rem;
  color: var(--text-muted);
  text-decoration: none;
  display: block;
  margin-bottom: 6px;
}

.back-link:hover { color: var(--text-secondary); }

.page-title {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}

.page-sub {
  font-size: 0.9rem;
  color: var(--text-secondary);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-top: 6px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

/* ============ STATS GRID ============ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 40px;
}

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

.stat-card.accent {
  border-color: rgba(0, 232, 123, 0.2);
  background: var(--bg-card-highlight);
}

.stat-card-num {
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: 6px;
}

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

.stat-card-label {
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* ============ SECTION HEADER ============ */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.section-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
}

/* ============ CAMPAIGNS GRID ============ */
.campaigns-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.campaign-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-decoration: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  display: block;
}

.campaign-card:hover {
  border-color: rgba(0, 232, 123, 0.25);
  box-shadow: 0 0 20px rgba(0, 232, 123, 0.06);
}

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

.campaign-name {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
}

.campaign-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}

.campaign-stats {
  display: flex;
  gap: 16px;
  font-size: 0.84rem;
  color: var(--text-muted);
}

.campaign-stats strong {
  color: var(--text-primary);
}

/* ============ META TAGS ============ */
.meta-tag {
  display: inline-block;
  font-size: 0.75rem;
  padding: 3px 10px;
  border-radius: 100px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
}

.email-tag { color: var(--accent); border-color: rgba(0, 232, 123, 0.2); background: var(--accent-dim); }

/* ============ STATUS BADGES ============ */
.status-badge {
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 100px;
  display: inline-block;
}

.status-badge.active { background: rgba(0, 232, 123, 0.1); color: var(--accent); border: 1px solid rgba(0, 232, 123, 0.2); }
.status-badge.running { background: rgba(255, 193, 0, 0.1); color: #ffc100; border: 1px solid rgba(255, 193, 0, 0.2); }
.status-badge.discovered { background: var(--bg-card); color: var(--text-muted); border: 1px solid var(--border); }
.status-badge.researched { background: rgba(0, 232, 123, 0.1); color: var(--accent); border: 1px solid rgba(0, 232, 123, 0.15); }
.status-badge.draft { background: var(--bg-card); color: var(--text-muted); border: 1px solid var(--border); }
.status-badge.sent { background: rgba(0, 232, 123, 0.1); color: var(--accent); border: 1px solid rgba(0, 232, 123, 0.2); }
.status-badge.scheduled { background: rgba(100, 100, 255, 0.1); color: #8888ff; border: 1px solid rgba(100, 100, 255, 0.2); }

/* ============ PROSPECTS LIST ============ */
.prospects-list { display: flex; flex-direction: column; gap: 8px; }

.prospect-row {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  text-decoration: none;
  transition: border-color 0.15s;
}

.prospect-row:hover { border-color: rgba(0, 232, 123, 0.2); }

.prospect-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent-dim);
  border: 1px solid rgba(0, 232, 123, 0.2);
  color: var(--accent);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.prospect-info { flex: 1; }

.prospect-name {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.9rem;
  margin-bottom: 2px;
}

.prospect-title { font-size: 0.82rem; color: var(--text-secondary); }

.prospect-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chevron { color: var(--text-muted); flex-shrink: 0; }

/* ============ EMAILS LIST ============ */
.emails-list { display: flex; flex-direction: column; gap: 8px; }

.email-row {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
}

.email-step {
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent);
  min-width: 48px;
}

.email-info { flex: 1; }

.email-to { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 3px; }

.email-subject { font-size: 0.9rem; color: var(--text-primary); font-weight: 500; }

/* ============ TABS ============ */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 28px;
}

.tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 10px 20px;
  font-family: var(--font-display);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s;
  margin-bottom: -1px;
}

.tab:hover { color: var(--text-secondary); }

.tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.tab-count {
  display: inline-block;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 1px 7px;
  font-size: 0.72rem;
  margin-left: 6px;
  color: var(--text-muted);
}

/* ============ PROSPECT DETAIL ============ */
.prospect-detail-grid {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 32px;
  align-items: start;
}

.detail-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}

.detail-card.highlight {
  border-color: rgba(0, 232, 123, 0.2);
  background: var(--bg-card-highlight);
}

.detail-card-title {
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
}

.detail-row:last-child { border-bottom: none; }

.detail-label { color: var(--text-muted); }

.detail-value { color: var(--text-primary); }

.accent-link { color: var(--accent); text-decoration: none; }
.accent-link:hover { text-decoration: underline; }

.detail-text {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ============ EMAIL CARDS ============ */
.email-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 12px;
}

.email-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.email-step-badge {
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-dim);
  border: 1px solid rgba(0, 232, 123, 0.15);
  padding: 3px 10px;
  border-radius: 100px;
}

.email-card-actions {
  display: flex;
  gap: 6px;
  margin-left: auto;
}

.email-subject-display {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.email-body-display {
  font-size: 0.88rem;
  color: var(--text-primary);
  line-height: 1.7;
  white-space: pre-wrap;
}

.email-subject-input {
  width: 100%;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-primary);
  padding: 8px 12px;
  font-size: 0.88rem;
  margin-bottom: 8px;
  font-family: var(--font-body);
}

.email-body-input {
  width: 100%;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-primary);
  padding: 8px 12px;
  font-size: 0.88rem;
  line-height: 1.6;
  resize: vertical;
  font-family: var(--font-body);
}

.email-subject-input:focus, .email-body-input:focus {
  outline: none;
  border-color: rgba(0, 232, 123, 0.4);
}

.edit-actions { display: flex; gap: 8px; margin-top: 8px; }

.email-scheduled {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

/* ============ BUTTONS ============ */
.btn-primary {
  background: var(--accent);
  color: #000;
  border: none;
  border-radius: var(--radius);
  padding: 10px 20px;
  font-family: var(--font-display);
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s;
  text-decoration: none;
  display: inline-block;
}

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

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 20px;
  font-family: var(--font-display);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-secondary:hover { background: var(--bg-card-highlight); }

.btn-danger {
  background: var(--danger-dim);
  color: var(--danger);
  border: 1px solid rgba(255, 68, 102, 0.2);
  border-radius: var(--radius);
  padding: 10px 20px;
  font-family: var(--font-display);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-sm {
  background: var(--bg-secondary);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 5px 12px;
  font-size: 0.78rem;
  font-family: var(--font-display);
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-sm:hover { background: var(--bg-card-highlight); color: var(--text-primary); }
.btn-sm:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-sm.accent { background: var(--accent-dim); color: var(--accent); border-color: rgba(0, 232, 123, 0.2); }

/* ============ MODAL ============ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 24px;
}

.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 16px;
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 32px;
}

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

.modal-header h2 {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
}

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

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

.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full { grid-column: 1 / -1; }

.form-group label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  font-family: var(--font-display);
}

.form-group input,
.form-group textarea,
.form-group select {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-primary);
  padding: 10px 14px;
  font-size: 0.88rem;
  font-family: var(--font-body);
  transition: border-color 0.15s;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: rgba(0, 232, 123, 0.4);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: var(--text-muted);
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ============ EMPTY STATE ============ */
.empty-state {
  text-align: center;
  padding: 64px 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.empty-state.small { padding: 32px 24px; }

.empty-icon { font-size: 2.5rem; margin-bottom: 16px; }

.empty-state h3 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.empty-state p {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 20px;
}

/* ============ RESPONSIVE ============ */
@media (max-width: 900px) {
  .sidebar { display: none; }
  .app-main { margin-left: 0; padding: 24px 20px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .prospect-detail-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
}
