/* ═══════════════════════════════════════════
   MailBlast — Feuille de style principale
   ═══════════════════════════════════════════ */

:root {
  --sidebar-bg:      #0f172a;
  --sidebar-hover:   #1e293b;
  --sidebar-active:  #6366f1;
  --sidebar-text:    #94a3b8;
  --sidebar-width:   240px;
  --accent:          #6366f1;
  --accent-light:    #818cf8;
  --topbar-height:   60px;
  --body-bg:         #f1f5f9;
  --card-bg:         #ffffff;
  --text:            #0f172a;
  --text-muted:      #64748b;
  --border:          #e2e8f0;
}

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

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--body-bg);
  color: var(--text);
  display: flex;
  min-height: 100vh;
}

/* ─── Sidebar ──────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 1000;
  transition: transform .25s ease;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 20px 16px;
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-brand i {
  font-size: 1.5rem;
  color: var(--accent-light);
}

.sidebar-nav {
  list-style: none;
  padding: 12px 10px;
  flex: 1;
  overflow-y: auto;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  color: var(--sidebar-text);
  text-decoration: none;
  border-radius: 8px;
  font-size: .9rem;
  transition: background .15s, color .15s;
}
.sidebar-link i { font-size: 1rem; width: 20px; text-align: center; }
.sidebar-link:hover { background: var(--sidebar-hover); color: #fff; }
.sidebar-link.active { background: var(--accent); color: #fff; }

.sidebar-divider {
  border-top: 1px solid rgba(255,255,255,.08);
  margin: 8px 10px;
  list-style: none;
}

.sidebar-footer {
  padding: 12px 20px;
  font-size: .75rem;
  color: rgba(255,255,255,.25);
}

/* ─── Contenu principal ──────────────────── */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.top-bar {
  height: var(--topbar-height);
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.page-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
}

.page-body {
  padding: 28px;
  flex: 1;
}

/* ─── Cartes KPI ─────────────────────────── */
.kpi-card {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 20px 24px;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 16px;
  transition: box-shadow .2s;
}
.kpi-card:hover { box-shadow: 0 4px 20px rgba(0,0,0,.08); }

.kpi-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}
.kpi-icon.indigo  { background: #eef2ff; color: var(--accent); }
.kpi-icon.green   { background: #f0fdf4; color: #16a34a; }
.kpi-icon.amber   { background: #fffbeb; color: #d97706; }
.kpi-icon.rose    { background: #fff1f2; color: #e11d48; }
.kpi-icon.sky     { background: #f0f9ff; color: #0284c7; }

.kpi-value { font-size: 1.75rem; font-weight: 700; line-height: 1; }
.kpi-label { font-size: .8rem; color: var(--text-muted); margin-top: 3px; }

/* ─── Cards génériques ───────────────────── */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.card-header {
  background: transparent;
  border-bottom: 1px solid var(--border);
  padding: 16px 20px;
  font-weight: 600;
  font-size: .95rem;
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-body { padding: 20px; }

/* ─── Tables ─────────────────────────────── */
.table-responsive { border-radius: 0 0 12px 12px; }
.table { margin-bottom: 0; font-size: .875rem; }
.table thead th {
  background: #f8fafc;
  font-weight: 600;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border);
  padding: 12px 16px;
  white-space: nowrap;
}
.table tbody td { padding: 12px 16px; vertical-align: middle; }
.table tbody tr:hover { background: #f8fafc; }

/* ─── Badges statuts ─────────────────────── */
.badge-status {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: 999px; font-size: .75rem; font-weight: 500;
}
.badge-draft    { background: #f1f5f9; color: #475569; }
.badge-sending  { background: #fef3c7; color: #92400e; }
.badge-sent     { background: #dcfce7; color: #15803d; }
.badge-paused   { background: #fee2e2; color: #b91c1c; }
.badge-active   { background: #dcfce7; color: #15803d; }
.badge-unsub    { background: #fef3c7; color: #92400e; }
.badge-bounced  { background: #fee2e2; color: #b91c1c; }

/* ─── Boutons ────────────────────────────── */
.btn-accent {
  background: var(--accent);
  color: #fff;
  border: none;
}
.btn-accent:hover { background: #4f46e5; color: #fff; }

/* ─── Progress bar envoi ─────────────────── */
.send-progress { display: none; }
.send-progress.active { display: block; }

/* ─── Barre de recherche ─────────────────── */
.search-box {
  position: relative;
}
.search-box i {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); pointer-events: none;
}
.search-box input { padding-left: 36px; }

/* ─── Editor layout ──────────────────────── */
.editor-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 20px;
  align-items: start;
}
.editor-sidebar .card { position: sticky; top: 80px; }

/* GrapesJS container */
#gjs {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

/* ─── Onglets custom ─────────────────────── */
.nav-tabs .nav-link { color: var(--text-muted); border: none; padding: 10px 18px; }
.nav-tabs .nav-link.active { color: var(--accent); border-bottom: 2px solid var(--accent); background: none; }
.nav-tabs { border-bottom: 1px solid var(--border); }

/* ─── Alerte flottante ───────────────────── */
#toast-container {
  position: fixed; bottom: 24px; right: 24px;
  z-index: 9999; display: flex; flex-direction: column; gap: 10px;
}
.toast-msg {
  padding: 12px 18px; border-radius: 10px;
  font-size: .875rem; font-weight: 500;
  box-shadow: 0 4px 20px rgba(0,0,0,.15);
  animation: slideIn .25s ease;
  display: flex; align-items: center; gap: 8px;
}
.toast-success { background: #16a34a; color: #fff; }
.toast-error   { background: #dc2626; color: #fff; }
.toast-info    { background: var(--accent); color: #fff; }
@keyframes slideIn { from { transform: translateX(60px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ─── Charts wrapper ─────────────────────── */
.chart-wrap { position: relative; height: 260px; }

/* ─── Responsive ─────────────────────────── */
@media (max-width: 991px) {
  .sidebar { transform: translateX(calc(-1 * var(--sidebar-width))); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .editor-layout { grid-template-columns: 1fr; }
  .editor-sidebar .card { position: static; }
}
