/* ── Reset & Variables ───────────────────────────────────────────────────── */
:root {
  --bg:       #0d0d14;
  --surface:  #16161f;
  --surface2: #1e1e2a;
  --border:   rgba(255,255,255,0.08);
  --accent:   #6c63ff;
  --accent2:  #ff4d6d;
  --green:    #00e676;
  --yellow:   #ffd700;
  --text:     #e8e8f0;
  --muted:    #6b6b80;
  --radius:   10px;
  --sidebar:  220px;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
}

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

/* ── Layout admin ────────────────────────────────────────────────────────── */
.app-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
}

.sidebar-logo {
  padding: 20px 16px;
  border-bottom: 1px solid var(--border);
}
.sidebar-logo .logo-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.sidebar-logo .logo-icon {
  width: 28px; height: 28px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 8px;
  overflow-y: auto;
}

.nav-section {
  margin-bottom: 20px;
}
.nav-section-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 4px 8px;
  margin-bottom: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
  cursor: pointer;
  text-decoration: none;
}
.nav-item:hover { background: var(--surface2); color: var(--text); text-decoration: none; }
.nav-item.active { background: rgba(108,99,255,0.15); color: var(--accent); }
.nav-item svg { flex-shrink: 0; opacity: 0.7; }
.nav-item.active svg { opacity: 1; }

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

.main-content {
  margin-left: var(--sidebar);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  height: 56px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-title {
  font-size: 16px;
  font-weight: 700;
  flex: 1;
}
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

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

/* ── Composants ──────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.card-title {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 7px;
  border: none;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
  text-decoration: none;
}
.btn:hover { opacity: 0.85; text-decoration: none; }
.btn:active { transform: scale(0.97); }

.btn-primary   { background: var(--accent); color: #fff; }
.btn-danger    { background: var(--accent2); color: #fff; }
.btn-success   { background: var(--green); color: #000; }
.btn-ghost     { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn-sm        { padding: 5px 10px; font-size: 12px; }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
}
.badge-accent  { background: rgba(108,99,255,0.2); color: var(--accent); }
.badge-success { background: rgba(0,230,118,0.15); color: var(--green); }
.badge-danger  { background: rgba(255,77,109,0.15); color: var(--accent2); }
.badge-muted   { background: var(--surface2); color: var(--muted); }

/* ── Formulaires ──────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.form-control {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 9px 12px;
  color: var(--text);
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s;
}
.form-control:focus { border-color: var(--accent); }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 80px; }

.form-hint { font-size: 11px; color: var(--muted); margin-top: 4px; }
.form-error { font-size: 12px; color: var(--accent2); margin-top: 4px; }

/* ── Tableau ─────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--surface2); }

/* ── Stats cards ─────────────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.stat-value { font-size: 28px; font-weight: 800; line-height: 1; margin-bottom: 4px; }
.stat-label { font-size: 12px; color: var(--muted); }

/* ── Alert ───────────────────────────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: 7px;
  font-size: 13px;
  margin-bottom: 16px;
}
.alert-error   { background: rgba(255,77,109,0.1); border: 1px solid rgba(255,77,109,0.3); color: var(--accent2); }
.alert-success { background: rgba(0,230,118,0.1); border: 1px solid rgba(0,230,118,0.2); color: var(--green); }
.alert-info    { background: rgba(108,99,255,0.1); border: 1px solid rgba(108,99,255,0.2); color: var(--accent); }

/* ── Utilitaires ─────────────────────────────────────────────────────────── */
.flex   { display: flex; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-1 { flex: 1; }
.mt-4   { margin-top: 4px; }
.mt-8   { margin-top: 8px; }
.mt-16  { margin-top: 16px; }
.mt-24  { margin-top: 24px; }
.mb-8   { margin-bottom: 8px; }
.mb-16  { margin-bottom: 16px; }
.text-muted { color: var(--muted); }
.text-sm    { font-size: 12px; }
.fw-700     { font-weight: 700; }
.text-right { text-align: right; }

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.page-header h1 { font-size: 20px; font-weight: 800; }

.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--muted);
}
.empty-state svg { opacity: 0.3; margin-bottom: 12px; }
.empty-state p { font-size: 14px; }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .main-content { margin-left: 0; }
}
