/* Synaptik — système visuel.
   Direction : sobre & pro. Gris neutres, UNE couleur d'accent, beaucoup d'air.
   Aucune classe utilitaire : uniquement des composants nommés, pour que la page
   suivante se compose au lieu de se réinventer. */

:root {
  /* Fonds et surfaces */
  --bg:            #0b0d10;
  --surface:       #14171b;
  --surface-hover: #1a1e23;
  --border:        #23282e;
  --border-strong: #313840;

  /* Texte */
  --text:       #e8eaed;
  --text-muted: #9ba3ad;
  --text-faint: #6e7781;

  /* Accent unique */
  --accent:       #4d7cfe;
  --accent-hover: #6b91ff;
  --accent-fg:    #ffffff;

  /* Sémantique */
  --success: #3fb950;
  --warning: #d29922;
  --danger:  #f85149;

  /* Typographie */
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
          "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --fs-xs:  0.75rem;
  --fs-sm:  0.875rem;
  --fs-md:  1rem;
  --fs-lg:  1.125rem;
  --fs-xl:  1.5rem;
  --fs-2xl: 2rem;

  /* Espacement */
  --sp-1: 0.25rem;
  --sp-2: 0.5rem;
  --sp-3: 0.75rem;
  --sp-4: 1rem;
  --sp-5: 1.5rem;
  --sp-6: 2rem;
  --sp-8: 3rem;

  /* Rayons */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;

  --sidebar-w: 240px;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--fs-sm);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* Les compteurs et chronos ne doivent pas tressauter quand les chiffres changent. */
time, .card__meta, .faint { font-variant-numeric: tabular-nums; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

/* ── Coque ─────────────────────────────────────────────────────────────── */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: var(--sp-5);
  padding: var(--sp-5) var(--sp-4);
  background: var(--surface);
  border-right: 1px solid var(--border);
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar__brand {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--fs-lg);
  font-weight: 650;
  letter-spacing: -0.01em;
  padding: 0 var(--sp-2);
  text-decoration: none;
  color: var(--text);
}

.sidebar__nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar__footer { margin-top: auto; display: flex; flex-direction: column; gap: var(--sp-3); }

.nav-item {
  display: block;
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-sm);
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease;
}
.nav-item:hover { background: var(--surface-hover); color: var(--text); }
/* La déconnexion est un bouton (POST), pas un lien : elle doit s'aligner sur les
   autres entrées sans en avoir l'apparence par défaut. */
.nav-item--button {
  width: 100%; text-align: left;
  background: none; border: 0; font: inherit; font-weight: 500;
}
.nav-item--active {
  background: var(--surface-hover);
  color: var(--text);
  box-shadow: inset 2px 0 0 var(--accent);
}

.main { padding: var(--sp-6) var(--sp-8); min-width: 0; }

/* ── Page ──────────────────────────────────────────────────────────────── */
.page__header { margin-bottom: var(--sp-6); }
.page__title  { font-size: var(--fs-xl); font-weight: 650; letter-spacing: -0.02em; margin: 0; }
.page__sub    { color: var(--text-muted); margin: var(--sp-1) 0 0; font-size: var(--fs-sm); font-weight: 550; }

.stack        { display: flex; flex-direction: column; gap: var(--sp-6); }
.stack--tight { display: flex; flex-direction: column; gap: var(--sp-3); }
.grid-cards   { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: var(--sp-4); }

.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); font-size: var(--fs-xs); }

/* Sur petit écran, la sidebar passe au-dessus du contenu. */
@media (max-width: 780px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; }
  .sidebar__nav { flex-direction: row; flex-wrap: wrap; }
  .sidebar__footer { margin-top: 0; }
  .main { padding: var(--sp-5) var(--sp-4); }
}

/* ── Cartes ────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.card__media {
  aspect-ratio: 9 / 16;
  background: #000;
  display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: var(--sp-4);
  padding: var(--sp-4);
}
.card__media video, .card__media img { width: 100%; height: 100%; object-fit: cover; }
.card__body  { padding: var(--sp-4); display: flex; flex-direction: column; gap: var(--sp-3); }
.card__title { margin: 0; font-weight: 550; line-height: 1.4; }
.card__subtitle { margin: var(--sp-4) 0 0; font-weight: 550; line-height: 1.4;
                  font-size: var(--fs-sm); color: var(--text-muted); }
.card__meta  { margin: 0; color: var(--text-faint); font-size: var(--fs-xs); }

/* ── Boutons ───────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-4);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  background: var(--surface-hover);
  color: var(--text);
  font: inherit; font-weight: 550;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}
.btn:hover          { background: var(--border); }
.btn--primary       { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.btn--primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn--ghost         { background: transparent; border-color: var(--border); color: var(--text-muted); }
.btn--ghost:hover   { background: var(--surface-hover); color: var(--text); }
.btn--danger        { background: transparent; border-color: var(--border); color: var(--danger); }
.btn--danger:hover  { background: rgba(248, 81, 73, 0.12); border-color: var(--danger); }
.btn--block         { width: 100%; }

/* ── Badges ────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: var(--sp-1);
  padding: 2px var(--sp-2);
  border-radius: 999px;
  font-size: var(--fs-xs); font-weight: 550;
  background: var(--surface-hover); color: var(--text-muted);
  width: fit-content;
}
.badge--ok   { background: rgba(63, 185, 80, 0.14);  color: var(--success); }
.badge--warn { background: rgba(210, 153, 34, 0.14); color: var(--warning); }
.badge--err  { background: rgba(248, 81, 73, 0.14);  color: var(--danger); }

/* ── Formulaires ───────────────────────────────────────────────────────── */
.field        { display: flex; flex-direction: column; gap: var(--sp-2); }
.field__label { font-weight: 550; color: var(--text-faint); font-size: var(--fs-xs);
                text-transform: uppercase; letter-spacing: 0.04em; }
.input, .select, .textarea {
  width: 100%;
  padding: var(--sp-2) var(--sp-3);
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  color: var(--text);
  font: inherit;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(77, 124, 254, 0.2);
}
.textarea { min-height: 12rem; resize: vertical; font-family: var(--font-mono);
            font-size: var(--fs-xs); line-height: 1.6; }

/* Sélecteur de couleur : même cadre que les autres champs, mais la pastille occupe
   toute la surface — le rendu natif du navigateur est minuscule et illisible. */
.input--couleur { height: 2.5rem; padding: var(--sp-1); cursor: pointer; }
.input--couleur::-webkit-color-swatch-wrapper { padding: 0; }
.input--couleur::-webkit-color-swatch { border: none; border-radius: var(--r-sm); }
.input--couleur::-moz-color-swatch { border: none; border-radius: var(--r-sm); }

/* ── Tableau ───────────────────────────────────────────────────────────── */
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left; font-size: var(--fs-xs); font-weight: 550;
  color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.04em;
  padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--border);
}
.table td { padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--border); }
.table tr:last-child td { border-bottom: 0; }

/* ── Bandeaux ──────────────────────────────────────────────────────────── */
.banner {
  padding: var(--sp-3) var(--sp-4);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  background: var(--surface);
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4);
}
.banner--info { border-color: var(--accent);  background: rgba(77, 124, 254, 0.10); }
.banner--warn { border-color: var(--warning); background: rgba(210, 153, 34, 0.10); color: #f0d68a; }
.banner--err  { border-color: var(--danger);  background: rgba(248, 81, 73, 0.10);  color: #ffb3ae; }

/* ── Progression ───────────────────────────────────────────────────────── */
.progress {
  width: 100%; height: 4px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
}
.progress__bar {
  height: 100%; width: 0;
  background: var(--accent);
  border-radius: 999px;
  transition: width 400ms ease;
}

/* ── Stepper : les 7 étapes du pipeline ────────────────────────────────────
   Élément signature. Un short ne « charge » pas : il traverse une chaîne de
   fabrication nommée. Montrer la chaîne entière, et où on en est, dit à la
   personne ce qui reste — ce qu'aucune barre anonyme ne peut faire. */
.stepper { display: flex; flex-direction: column; gap: var(--sp-2); width: 100%; }
.stepper__step {
  display: flex; align-items: center; gap: var(--sp-3);
  font-size: var(--fs-xs);
  color: var(--text-faint);
}
.stepper__step::before {
  content: "";
  width: 7px; height: 7px; flex: none;
  border-radius: 999px;
  background: var(--border-strong);
}
.stepper__step--done { color: var(--text-muted); }
.stepper__step--done::before { background: var(--success); }
.stepper__step--current {
  color: var(--text);
  font-weight: 600;
}
.stepper__step--current::before {
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(77, 124, 254, 0.25);
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(77, 124, 254, 0.25); }
  50%      { box-shadow: 0 0 0 6px rgba(77, 124, 254, 0.08); }
}
.stepper__elapsed {
  margin-left: auto;
  font-variant-numeric: tabular-nums;
  color: var(--text-faint);
}

/* ── Calendrier de publication ─────────────────────────────────────────── */
.calendar__nav {
  display: flex; align-items: center; justify-content: center; gap: var(--sp-4);
  margin-bottom: var(--sp-4);
}
.calendar__label { font-size: var(--fs-lg); font-weight: 550; }

.calendar__grid {
  display: grid; grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 1px; background: var(--border);
  border: 1px solid var(--border); border-radius: var(--r-md);
  overflow: hidden;
}
.calendar__head {
  background: var(--surface); padding: var(--sp-2) var(--sp-3);
  font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--text-faint);
}
.calendar__day {
  background: var(--surface); min-height: 6.5rem;
  padding: var(--sp-2); display: flex; flex-direction: column; gap: var(--sp-2);
}
.calendar__day--outside { background: var(--bg); }
.calendar__day--outside .calendar__num { color: var(--text-faint); }
.calendar__day--today { box-shadow: inset 0 0 0 1px var(--accent); }
.calendar__num { font-size: var(--fs-xs); color: var(--text-muted); }

.calendar__slot {
  display: flex; flex-direction: column; gap: 2px;
  padding: var(--sp-2); border-radius: var(--r-sm);
  background: var(--surface-hover); border-left: 2px solid var(--accent);
  font-size: var(--fs-xs);
}
.calendar__slot--overdue { border-left-color: var(--warning); }
.calendar__time { color: var(--text-muted); }
.calendar__name { overflow-wrap: anywhere; }

/* Sur petit écran, une grille de 7 colonnes devient illisible : on empile. */
@media (max-width: 780px) {
  .calendar__grid { grid-template-columns: 1fr; }
  .calendar__head { display: none; }
  .calendar__day { min-height: 0; }
  .calendar__day--outside { display: none; }
}
.calendar__add {
  cursor: pointer; list-style: none;
  font-size: var(--fs-xs); color: var(--text-faint);
}
.calendar__add:hover { color: var(--accent); }
.calendar__day details[open] {
  background: var(--surface-hover); border-radius: var(--r-sm); padding: var(--sp-2);
}
