/* ── Reset & base ──────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body.admin { font-family: system-ui, -apple-system, sans-serif; background: #F0F7FF; min-height: 100vh; display: flex; flex-direction: column; }

/* ── Layout ────────────────────────────────────────────────────────────── */
.adm-layout { display: flex; min-height: 100vh; }
.adm-sidebar {
  width: 240px; flex-shrink: 0;
  background: #1B4FD8;
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; bottom: 0;
  overflow-y: auto; z-index: 200;
}
.adm-main { margin-left: 240px; flex: 1; display: flex; flex-direction: column; min-height: 100vh; }
.adm-topbar {
  background: #fff; border-bottom: 1px solid #E5EAF3;
  padding: 0 1.5rem; height: 60px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 100;
}
.adm-content { padding: 1.5rem; flex: 1; }

/* ── Sidebar ───────────────────────────────────────────────────────────── */
.adm-logo {
  padding: 1.25rem 1rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  display: flex; align-items: center; gap: 10px;
  text-decoration: none;
}
.adm-logo-text { font-size: 17px; font-weight: 700; color: #fff; }
.adm-logo-sub { font-size: 11px; color: #93C5FD; }
.adm-nav { padding: 0.75rem 0; flex: 1; }
.adm-nav-group { padding: 0.5rem 0.75rem 0.25rem; font-size: 10px; font-weight: 700; color: #93C5FD; letter-spacing: 0.08em; text-transform: uppercase; }
.adm-nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 1rem; margin: 2px 0.5rem;
  border-radius: 10px; text-decoration: none;
  color: #BFDBFE; font-size: 14px; font-weight: 500;
  transition: all 0.15s;
}
.adm-nav-link:hover { background: rgba(255,255,255,0.12); color: #fff; }
.adm-nav-link.active { background: rgba(255,255,255,0.18); color: #fff; font-weight: 600; }
.adm-nav-link .icon { font-size: 18px; width: 22px; text-align: center; }
.adm-sidebar-footer {
  padding: 0.75rem;
  border-top: 1px solid rgba(255,255,255,0.1);
}
.adm-logout {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 1rem; border-radius: 10px;
  text-decoration: none; color: #FCA5A5; font-size: 13px;
  transition: background 0.15s;
}
.adm-logout:hover { background: rgba(239,68,68,0.15); }

/* ── Topbar ────────────────────────────────────────────────────────────── */
.adm-topbar-title { font-size: 16px; font-weight: 700; color: #1E293B; }
.adm-topbar-user { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #64748B; }
.adm-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: #1B4FD8; color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 700;
}

/* ── Cards & sections ──────────────────────────────────────────────────── */
.adm-card {
  background: #fff; border-radius: 16px; padding: 1.25rem;
  border: 1px solid #E5EAF3; margin-bottom: 1rem;
}
.adm-card-title { font-size: 15px; font-weight: 700; color: #1E293B; margin-bottom: 0.75rem; display: flex; align-items: center; gap: 6px; }

/* ── Stat cards ────────────────────────────────────────────────────────── */
.adm-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; margin-bottom: 1.5rem; }
.adm-stat {
  background: #fff; border-radius: 16px; padding: 1.25rem;
  border: 1px solid #E5EAF3; text-align: center;
  transition: transform 0.15s; cursor: default;
}
.adm-stat:hover { transform: translateY(-2px); box-shadow: 0 4px 16px rgba(0,0,0,0.06); }
.adm-stat-icon { font-size: 32px; margin-bottom: 0.5rem; }
.adm-stat-value { font-size: 28px; font-weight: 700; color: #1E293B; }
.adm-stat-label { font-size: 12px; color: #94A3B8; margin-top: 2px; }

/* ── Boutons ───────────────────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 18px; border-radius: 20px; font-size: 13px; font-weight: 600; cursor: pointer; border: none; text-decoration: none; transition: all 0.15s; }
.btn-blue { background: #1B4FD8; color: #fff; }
.btn-blue:hover { background: #1A45C2; }
.btn-green { background: #22C55E; color: #fff; }
.btn-green:hover { background: #16A34A; }
.btn-orange { background: #F97316; color: #fff; }
.btn-orange:hover { background: #EA6C0A; }
.btn-red { background: #EF4444; color: #fff; }
.btn-red:hover { background: #DC2626; }
.btn-gray { background: #F1F5F9; color: #475569; }
.btn-gray:hover { background: #E2E8F0; }
.btn-danger-outline { background: #fff; color: #EF4444; border: 1.5px solid #EF4444; }
.btn-danger-outline:hover { background: #FEE2E2; }
.btn-sm { padding: 5px 12px; font-size: 12px; border-radius: 16px; }
.btn-icon { padding: 6px 10px; }

/* ── Icon picker (catégories) ──────────────────────────────────────────── */
.icon-picker { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.icon-pick-btn {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  width: 60px; padding: 8px 4px; border-radius: 10px;
  border: 2px solid #E5EAF3; background: #F8FAFC;
  cursor: pointer; transition: all 0.15s;
}
.icon-pick-btn:hover { border-color: #93C5FD; background: #EFF6FF; }
.icon-pick-btn.selected { border-color: #1B4FD8; background: #DBEAFE; color: #1B4FD8; }
.icon-pick-btn i { font-size: 20px; color: inherit; }
.icon-pick-none { font-size: 18px; color: #CBD5E1; line-height: 1; }
.icon-pick-label { font-size: 10px; text-align: center; line-height: 1.2; color: #64748B; }

/* ── Formulaires ───────────────────────────────────────────────────────── */
.adm-form-group { margin-bottom: 1.25rem; }
.adm-label { display: block; font-size: 13px; font-weight: 600; color: #374151; margin-bottom: 6px; }
.adm-input, .adm-select, .adm-textarea {
  width: 100%; padding: 10px 14px; border: 1.5px solid #E5EAF3; border-radius: 10px;
  font-size: 14px; color: #1E293B; background: #fff;
  transition: border-color 0.15s;
  font-family: inherit;
}
.adm-input:focus, .adm-select:focus, .adm-textarea:focus {
  outline: none; border-color: #3B82F6; box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}
.adm-textarea { min-height: 100px; resize: vertical; }
.adm-hint { font-size: 11px; color: #94A3B8; margin-top: 4px; }

/* ── Champ avec bouton IA ──────────────────────────────────────────────── */
.adm-field-row { display: flex; gap: 8px; align-items: flex-start; }
.adm-field-row .adm-input,
.adm-field-row .adm-textarea { flex: 1; }
.btn-ai {
  flex-shrink: 0;
  background: #fff; color: #7C3AED;
  border: 2px solid #8B5CF6; border-radius: 10px;
  padding: 10px 12px; font-size: 12px; font-weight: 600;
  cursor: pointer; white-space: nowrap; display: flex; align-items: center; gap: 5px;
  transition: background 0.15s, color 0.15s;
}
.btn-ai:hover { background: #F5F3FF; }
.btn-ai.btn-sm { padding: 6px 10px; }

/* ── Éditeur Quill ─────────────────────────────────────────────────────── */
.adm-editor-wrap { border: 1.5px solid #E5EAF3; border-radius: 10px; overflow: hidden; }
.adm-editor-wrap .ql-toolbar { background: #F8FAFC; border: none; border-bottom: 1px solid #E5EAF3; }
.adm-editor-wrap .ql-container { border: none; font-size: 15px; min-height: 300px; }
.adm-editor-wrap .ql-editor { padding: 1rem; min-height: 280px; }
.ql-toolbar .ql-formats { margin-right: 8px; }

/* ── Status toggle ─────────────────────────────────────────────────────── */
.status-toggle { display: flex; gap: 0; border: 1.5px solid #E5EAF3; border-radius: 12px; overflow: hidden; width: fit-content; }
.status-toggle input[type="radio"] { display: none; }
.status-toggle label {
  padding: 8px 20px; font-size: 13px; font-weight: 600; cursor: pointer;
  color: #94A3B8; background: #fff; transition: all 0.15s;
}
.status-toggle input[value="draft"]:checked + label { background: #FEF9C3; color: #854D0E; }
.status-toggle input[value="published"]:checked + label { background: #DCFCE7; color: #166534; }

/* ── Cover image drop zone ─────────────────────────────────────────────── */
.adm-dropzone {
  border: 2px dashed #CBD5E1; border-radius: 12px;
  padding: 1.5rem; text-align: center; cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  background: #F8FAFC;
}
.adm-dropzone:hover, .adm-dropzone.dragover { border-color: #3B82F6; background: #EFF6FF; }
.adm-dropzone-icon { font-size: 32px; margin-bottom: 8px; }
.adm-dropzone p { font-size: 13px; color: #64748B; }
.adm-dropzone-preview { position: relative; display: inline-block; margin-top: 10px; }
.adm-dropzone-preview img { max-height: 160px; border-radius: 8px; }
.adm-dropzone-clear {
  position: absolute; top: -8px; right: -8px;
  width: 24px; height: 24px; background: #EF4444; color: #fff;
  border-radius: 50%; border: none; font-size: 14px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}

/* ── Table articles ────────────────────────────────────────────────────── */
.adm-table { width: 100%; border-collapse: collapse; }
.adm-table th {
  text-align: left; padding: 10px 14px;
  font-size: 11px; font-weight: 700; color: #94A3B8; text-transform: uppercase; letter-spacing: 0.05em;
  border-bottom: 1px solid #E5EAF3;
}
.adm-table td { padding: 12px 14px; border-bottom: 1px solid #F1F5F9; font-size: 13px; color: #374151; vertical-align: middle; }
.adm-table tr:hover td { background: #F8FAFC; }
.adm-table tr:last-child td { border-bottom: none; }

/* ── Badge ─────────────────────────────────────────────────────────────── */
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 700; }
.badge-draft { background: #FEF9C3; color: #854D0E; }
.badge-published { background: #DCFCE7; color: #166534; }

/* ── Catégorie pill ────────────────────────────────────────────────────── */
.cat-pill { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }

/* ── Modal IA ──────────────────────────────────────────────────────────── */
.adm-modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.4);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; padding: 1rem;
}
.adm-modal-overlay.hidden { display: none; }
.adm-modal {
  background: #fff; border-radius: 20px; padding: 1.5rem;
  max-width: 860px; width: 100%; max-height: 90vh; overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.adm-modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.adm-modal-title { font-size: 17px; font-weight: 700; color: #1E293B; display: flex; align-items: center; gap: 8px; }
.adm-modal-close { background: none; border: none; font-size: 22px; cursor: pointer; color: #94A3B8; padding: 4px; border-radius: 8px; transition: background 0.15s; }
.adm-modal-close:hover { background: #F1F5F9; }
.adm-modal-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1rem; }
.adm-modal-col h4 { font-size: 12px; font-weight: 700; color: #94A3B8; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 8px; }
.adm-modal-text {
  background: #F8FAFC; border-radius: 10px; padding: 0.75rem;
  font-size: 14px; color: #374151; line-height: 1.6; min-height: 120px;
  border: 1px solid #E5EAF3;
}
.adm-modal-text.suggestion { background: #F0FDF4; border-color: #86EFAC; }
.adm-modal-loading { text-align: center; padding: 2rem; color: #94A3B8; font-size: 15px; }
.adm-modal-actions { display: flex; gap: 8px; justify-content: flex-end; }

/* ── Alerts ────────────────────────────────────────────────────────────── */
.alert { padding: 12px 16px; border-radius: 10px; font-size: 13px; margin-bottom: 1rem; }
.alert-success { background: #DCFCE7; color: #166534; }
.alert-error { background: #FEE2E2; color: #991B1B; }

/* ── Color swatches (catégories) ───────────────────────────────────────── */
.color-swatches { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.color-swatch {
  width: 28px; height: 28px; border-radius: 8px; cursor: pointer;
  border: 2px solid transparent; transition: border-color 0.1s;
}
.color-swatch:hover, .color-swatch.selected { border-color: #1B4FD8; }

/* ── Médiathèque ───────────────────────────────────────────────────────── */
.media-filter {
  background: #F1F5F9; color: #475569; border: none; border-radius: 20px;
  padding: 6px 14px; font-size: 13px; font-weight: 600; cursor: pointer; transition: all 0.15s;
}
.media-filter:hover { background: #E2E8F0; }
.media-filter.active { background: #1B4FD8; color: #fff; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.media-card {
  background: #F8FAFC; border: 1.5px solid #E5EAF3; border-radius: 12px;
  overflow: hidden; transition: border-color 0.15s;
}
.media-card:hover { border-color: #93C5FD; }
.media-card.selected { border: 2.5px solid #1B4FD8; box-shadow: 0 0 0 3px rgba(27,79,216,0.15); }
.media-thumb {
  height: 110px; display: flex; align-items: center; justify-content: center;
  background: #F1F5F9; overflow: hidden; cursor: pointer;
}
.media-thumb img { width: 100%; height: 100%; object-fit: cover; }
.media-info { padding: 8px; }
.media-name { font-size: 11px; font-weight: 600; color: #374151; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.media-size { font-size: 11px; color: #94A3B8; margin-top: 2px; }
.media-actions { display: flex; gap: 4px; }

/* ── Responsive ────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .adm-sidebar { width: 60px; }
  .adm-sidebar .adm-logo-text, .adm-sidebar .adm-logo-sub,
  .adm-sidebar .adm-nav-link span, .adm-sidebar .adm-nav-group { display: none; }
  .adm-main { margin-left: 60px; }
  .adm-modal-cols { grid-template-columns: 1fr; }
}
