/* Fling AI — Theme CSS */
/* Design tokens from landing page, shared across all views */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0c0c0e;
  --surface: #141418;
  --surface-2: #1e1e24;
  --surface-3: #2a2a32;
  --text: #f0ede8;
  --text-muted: #8a8793;
  --accent: #ff4d00;
  --accent-dim: rgba(255,77,0,0.12);
  --accent-hover: #ff6a2e;
  --border: rgba(255,255,255,0.07);
  --border-strong: rgba(255,255,255,0.12);
  --open: #4ade80;
  --reply: #fb923c;
  --hot: #f43f5e;
  --cold: #4b4b58;
  --warn: #fbbf24;
  --success: #4ade80;
  --error: #f43f5e;
  --radius: 8px;
  --radius-sm: 4px;
  --radius-lg: 12px;
}

html { scroll-behavior: smooth; font-size: 16px; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'DM Sans', system-ui, sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
h1, h2, h3 { font-family: 'Syne', system-ui, sans-serif; font-weight: 700; line-height: 1.1; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

/* ─── Scrollbar ─── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ─── Nav ─── */
.nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 2rem;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0;
  background: rgba(12,12,14,0.85);
  backdrop-filter: blur(12px);
  z-index: 50;
}
.nav-logo { display: flex; align-items: center; gap: 0.5rem; cursor: pointer; }
.logo-mark { font-size: 1.5rem; color: var(--accent); font-weight: 800; }
.logo-name { font-family: 'Syne', sans-serif; font-weight: 800; font-size: 1.25rem; letter-spacing: -0.02em; }
.nav-links { display: flex; gap: 1.5rem; align-items: center; }
.nav-links a { color: var(--text-muted); text-decoration: none; font-size: 0.875rem; transition: color 0.2s; }
.nav-links a:hover { color: var(--text); }
.nav-links .btn-primary { color: white; }

/* ─── Buttons ─── */
.btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.6rem 1.25rem;
  border-radius: var(--radius);
  font-size: 0.875rem; font-weight: 500;
  cursor: pointer; border: none; transition: all 0.15s;
  font-family: inherit; text-decoration: none;
}
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-primary {
  background: var(--accent); color: white;
}
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-secondary {
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover:not(:disabled) { border-color: var(--border-strong); }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { color: var(--text); background: var(--surface-2); }
.btn-danger { background: var(--error); color: white; }
.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.8rem; }
.btn-lg { padding: 0.8rem 1.75rem; font-size: 1rem; }
.btn-block { width: 100%; justify-content: center; }

.spinner {
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.2);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Forms ─── */
.form-group { display: flex; flex-direction: column; gap: 0.4rem; }
label { font-size: 0.8rem; color: var(--text-muted); font-weight: 500; }
input, textarea, select {
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 0.65rem 0.9rem; font-size: 0.9rem; font-family: inherit;
  outline: none; transition: border-color 0.15s;
  width: 100%;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); }
input::placeholder, textarea::placeholder { color: var(--text-muted); opacity: 0.6; }
textarea { resize: vertical; min-height: 100px; }
.form-hint { font-size: 0.75rem; color: var(--text-muted); }
.form-error { font-size: 0.75rem; color: var(--error); }

/* ─── Cards ─── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
}
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.card-title { font-size: 1rem; font-weight: 600; }

/* ─── Status badges ─── */
.badge {
  display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 0.2rem 0.6rem; border-radius: 99px;
  font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em;
}
.badge-pending { background: var(--surface-3); color: var(--text-muted); }
.badge-emailed { background: rgba(74,222,128,0.15); color: var(--open); }
.badge-replied { background: rgba(251,146,60,0.15); color: var(--reply); }
.badge-hot { background: rgba(244,63,94,0.15); color: var(--hot); }
.badge-bounced { background: rgba(244,63,94,0.1); color: var(--error); }
.badge-active { background: var(--accent-dim); color: var(--accent); }
.badge-draft { background: var(--surface-3); color: var(--text-muted); }
.badge-paused { background: rgba(251,191,36,0.15); color: var(--warn); }

/* ─── Tables ─── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
th { text-align: left; padding: 0.6rem 1rem; color: var(--text-muted); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; border-bottom: 1px solid var(--border); font-weight: 500; }
td { padding: 0.8rem 1rem; border-bottom: 1px solid var(--border); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--surface-2); }

/* ─── Stats ─── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.25rem; }
.stat-label { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.5rem; }
.stat-value { font-size: 1.75rem; font-weight: 700; font-family: 'Syne', sans-serif; }
.stat-sub { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.25rem; }
.stat-value.open-rate { color: var(--open); }
.stat-value.reply-rate { color: var(--reply); }

/* ─── Modal ─── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
}
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 2rem; width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto; }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem; }
.modal-title { font-size: 1.1rem; font-weight: 600; }
.modal-close { background: none; border: none; color: var(--text-muted); font-size: 1.5rem; cursor: pointer; line-height: 1; }
.modal-close:hover { color: var(--text); }
.modal-footer { margin-top: 1.5rem; display: flex; gap: 0.75rem; justify-content: flex-end; }

/* ─── Tabs ─── */
.tabs { display: flex; gap: 0.25rem; border-bottom: 1px solid var(--border); margin-bottom: 1.5rem; }
.tab { padding: 0.6rem 1rem; color: var(--text-muted); font-size: 0.875rem; cursor: pointer; border-bottom: 2px solid transparent; transition: all 0.15s; border: none; background: none; font-family: inherit; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ─── Empty state ─── */
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--text-muted); }
.empty-state-icon { font-size: 2.5rem; margin-bottom: 1rem; opacity: 0.4; }
.empty-state h3 { font-size: 1rem; margin-bottom: 0.5rem; color: var(--text); }
.empty-state p { font-size: 0.875rem; }

/* ─── Toast ─── */
.toast-container { position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 200; display: flex; flex-direction: column; gap: 0.5rem; }
.toast { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.8rem 1.2rem; font-size: 0.875rem; display: flex; align-items: center; gap: 0.75rem; animation: slideIn 0.2s ease; }
.toast-success { border-left: 3px solid var(--success); }
.toast-error { border-left: 3px solid var(--error); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ─── Progress bar ─── */
.progress-bar { height: 4px; background: var(--surface-3); border-radius: 99px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--accent); border-radius: 99px; transition: width 0.3s; }

/* ─── Tag input ─── */
.tag { display: inline-flex; align-items: center; gap: 0.3rem; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0.25rem 0.6rem; font-size: 0.75rem; }

/* ─── Page layout ─── */
.page { max-width: 1100px; margin: 0 auto; padding: 2rem; }
.page-header { margin-bottom: 2rem; }
.page-title { font-size: 1.5rem; margin-bottom: 0.25rem; }
.page-subtitle { color: var(--text-muted); font-size: 0.9rem; }
.section { margin-bottom: 2rem; }
.section-title { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); margin-bottom: 1rem; font-weight: 500; }

/* ─── Grid layouts ─── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
@media (max-width: 768px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

/* ─── Landing page specific ─── */
.hero {
  min-height: 88vh;
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 4rem; align-items: center;
  padding: 6rem 4rem 4rem;
  max-width: 1200px; margin: 0 auto;
  width: 100%;
}
.hero-badge {
  display: inline-flex; align-items: center; gap: 0.6rem;
  font-size: 0.8rem; color: var(--accent); font-weight: 500;
  letter-spacing: 0.05em; text-transform: uppercase;
  background: var(--accent-dim); padding: 0.4rem 0.9rem;
  border-radius: 100px; width: fit-content;
}
.hero h1 { font-size: 3.5rem; letter-spacing: -0.03em; margin-bottom: 1rem; }
.hero h1 .accent { color: var(--accent); }
.hero p { font-size: 1.1rem; color: var(--text-muted); line-height: 1.7; margin-bottom: 2rem; }
.hero-actions { display: flex; gap: 1rem; align-items: center; }
.hero-visual { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.5rem; }

.features { padding: 5rem 4rem; max-width: 1200px; margin: 0 auto; }
.features-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; margin-top: 3rem; }
.feature-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.5rem; }
.feature-icon { font-size: 1.75rem; margin-bottom: 0.75rem; }
.feature-card h3 { font-size: 1rem; margin-bottom: 0.5rem; }
.feature-card p { font-size: 0.875rem; color: var(--text-muted); }

.how-it-works { padding: 5rem 4rem; background: var(--surface); }
.steps-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 2rem; margin-top: 3rem; }
.step { text-align: center; }
.step-number { width: 2rem; height: 2rem; background: var(--accent); color: white; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.875rem; margin: 0 auto 0.75rem; }
.step h3 { font-size: 0.9rem; margin-bottom: 0.5rem; }
.step p { font-size: 0.8rem; color: var(--text-muted); }

.cta-section { padding: 5rem 4rem; text-align: center; }
.cta-section h2 { font-size: 2.5rem; margin-bottom: 1rem; }
.cta-section p { color: var(--text-muted); margin-bottom: 2rem; }

.pricing { padding: 5rem 4rem; background: var(--surface); }
.pricing-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; margin-top: 3rem; max-width: 900px; margin-left: auto; margin-right: auto; }
.price-card { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 2rem; text-align: center; }
.price-card.featured { border-color: var(--accent); }
.price-card .price { font-size: 2.5rem; font-weight: 700; font-family: 'Syne', sans-serif; color: var(--accent); }
.price-card .period { font-size: 0.875rem; color: var(--text-muted); }
.price-card ul { list-style: none; margin: 1.5rem 0; text-align: left; font-size: 0.875rem; color: var(--text-muted); }
.price-card ul li { padding: 0.4rem 0; display: flex; gap: 0.5rem; }
.price-card ul li::before { content: '✓'; color: var(--open); font-weight: 700; }

.footer { border-top: 1px solid var(--border); padding: 2rem 4rem; text-align: center; color: var(--text-muted); font-size: 0.8rem; }

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; padding: 3rem 2rem; }
  .features-grid { grid-template-columns: 1fr; }
  .steps-grid { grid-template-columns: 1fr 1fr; }
  .pricing-grid { grid-template-columns: 1fr; }
}

/* ─── App-specific ─── */
.app-layout { display: flex; min-height: 100vh; }
.sidebar { width: 220px; background: var(--surface); border-right: 1px solid var(--border); padding: 1.5rem 0; flex-shrink: 0; }
.sidebar-nav { display: flex; flex-direction: column; gap: 0.25rem; }
.sidebar-nav a { display: flex; align-items: center; gap: 0.75rem; padding: 0.6rem 1.25rem; color: var(--text-muted); font-size: 0.875rem; transition: all 0.15s; border-radius: 0; }
.sidebar-nav a:hover { color: var(--text); background: var(--surface-2); }
.sidebar-nav a.active { color: var(--accent); background: var(--accent-dim); }
.sidebar-nav a .icon { font-size: 1rem; width: 1.25rem; text-align: center; }
.main-content { flex: 1; overflow: hidden; }