/* ============================================================
   MedNews — socle CSS des pages admin
   Source de vérité unique : tokens, header, drawer, toast,
   couleurs DA des 3 catégories éditoriales.
   Chargé par toutes les pages admin (review, signalements,
   étudiants, newsletter, comptes) — même rôle que auth.css
   pour les pages d'authentification. Ne jamais dupliquer ces
   règles dans une page : toute retouche passe par ce fichier.
   ============================================================ */

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

/* ── Tokens — neutres slate de la charte (mêmes que le portail) ── */
:root {
  --bg: #F8FAFC;
  --surface: #FFFFFF;
  --surface2: #F1F5F9;
  --border: #E2E8F0;
  --border-strong: #CBD5E1;
  --text: #0F172A;
  --text2: #475569;
  --text3: #94A3B8;
  --green: #10b981;
  --red: #ef4444;
  --amber: #f59e0b;
  --blue: #3b82f6;
  --purple: #8b5cf6;
  --radius: 6px;
  --green-dark: #d1fae5;
  --red-dark: #fee2e2;
  --amber-dark: #fef3c7;

  /* Marque */
  --brand: #A60D39;
  --brand-deep: #50061D;
  /* « Med » du sigle. Sur fond clair c'est le bordeaux ; sur fond sombre il
     s'éteint dans le cramoisi, d'où le rose de la charte (le même que les
     cartes de connexion, la landing et le voile de démarrage natif). */
  --med: #A60D39;
  --accent: #A60D39;
  --accent-metal: linear-gradient(168deg, #C2153F 0%, #A60D39 52%, #7E0A2C 100%);

  /* Catégories éditoriales (DA portail — tuiles satinées) :
     réglementaire = navy royal, recommandation = vert anglais,
     innovation = cramoisi velours. -ink = version texte lisible
     sur fond de page (éclaircie en dark). */
  --cat-reglo: #2B3D6A;  --cat-reglo-deep: #15203C;  --cat-reglo-ink: #2B3D6A;
  --cat-reco:  #15533F;  --cat-reco-deep:  #082A1F;  --cat-reco-ink:  #15533F;
  --cat-innov: #A60D39;  --cat-innov-deep: #50061D;  --cat-innov-ink: #A60D39;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0F1117;
    --surface: #161B27;
    --surface2: #1E2535;
    --border: #2A3444;
    --border-strong: #3D4F66;
    --text: #E2E8F0;
    --text2: #94A3B8;
    --text3: #64748B;
    --green-dark: #064e3b;
    --red-dark: #450a0a;
    --amber-dark: #451a03;
    --accent: #E03A66;
    --med: #F0BCCB;
    --cat-reglo-ink: #93a7dd;
    --cat-reco-ink:  #5dbd98;
    --cat-innov-ink: #e2708f;
  }
}

/* Choix explicite de l'utilisateur (réglage portail « Apparence », posé par
   shared.js sur <html data-theme>) : doit gagner sur le thème système dans
   les deux sens — même mécanique qu'auth.css. */
:root[data-theme="light"] {
  --bg: #F8FAFC;
  --surface: #FFFFFF;
  --surface2: #F1F5F9;
  --border: #E2E8F0;
  --border-strong: #CBD5E1;
  --text: #0F172A;
  --text2: #475569;
  --text3: #94A3B8;
  --green-dark: #d1fae5;
  --red-dark: #fee2e2;
  --amber-dark: #fef3c7;
  --accent: #A60D39;
  --med: #A60D39;
  --cat-reglo-ink: #2B3D6A;
  --cat-reco-ink:  #15533F;
  --cat-innov-ink: #A60D39;
}
:root[data-theme="dark"] {
  --bg: #0F1117;
  --surface: #161B27;
  --surface2: #1E2535;
  --border: #2A3444;
  --border-strong: #3D4F66;
  --text: #E2E8F0;
  --text2: #94A3B8;
  --text3: #64748B;
  --green-dark: #064e3b;
  --red-dark: #450a0a;
  --amber-dark: #451a03;
  --accent: #E03A66;
  --med: #F0BCCB;
  --cat-reglo-ink: #93a7dd;
  --cat-reco-ink:  #5dbd98;
  --cat-innov-ink: #e2708f;
}

/* Fond posé sur <html> + color-scheme (le pré-paint inline des pages couvre
   la fenêtre de chargement de ce fichier). */
html { background: var(--bg); color-scheme: light dark; }
html[data-theme="light"] { color-scheme: light; }
html[data-theme="dark"]  { color-scheme: dark; }

body {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  overflow-x: hidden;
  min-height: 100vh; /* le fond couvre le viewport même sur document court */
}

/* ── Header admin ───────────────────────────────────────────── */
header.admin-header {
  background: var(--surface); border-bottom: 1px solid var(--border);
  padding: 0 24px; height: 48px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 100;
}

.header-left { display: flex; align-items: center; gap: 10px; }

.header-logo {
  font-family: 'Instrument Serif', Georgia, serif;
  font-size: 1.25rem; font-weight: 400; color: var(--text);
  letter-spacing: -0.2px; line-height: 1;
  text-decoration: none;
}
/* Charte titre MedNews : « Med » en rose sur fond sombre, en bordeaux sur fond
   clair ; « News » suit le fond. */
.header-logo em { font-style: italic; color: var(--med, #A60D39); }

.header-sep {
  color: var(--border-strong); font-weight: 300;
  font-size: 1rem; line-height: 1; user-select: none;
}

.header-admin-chip {
  font-size: 0.6875rem; font-weight: 600; color: var(--text3);
  background: var(--surface2); border: 1px solid var(--border);
  padding: 2px 8px; border-radius: 100px;
  letter-spacing: 0.3px; text-transform: uppercase;
}

.header-right { display: flex; align-items: center; gap: 4px; }

.header-nav-link {
  font-size: 0.8125rem; font-weight: 500; color: var(--text2);
  text-decoration: none; padding: 5px 10px; border-radius: 5px;
  transition: background 0.12s, color 0.12s;
  white-space: nowrap; flex-shrink: 0;
}
.header-nav-link:hover { background: var(--surface2); color: var(--text); }
.header-nav-link.active { color: var(--text); background: var(--surface2); }

.btn-logout {
  padding: 4px 12px; background: transparent;
  border: 1px solid var(--border); color: var(--text2);
  border-radius: 5px; font-size: 0.8125rem; font-weight: 500;
  cursor: pointer; font-family: inherit;
  transition: background 0.12s, border-color 0.12s, color 0.12s; height: 30px;
}
.btn-logout:hover { background: var(--surface2); border-color: var(--border-strong); color: var(--text); }

/* ── Tiroir de navigation mobile ────────────────────────────── */
.mobile-menu-btn {
  display: none;
  background: none; border: 1px solid var(--border); border-radius: 5px;
  padding: 5px 8px; cursor: pointer; color: var(--text2);
  -webkit-tap-highlight-color: transparent; height: 30px;
  align-items: center; justify-content: center;
}
.mobile-nav-drawer {
  display: none; position: fixed;
  top: 48px; left: 0; right: 0;
  background: var(--surface); border-bottom: 1px solid var(--border);
  z-index: 99; padding: 4px 0;
  box-shadow: 0 8px 24px rgba(0,0,0,.18);
}
.mobile-nav-drawer.open { display: block; }
.drawer-link, .drawer-btn {
  display: block; padding: 14px 20px; width: 100%;
  font-size: 0.9375rem; font-weight: 500; color: var(--text2);
  text-decoration: none; background: none; border: none;
  text-align: left; cursor: pointer; font-family: inherit;
  -webkit-tap-highlight-color: transparent;
  transition: background .1s;
}
.drawer-link:hover, .drawer-btn:hover { background: var(--surface2); color: var(--text); }
.drawer-link.active { color: var(--text); font-weight: 600; }
.drawer-btn { color: var(--red); border-top: 1px solid var(--border); margin-top: 4px; }

/* Le tiroir prend le relais AVANT que les liens du header ne se fassent
   écraser (5 liens + Déconnexion ne tiennent plus sous ~960px). */
@media (max-width: 960px) {
  .header-nav-link, .btn-logout { display: none !important; }
  .mobile-menu-btn { display: flex; }
}
@media (max-width: 768px) {
  header.admin-header { padding: 0 14px; }
}
@media (max-width: 480px) {
  .header-logo { font-size: 1.0625rem; }
}

/* ── Toast ──────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  padding: 9px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  z-index: 300;
  animation: mnToastIn 0.25s ease;
  color: #fff;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.toast.success { background: var(--green); }
.toast.error   { background: var(--red); }
@keyframes mnToastIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Modales admin (entrée fondu + pop, sortie via mnModalClose) ── */
@keyframes mnFadeIn { from { opacity: 0; } }
@keyframes mnFadeOut { to { opacity: 0; } }
@keyframes mnPopIn { from { transform: scale(.96); opacity: 0; } }
