/* ── Variables ──────────────────────────────────────────────────────────── */
:root {
  --bg:         #0f1117;
  --bg-2:       #161b27;
  --bg-3:       #1e2538;
  --border:     #2a3150;
  --text:       #e8eaf0;
  --text-muted: #8891a8;
  --accent:     #6c63ff;
  --accent-h:   #5a52e0;
  --green:      #2dce89;
  --red:        #f5365c;
  --yellow:     #ffb703;
  --blue:       #4299e1;
  --radius:     12px;
  --sidebar-w:  240px;
  --shadow:     0 4px 24px rgba(0,0,0,.4);
}

/* ── Reset ──────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Inter', sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; overflow: hidden; }
a { text-decoration: none; color: inherit; }
input, textarea, select { font-family: inherit; }
button { cursor: pointer; font-family: inherit; border: none; outline: none; }

/* ── Utilities ──────────────────────────────────────────────────────────── */
.hidden { display: none !important; }

/* ── Login ──────────────────────────────────────────────────────────────── */
.login-screen {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh;
  background: radial-gradient(ellipse at 60% 30%, #1a1f3a 0%, var(--bg) 70%);
}
.login-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 48px 40px;
  width: 380px;
  box-shadow: var(--shadow);
}
.login-logo { text-align: center; margin-bottom: 36px; }
.login-logo .logo-icon { font-size: 48px; }
.login-logo h1 { font-size: 22px; font-weight: 700; margin-top: 8px; }
.login-logo p  { color: var(--text-muted); font-size: 13px; margin-top: 4px; }

/* ── Forms ──────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; color: var(--text-muted); margin-bottom: 6px; font-weight: 500; }
.form-group input,
.form-group textarea,
.form-group select {
  width: 100%; padding: 10px 14px;
  background: var(--bg-3); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text); font-size: 14px;
  transition: border-color .2s;
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus { outline: none; border-color: var(--accent); }
.form-group textarea { resize: vertical; min-height: 100px; }

/* ── Buttons ────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 18px; border-radius: 8px; font-size: 14px; font-weight: 500;
  transition: all .2s; cursor: pointer;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-h); transform: translateY(-1px); }
.btn-secondary { background: var(--bg-3); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { border-color: var(--accent); }
.btn-danger { background: rgba(245,54,92,.15); color: var(--red); border: 1px solid rgba(245,54,92,.3); }
.btn-danger:hover { background: rgba(245,54,92,.25); }
.btn-success { background: rgba(45,206,137,.15); color: var(--green); border: 1px solid rgba(45,206,137,.3); }
.btn-success:hover { background: rgba(45,206,137,.25); }
.btn-full { width: 100%; justify-content: center; padding: 12px; }
.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: 6px; }

/* ── Alerts ─────────────────────────────────────────────────────────────── */
.alert { padding: 10px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 12px; }
.alert-error { background: rgba(245,54,92,.15); color: var(--red); border: 1px solid rgba(245,54,92,.3); }
.alert-success { background: rgba(45,206,137,.15); color: var(--green); border: 1px solid rgba(45,206,137,.3); }

/* ── App Layout ─────────────────────────────────────────────────────────── */
.app { display: flex; height: 100vh; overflow: hidden; }

/* ── Sidebar ────────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0;
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
}
.sidebar-header {
  display: flex; align-items: center; gap: 12px;
  padding: 20px 16px; border-bottom: 1px solid var(--border);
}
.sidebar-logo { font-size: 28px; }
.sidebar-title { font-weight: 700; font-size: 15px; }
.sidebar-sub { font-size: 11px; color: var(--text-muted); }
.sidebar-nav { flex: 1; padding: 12px 8px; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 8px;
  font-size: 14px; font-weight: 500; color: var(--text-muted);
  transition: all .15s; margin-bottom: 2px; position: relative;
}
.nav-item:hover { background: var(--bg-3); color: var(--text); }
.nav-item.active { background: rgba(108,99,255,.15); color: var(--accent); }
.nav-icon { font-size: 16px; }
.badge {
  margin-left: auto;
  background: var(--red); color: #fff;
  font-size: 10px; font-weight: 700;
  padding: 2px 6px; border-radius: 10px;
}
.sidebar-footer { padding: 12px 8px; border-top: 1px solid var(--border); }
.btn-logout {
  width: 100%; padding: 9px; border-radius: 8px; font-size: 13px;
  background: transparent; color: var(--text-muted);
  border: 1px solid var(--border); transition: all .2s;
}
.btn-logout:hover { border-color: var(--red); color: var(--red); }

/* ── Main ───────────────────────────────────────────────────────────────── */
.main { flex: 1; overflow-y: auto; }
.page { display: none; padding: 32px; animation: fadeIn .2s; }
.page.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ── Page Header ────────────────────────────────────────────────────────── */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 28px; }
.page-title { font-size: 22px; font-weight: 700; }
.page-subtitle { color: var(--text-muted); font-size: 13px; margin-top: 2px; }

/* ── Stats Grid ─────────────────────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 28px; }
.stat-card {
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
  display: flex; flex-direction: column; gap: 8px;
}
.stat-label { font-size: 12px; color: var(--text-muted); font-weight: 500; text-transform: uppercase; letter-spacing: .5px; }
.stat-value { font-size: 32px; font-weight: 700; }
.stat-accent { color: var(--accent); }
.stat-green  { color: var(--green); }
.stat-yellow { color: var(--yellow); }
.stat-blue   { color: var(--blue); }

/* ── Table ──────────────────────────────────────────────────────────────── */
.table-wrap { background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.table-toolbar {
  display: flex; align-items: center; gap: 10px; padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.search-input {
  flex: 1; max-width: 300px;
  padding: 8px 12px; background: var(--bg-3);
  border: 1px solid var(--border); border-radius: 7px;
  color: var(--text); font-size: 13px;
}
.search-input:focus { outline: none; border-color: var(--accent); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  background: var(--bg-3); color: var(--text-muted); font-weight: 600;
  font-size: 11px; text-transform: uppercase; letter-spacing: .5px;
  padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border);
}
td { padding: 12px 14px; border-bottom: 1px solid rgba(42,49,80,.5); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,.02); }
.table-actions { display: flex; gap: 6px; }

/* ── Status badges ──────────────────────────────────────────────────────── */
.status { display: inline-block; padding: 3px 9px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.status-sent     { background: rgba(45,206,137,.15); color: var(--green); }
.status-sending  { background: rgba(255,183,3,.15);  color: var(--yellow); }
.status-draft    { background: rgba(136,145,168,.15); color: var(--text-muted); }
.status-failed   { background: rgba(245,54,92,.15);  color: var(--red); }
.status-read     { background: rgba(45,206,137,.1);  color: var(--green); }
.status-unread   { background: rgba(108,99,255,.15); color: var(--accent); }

/* ── Cards ──────────────────────────────────────────────────────────────── */
.card {
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; margin-bottom: 16px;
}
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.card-title { font-size: 15px; font-weight: 600; }

/* ── Accordion (FAQ categories) ─────────────────────────────────────────── */
.accordion { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.acc-item { border-bottom: 1px solid var(--border); }
.acc-item:last-child { border-bottom: none; }
.acc-header {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px; cursor: pointer; background: var(--bg-2);
  transition: background .15s;
}
.acc-header:hover { background: var(--bg-3); }
.acc-title { flex: 1; font-weight: 500; }
.acc-body { background: var(--bg); padding: 0 16px; max-height: 0; overflow: hidden; transition: max-height .25s ease, padding .25s; }
.acc-body.open { max-height: 1000px; padding: 12px 16px; }

/* ── Mailing wizard ─────────────────────────────────────────────────────── */
.wizard-steps { display: flex; gap: 0; margin-bottom: 28px; }
.wizard-step {
  flex: 1; padding: 10px; text-align: center; font-size: 12px; font-weight: 600;
  color: var(--text-muted); border-bottom: 2px solid var(--border);
  transition: all .2s;
}
.wizard-step.active { color: var(--accent); border-bottom-color: var(--accent); }
.wizard-step.done   { color: var(--green);  border-bottom-color: var(--green); }

/* ── Tag pills ──────────────────────────────────────────────────────────── */
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px; border-radius: 20px; font-size: 12px; font-weight: 500;
  background: rgba(108,99,255,.15); color: var(--accent); border: 1px solid rgba(108,99,255,.3);
}
.tag-remove { cursor: pointer; opacity: .6; }
.tag-remove:hover { opacity: 1; color: var(--red); }

/* ── Progress bar ───────────────────────────────────────────────────────── */
.progress-bar { height: 6px; background: var(--bg-3); border-radius: 3px; overflow: hidden; margin-top: 8px; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--green)); border-radius: 3px; transition: width .5s; }

/* ── Empty state ────────────────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-state .empty-icon { font-size: 48px; margin-bottom: 12px; }
.empty-state p { font-size: 14px; }

/* ── Modal ──────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.6); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; z-index: 1000;
}
.modal {
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: 16px; width: 520px; max-width: 96vw;
  max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow);
  animation: modalIn .2s;
}
@keyframes modalIn { from { opacity: 0; transform: scale(.95); } to { opacity: 1; transform: none; } }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.modal-header h3 { font-size: 16px; font-weight: 600; }
.modal-close { background: none; color: var(--text-muted); font-size: 18px; padding: 2px 6px; border-radius: 4px; transition: color .15s; }
.modal-close:hover { color: var(--text); }
.modal-body  { padding: 20px; }
.modal-footer { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; }

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