/* ============================================================
   CURSUS — style noir / blanc, accent indigo
   Mêmes couleurs et même police que le tuteur IA (affiché dans le site).
   ============================================================ */

:root {
  --fond: #080d16;
  --panneau: #101827;
  --degrade-carte: linear-gradient(135deg, #172236 0%, #0e1522 100%);

  --accent: #2776dc;
  --accent-clair: #69aeff;

  --blanc: #ffffff;
  --texte: #eef3fa;
  --texte-doux: #a3adbd;
  --texte-plus-doux: #6b7587;
  --bordure: rgba(255, 255, 255, 0.1);

  --vert: #2fae6b;
  --vert-clair: #6fe0a6;
  --rouge: #ef5257;

  /* Voiles translucides (blanc en sombre, bleu nuit en clair) */
  --v04: rgba(255,255,255,0.04); --v05: rgba(255,255,255,0.05); --v06: rgba(255,255,255,0.06);
  --v07: rgba(255,255,255,0.07); --v08: rgba(255,255,255,0.08); --v10: rgba(255,255,255,0.10);
  --v12: rgba(255,255,255,0.12); --v14: rgba(255,255,255,0.14); --v18: rgba(255,255,255,0.18);
  --panneau-2: #172236; --panneau-3: #1e2b43; --menu-fond: #172236;
  --entete-fond: rgba(16,24,39, 0.88); --fond-voile: rgba(8,13,22, 0.85);
  --ombre: rgba(0, 0, 0, 0.4); --sur-accent: #ffffff; --or-fond: #24211a;
  color-scheme: dark;

  --police: "Plus Jakarta Sans", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --police-titre: "Plus Jakarta Sans", "Segoe UI", system-ui, sans-serif;
}

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

/* Garantit que "hidden" cache vraiment l'élément, même si une autre
   règle plus bas dans ce fichier lui donne un display (flex, grid...). */
[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: var(--police);
  font-size: 1rem;
  line-height: 1.5;
  color: var(--texte);
  background: var(--fond);
}

h1, h2, h3 { line-height: 1.25; margin: 0 0 0.6rem; font-weight: 700; color: var(--blanc); }
h1 { font-size: clamp(1.5rem, 4vw, 1.9rem); letter-spacing: -0.01em; }
h2 { font-size: 1.15rem; }
p  { margin: 0 0 1rem; }
a  { color: var(--accent-clair); text-decoration: none; }
a:hover { color: var(--accent); text-decoration: underline; }

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- Boutons ---------- */
.bouton {
  display: inline-block;
  font: 700 0.9rem var(--police);
  color: var(--sur-accent);
  background: var(--accent);
  border: none;
  border-radius: 8px;
  padding: 0.7rem 1.35rem;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  box-shadow: 0 4px 14px rgba(39,118,220, 0.3);
  transition: background 0.25s, transform 0.25s, box-shadow 0.25s;
}
.bouton:hover { background: var(--accent-clair); transform: translateY(-2px); box-shadow: 0 8px 22px rgba(39,118,220, 0.4); text-decoration: none; }
.bouton[disabled] { opacity: 0.6; cursor: wait; transform: none; }
.bouton-secondaire { background: transparent; color: var(--blanc); border: 1.5px solid var(--bordure); box-shadow: none; }
.bouton-secondaire:hover { background: var(--panneau); color: var(--blanc); transform: none; }
.bouton-plein { width: 100%; }
.bouton-danger { background: transparent; color: var(--rouge); border: 1.5px solid var(--rouge); box-shadow: none; }
.bouton-danger:hover { background: rgba(239, 82, 87, 0.12); color: var(--rouge); transform: none; }
.bouton-petit { padding: 0.45rem 0.9rem; font-size: 0.8rem; }

/* ---------- Pages d'accueil / connexion / inscription ---------- */
.auth {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr;
  background: var(--fond);
}

.marches {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1.5rem;
  background: var(--panneau);
}
.marque {
  font-family: var(--police-titre);
  font-size: 2.1rem;
  font-weight: 800;
  color: var(--blanc);
  margin: 0;
  letter-spacing: -0.02em;
}
.marque::after { content: "."; color: var(--accent); }

.escalier { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.6rem; max-width: 22rem; }
.escalier li {
  font-weight: 700;
  font-size: 1.02rem;
  padding: 0.7rem 1.1rem;
  border-radius: 999px;
  background: var(--fond);
  color: var(--texte);
  border: 1px solid var(--bordure);
  width: fit-content;
}
.escalier li::before { content: "— "; color: var(--accent); }
.devise { color: var(--texte-doux); max-width: 24rem; font-size: 1.1rem; line-height: 1.4; margin: 0; }

.panneau {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.25rem;
  background: var(--fond);
}
.carte {
  width: 100%;
  max-width: 26rem;
  background: var(--degrade-carte);
  border: 1px solid var(--bordure);
  border-radius: 12px;
  box-shadow: 0 20px 45px var(--ombre);
  padding: 1.85rem;
}
.introduction { color: var(--texte-doux); }

@media (min-width: 860px) {
  .auth { grid-template-columns: 6fr 6fr; }
  .marches { padding: 2.5rem 3rem; }
}

/* ---------- Formulaires ---------- */
.champ { margin-bottom: 1rem; }
.champ label { display: block; font-weight: 700; font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.4px; color: var(--texte-doux); margin-bottom: 0.35rem; }
.champ input,
.champ select {
  width: 100%;
  font: inherit;
  color: var(--texte);
  background: var(--fond);
  border: 1px solid var(--bordure);
  border-radius: 6px;
  padding: 0.65rem 0.8rem;
}
.champ input:focus,
.champ select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(39,118,220, 0.2); }
.aide { display: block; font-size: 0.8rem; color: var(--texte-plus-doux); margin-top: 0.3rem; }

.message { padding: 0.7rem 0.9rem; border-radius: 6px; margin-bottom: 1rem; font-weight: 500; font-size: 0.9rem; border-left: 3px solid transparent; }
.message-erreur { background: rgba(239, 82, 87, 0.12); color: var(--rouge); border-left-color: var(--rouge); }
.message-succes { background: rgba(47, 174, 107, 0.18); color: var(--vert-clair); border-left-color: var(--vert-clair); }

.pied-formulaire { margin-top: 1.1rem; color: var(--texte-doux); font-size: 0.9rem; }
.actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin: 1.5rem 0; }

/* ---------- Tableau de bord ---------- */
.entete {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1.25rem;
  background: var(--panneau);
  border-bottom: 1px solid var(--bordure);
}
.entete .marque { font-size: 1.3rem; }

.contenu { max-width: 46rem; margin: 0 auto; padding: 1.5rem 1.25rem 3rem; }

.bandeau {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  background: var(--degrade-carte);
  border: 1px solid var(--bordure);
  border-left: 4px solid var(--vert-clair);
  border-radius: 10px;
}
.bandeau-expire { border-left-color: var(--rouge); }
.bandeau p { margin: 0; color: var(--texte); }

.salons { display: grid; gap: 0.9rem; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); margin-bottom: 1.5rem; }
.salon {
  display: block;
  background: var(--degrade-carte);
  border: 1px solid var(--bordure);
  border-radius: 12px;
  padding: 1.2rem 1.3rem;
  text-decoration: none;
  color: inherit;
  transition: transform 0.25s, border-color 0.25s;
}
.salon h2 { color: var(--blanc); font-size: 1.1rem; }
a.salon:hover { transform: translateY(-4px); border-color: var(--accent); text-decoration: none; }
.salon p { color: var(--texte-doux); margin: 0; font-size: 0.9rem; }

/* ---------- Documentation ---------- */
.fil-ariane { margin-bottom: 1.25rem; font-size: 0.9rem; }

.filtres { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-bottom: 1.25rem; }
.filtres select {
  font: inherit;
  color: var(--texte);
  background: var(--panneau);
  border: 1px solid var(--bordure);
  border-radius: 6px;
  padding: 0.5rem 0.7rem;
}

.liste-documents { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.65rem; }
.document {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  background: var(--degrade-carte);
  border: 1px solid var(--bordure);
  border-radius: 10px;
  padding: 1rem 1.2rem;
  transition: border-color 0.25s;
}
.document:hover { border-color: var(--accent); }
.document-info { min-width: 0; }
.document-titre { font-weight: 700; color: var(--blanc); margin: 0 0 0.2rem; }
.document-details { color: var(--texte-doux); font-size: 0.85rem; margin: 0; }
.document-actions { display: flex; gap: 0.5rem; flex-shrink: 0; }

.pastille {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  border-radius: 999px;
  padding: 0.18rem 0.65rem;
  background: var(--panneau);
  color: var(--texte-doux);
}
.pastille-cours   { background: rgba(47, 174, 107, 0.2); color: var(--vert-clair); }
.pastille-td      { background: rgba(39,118,220, 0.18); color: var(--accent-clair); }
.pastille-tp      { background: rgba(155, 109, 255, 0.18); color: #b59bff; }
.pastille-examen  { background: rgba(239, 82, 87, 0.15); color: var(--rouge); }

.etat-vide { color: var(--texte-doux); padding: 2rem 0; text-align: center; }

/* ---------- Formulaire admin : ajout de document ---------- */
.formulaire-admin {
  background: var(--degrade-carte);
  border: 1px solid var(--bordure);
  border-radius: 10px;
  padding: 1.5rem;
  margin-bottom: 1.75rem;
}
.grille-champs {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
}

/* ---------- Fil d'actualité ---------- */
.onglets-salon { display: flex; gap: 0.5rem; margin: 0.9rem 0 1.25rem; flex-wrap: wrap; }
.onglet {
  font: 700 0.78rem var(--police);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--texte-doux);
  background: var(--panneau);
  border: 1px solid var(--bordure);
  border-radius: 999px;
  padding: 0.5rem 1.1rem;
  cursor: pointer;
}
.onglet[aria-selected="true"] { color: var(--sur-accent); background: var(--accent); border-color: var(--accent); }

.avatar {
  width: 30px;
  height: 30px;
  min-width: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--sur-accent);
  font-weight: 700;
  font-size: 0.75rem;
  flex-shrink: 0;
}

/* Zone de publication, en haut du fil */
.compositeur {
  background: var(--degrade-carte);
  border: 1px solid var(--bordure);
  border-radius: 12px;
  padding: 1.1rem 1.2rem;
  margin-bottom: 1.25rem;
}
.compositeur-ligne { display: flex; gap: 0.65rem; align-items: flex-start; }
.compositeur .avatar { width: 38px; height: 38px; min-width: 38px; font-size: 0.9rem; margin-top: 0.1rem; }
.compositeur textarea {
  flex: 1;
  resize: none;
  font: inherit;
  color: var(--texte);
  background: var(--fond);
  border: 1px solid var(--bordure);
  border-radius: 20px;
  padding: 0.65rem 1rem;
  min-height: 2.6rem;
  max-height: 10rem;
}
.compositeur textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(39,118,220, 0.2); }
.compositeur-pied { display: flex; justify-content: flex-end; margin-top: 0.75rem; }

.apercu-reponse {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  background: var(--panneau);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  margin-bottom: 0.6rem;
  font-size: 0.85rem;
  color: var(--texte-doux);
}
.apercu-reponse button { border: none; background: none; font-size: 1.1rem; line-height: 1; cursor: pointer; color: var(--texte-doux); }

/* Liste des publications, la plus récente en premier */
.fil-publications { display: flex; flex-direction: column; gap: 0.9rem; }

.publication {
  background: var(--degrade-carte);
  border: 1px solid var(--bordure);
  border-radius: 12px;
  padding: 1.1rem 1.2rem;
}
.publication-entete { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.7rem; }
.publication-entete .avatar { width: 38px; height: 38px; min-width: 38px; font-size: 0.9rem; }
.publication-auteur { font-weight: 700; color: var(--blanc); margin: 0; }
.publication-date { font-size: 0.78rem; color: var(--texte-plus-doux); margin: 0; }

.publication-citation {
  border-left: 3px solid var(--bordure);
  padding: 0.2rem 0 0.2rem 0.6rem;
  margin-bottom: 0.6rem;
  font-size: 0.85rem;
  color: var(--texte-doux);
}
.publication-citation strong { display: block; color: var(--texte); }

.publication-texte { margin: 0; color: var(--texte); white-space: pre-wrap; word-break: break-word; }

.publication-pied { display: flex; gap: 1.25rem; margin-top: 0.8rem; padding-top: 0.6rem; border-top: 1px solid var(--bordure); }
.publication-pied button {
  font: 700 0.78rem var(--police);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--texte-doux);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}
.publication-pied button:hover { color: var(--accent-clair); }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ---------- Administration : signalements et utilisateurs ---------- */
.onglets-admin { display: flex; gap: 0.5rem; margin-bottom: 1.25rem; }

.liste-cartes { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.65rem; }

.carte-utilisateur,
.carte-signalement {
  background: var(--degrade-carte);
  border: 1px solid var(--bordure);
  border-radius: 10px;
  padding: 1rem 1.2rem;
  display: flex;
  align-items: center;
  gap: 0.9rem;
  flex-wrap: wrap;
}
.carte-signalement { border-left: 4px solid var(--rouge); }

.carte-utilisateur .avatar,
.carte-signalement .avatar { width: 36px; height: 36px; min-width: 36px; font-size: 0.85rem; }

.carte-details { flex: 1; min-width: 12rem; }
.carte-nom { font-weight: 700; color: var(--texte); margin: 0 0 0.15rem; display: flex; align-items: center; gap: 0.5rem; }
.carte-meta { color: var(--texte-doux); font-size: 0.85rem; margin: 0; }
.carte-motif { color: var(--texte); font-size: 0.9rem; margin: 0.35rem 0 0; }

.carte-actions { display: flex; gap: 0.5rem; flex-shrink: 0; flex-wrap: wrap; align-items: center; }
.carte-actions select {
  font: inherit;
  font-size: 0.85rem;
  color: var(--texte);
  background: var(--panneau);
  border: 1px solid var(--bordure);
  border-radius: 6px;
  padding: 0.4rem 0.5rem;
}

.pastille-role {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  border-radius: 999px;
  padding: 0.12rem 0.6rem;
}
.pastille-role-student { background: var(--panneau); color: var(--texte-doux); }
.pastille-role-admin { background: rgba(39,118,220, 0.18); color: var(--accent-clair); }
.pastille-role-super_admin { background: var(--blanc); color: var(--fond); }

.pastille-banni { background: rgba(239, 82, 87, 0.18); color: var(--rouge); }

/* ---------- Fiche de document ---------- */
.fiche-entete {
  background: var(--degrade-carte);
  border: 1px solid var(--bordure);
  border-radius: 12px;
  padding: 1.3rem 1.4rem;
  margin-bottom: 1.5rem;
}
.fiche-pastilles { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 0.6rem; }
.fiche-meta { color: var(--texte-doux); font-size: 0.9rem; margin: 0 0 1rem; }
.fiche-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; }

.pastille-statut-valide  { background: rgba(47, 174, 107, 0.2); color: var(--vert-clair); }
.pastille-statut-propose { background: rgba(39,118,220, 0.18); color: var(--accent-clair); }
.pastille-statut-aucun   { background: var(--panneau); color: var(--texte-doux); }

.bouton-favori { background: var(--panneau); color: var(--texte); border: 1px solid var(--bordure); }
.bouton-favori:hover { background: var(--panneau); transform: none; }
.bouton-favori.actif { background: rgba(239, 82, 87, 0.15); color: var(--rouge); border-color: var(--rouge); }

.liste-exercices { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.7rem; }
.exercice {
  background: var(--degrade-carte);
  border: 1px solid var(--bordure);
  border-radius: 10px;
  padding: 0.95rem 1.1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.exercice-numero { font-weight: 700; color: var(--blanc); margin: 0 0 0.2rem; }
.exercice-texte { color: var(--texte-doux); font-size: 0.9rem; margin: 0; }
.exercice-actions { display: flex; gap: 0.5rem; flex-shrink: 0; }

.panneau-admin-fiche {
  background: var(--panneau);
  border: 1px dashed var(--bordure);
  border-radius: 10px;
  padding: 1.2rem;
  margin-top: 2rem;
}
.panneau-admin-fiche h2 { font-size: 1rem; }


/* ============================================================
   Harmonisation du design (site + tuteur IA)
   ============================================================ */
input, select, textarea, button { font-family: var(--police); }

/* Léger halo indigo, comme dans le tuteur IA */
body:not(.auth) {
  background:
    radial-gradient(1000px 520px at 90% -10%, rgba(39,118,220, 0.14), transparent 62%),
    var(--fond);
  background-attachment: fixed;
}

/* ---------- En-tête commun avec navigation ---------- */
.entete { flex-wrap: wrap; }
a.marque { color: var(--blanc); text-decoration: none; }
a.marque:hover { color: var(--blanc); text-decoration: none; }

.navigation { display: flex; gap: 0.25rem; flex: 1; flex-wrap: wrap; margin-left: 0.5rem; }
.navigation a {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--texte-doux);
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  text-decoration: none;
  transition: background 0.2s, color 0.2s;
}
.navigation a:hover { color: var(--blanc); background: var(--panneau); text-decoration: none; }
.navigation a[aria-current="page"] { color: var(--blanc); background: rgba(39,118,220, 0.22); }
.navigation a.nav-ia { color: var(--accent-clair); }
.navigation a.nav-ia[aria-current="page"] { color: var(--blanc); }

@media (max-width: 640px) {
  .entete { padding: 0.7rem 1rem; gap: 0.5rem 0.75rem; }
  .navigation { order: 3; flex-basis: 100%; margin-left: 0; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .navigation a { white-space: nowrap; font-size: 0.82rem; padding: 0.4rem 0.6rem; }
  .entete .bouton-secondaire { padding: 0.45rem 0.9rem; font-size: 0.8rem; }
}

/* ---------- Tableau de bord ---------- */
.bandeau { border-left-width: 4px; }
#titre { margin-bottom: 1rem; }

/* La carte du tuteur IA ressort : c'est l'atout de la plateforme */
.salon-ia {
  background:
    linear-gradient(135deg, rgba(39,118,220, 0.28) 0%, rgba(39,118,220, 0.08) 60%, transparent 100%),
    var(--degrade-carte);
  border-color: rgba(105,174,255, 0.45);
  position: relative;
}
.salon-ia h2::after {
  content: "IA";
  margin-left: 0.55rem;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  color: var(--sur-accent);
  background: var(--accent);
  vertical-align: middle;
}

/* ---------- Fiche de document : bouton IA plus visible ---------- */
.exercice { transition: border-color 0.25s; }
.exercice:hover { border-color: var(--accent); }
.exercice .bouton-petit { white-space: nowrap; }

/* ---------- Page IA ---------- */
.entete-ia .navigation { margin-left: 0.5rem; }

/* Confort tactile sur téléphone */
@media (max-width: 640px) {
  .contenu { padding: 1.1rem 1rem 2.5rem; }
  .fiche-entete { padding: 1.1rem; }
  .exercice-actions { width: 100%; }
  .exercice-actions .bouton { flex: 1; }
}


/* ============================================================
   Animations (douces, comme sur un site professionnel).
   Elles sont coupées automatiquement pour les personnes qui
   demandent moins de mouvement (règle prefers-reduced-motion).
   ============================================================ */
html { scroll-behavior: smooth; }

@keyframes apparition { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@keyframes apparition-douce { from { opacity: 0; } to { opacity: 1; } }
@keyframes descendre { from { opacity: 0; transform: translateY(-100%); } to { opacity: 1; transform: none; } }
@keyframes lueur { 0%, 100% { box-shadow: 0 0 0 0 rgba(39,118,220, 0.0); } 50% { box-shadow: 0 0 0 6px rgba(39,118,220, 0.16); } }
@keyframes brillance { from { background-position: -200% 0; } to { background-position: 200% 0; } }
@keyframes pop { 0% { transform: scale(1); } 40% { transform: scale(1.35); } 100% { transform: scale(1); } }

body { animation: apparition-douce 0.4s ease both; }
.entete { animation: descendre 0.5s cubic-bezier(0.22, 1, 0.36, 1) both; backdrop-filter: blur(10px); background: var(--entete-fond); }

/* Le contenu monte doucement, élément après élément */
.contenu > *, .contenu-large > *, .contenu-etroit > *, .hero > * { animation: apparition 0.6s cubic-bezier(0.22, 1, 0.36, 1) both; }
.contenu > :nth-child(2), .contenu-large > :nth-child(2), .contenu-etroit > :nth-child(2), .hero > :nth-child(2) { animation-delay: 0.06s; }
.contenu > :nth-child(3), .contenu-large > :nth-child(3), .contenu-etroit > :nth-child(3), .hero > :nth-child(3) { animation-delay: 0.12s; }
.contenu > :nth-child(4), .contenu-large > :nth-child(4), .contenu-etroit > :nth-child(4), .hero > :nth-child(4) { animation-delay: 0.18s; }
.contenu > :nth-child(n+5), .contenu-large > :nth-child(n+5), .contenu-etroit > :nth-child(n+5) { animation-delay: 0.24s; }

/* Les cartes et les lignes d'une liste arrivent en cascade */
.salons > *, .liste-documents > *, .liste-exercices > *, .liste-cartes > *, .liste-annonces > *, .liste-compacte > *,
.grille-cartes > *, .tarifs > *, .etapes > *, .fil-publications > *, .grille-docs > *, .chiffres > *, .faq > * {
  animation: apparition 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
  animation-delay: calc(var(--i, 0) * 60ms);
}
.salons > :nth-child(1), .liste-documents > :nth-child(1), .liste-exercices > :nth-child(1), .liste-cartes > :nth-child(1), .liste-annonces > :nth-child(1), .liste-compacte > :nth-child(1), .grille-cartes > :nth-child(1), .tarifs > :nth-child(1), .etapes > :nth-child(1), .chiffres > :nth-child(1), .faq > :nth-child(1) { animation-delay: 0.05s; }
.salons > :nth-child(2), .liste-documents > :nth-child(2), .liste-exercices > :nth-child(2), .liste-cartes > :nth-child(2), .liste-annonces > :nth-child(2), .liste-compacte > :nth-child(2), .grille-cartes > :nth-child(2), .tarifs > :nth-child(2), .etapes > :nth-child(2), .chiffres > :nth-child(2), .faq > :nth-child(2) { animation-delay: 0.12s; }
.salons > :nth-child(3), .liste-documents > :nth-child(3), .liste-exercices > :nth-child(3), .liste-cartes > :nth-child(3), .liste-annonces > :nth-child(3), .liste-compacte > :nth-child(3), .grille-cartes > :nth-child(3), .tarifs > :nth-child(3), .etapes > :nth-child(3), .chiffres > :nth-child(3), .faq > :nth-child(3) { animation-delay: 0.19s; }
.salons > :nth-child(4), .liste-documents > :nth-child(4), .liste-exercices > :nth-child(4), .liste-cartes > :nth-child(4), .liste-annonces > :nth-child(4), .liste-compacte > :nth-child(4), .grille-cartes > :nth-child(4), .chiffres > :nth-child(4), .faq > :nth-child(4) { animation-delay: 0.26s; }
.salons > :nth-child(n+5), .liste-documents > :nth-child(n+5), .liste-exercices > :nth-child(n+5), .liste-cartes > :nth-child(n+5), .liste-compacte > :nth-child(n+5), .chiffres > :nth-child(n+5), .faq > :nth-child(n+5) { animation-delay: 0.32s; }

/* Survol : les cartes se soulèvent */
.salon, .document, .exercice, .carte-info, .tarif, .annonce, .carte-doc, .carte-utilisateur, .carte-signalement, .chiffre {
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1), border-color 0.25s, box-shadow 0.3s;
}
.document:hover, .exercice:hover, .carte-info:hover, .tarif:hover, .carte-doc:hover, .chiffre:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
  box-shadow: 0 14px 32px var(--ombre);
}
a.salon:hover { box-shadow: 0 14px 32px var(--ombre); }
.salon-ia { animation: apparition 0.55s cubic-bezier(0.22, 1, 0.36, 1) both, lueur 3.2s ease-in-out 1s infinite; }

/* Boutons : appui et lumière */
.bouton:active { transform: scale(0.96); box-shadow: none; transition-duration: 0.08s; }
.bouton { position: relative; overflow: hidden; }
.bouton:not(.bouton-secondaire):not(.bouton-danger)::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, 0.22) 50%, transparent 70%);
  transform: translateX(-120%); transition: transform 0.6s ease;
}
.bouton:not(.bouton-secondaire):not(.bouton-danger):hover::after { transform: translateX(120%); }

/* Champs : la mise au point est douce */
.champ input, .champ select, .champ textarea { transition: border-color 0.2s, box-shadow 0.2s; }

/* Messages d'erreur ou de réussite */
.message { animation: apparition 0.35s ease both; }

/* Révélation au défilement (ajoutée par js/ui.js) */
.reveal { opacity: 0; transform: translateY(26px); transition: opacity 0.8s cubic-bezier(0.22, 1, 0.36, 1), transform 0.8s cubic-bezier(0.22, 1, 0.36, 1); }
.reveal.visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; }
  body, .entete, .contenu > *, .contenu-large > *, .contenu-etroit > *, .hero > * { animation: none !important; }
}

/* ============================================================
   THÈME CLAIR (choisi avec le bouton du menu du compte)
   ============================================================ */
:root[data-theme="light"] {
  --fond: #f1f6fd;
  --panneau: #ffffff;
  --degrade-carte: linear-gradient(135deg, #ffffff 0%, #e9f1fb 100%);
  --accent-clair: #1f66c2;
  --blanc: #12141d;
  --texte: #23262f;
  --texte-doux: #565a65;
  --texte-plus-doux: #7b7f8a;
  --bordure: rgba(15,30,55, 0.15);
  --vert-clair: #14824a;
  --rouge: #d3343a;
  --v04: rgba(15,30,55,0.04); --v05: rgba(15,30,55,0.05); --v06: rgba(15,30,55,0.06);
  --v07: rgba(15,30,55,0.07); --v08: rgba(15,30,55,0.08); --v10: rgba(15,30,55,0.10);
  --v12: rgba(15,30,55,0.12); --v14: rgba(15,30,55,0.14); --v18: rgba(15,30,55,0.18);
  --panneau-2: #e6eefa; --panneau-3: #ffffff; --menu-fond: #ffffff;
  --entete-fond: rgba(255, 255, 255, 0.9); --fond-voile: rgba(244, 245, 250, 0.9);
  --ombre: rgba(20,40,80, 0.16); --or-fond: #fff4d6;
  color-scheme: light;
}
:root[data-theme="light"] body:not(.auth) {
  background:
    radial-gradient(1000px 520px at 90% -10%, rgba(39,118,220, 0.10), transparent 62%),
    var(--fond);
}
:root[data-theme="light"] .salon-ia {
  background:
    linear-gradient(135deg, rgba(39,118,220, 0.16) 0%, rgba(39,118,220, 0.05) 60%, transparent 100%),
    var(--degrade-carte);
}

/* Bouton de thème flottant (pages de connexion) */
.bouton-theme-flottant {
  position: fixed; top: 0.9rem; right: 0.9rem; z-index: 50; width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center; cursor: pointer; font-size: 1.1rem;
  border: 1px solid var(--bordure); background: var(--panneau); color: var(--texte);
}

/* ---------- Pages de connexion / inscription : le côté « cahier » ---------- */
.marches-cahier {
  --manuscrit: "Caveat", "Segoe Print", "Bradley Hand", "Comic Sans MS", cursive;
  position: relative; overflow: hidden; gap: 1.6rem;
  background-color: var(--panneau);
  background-image: radial-gradient(var(--v08, rgba(255,255,255,0.08)) 1.2px, transparent 1.3px); background-size: 22px 22px;
}
.marches-cahier .accroche { margin: 0.4rem 0 0; max-width: 26rem; font-size: clamp(2rem, 3.4vw, 3rem); line-height: 1.05; letter-spacing: -0.03em; color: var(--blanc); }
.papier {
  position: relative; max-width: 25rem; padding: 1.5rem 1.4rem 1.3rem 2.6rem; transform: rotate(-1.6deg); margin-left: 0.4rem;
  color: #1b1f3b; background-color: #fdfdff; border-radius: 3px; box-shadow: 0 14px 30px var(--ombre);
  background-image: repeating-linear-gradient(to bottom, transparent 0 29px, #c9d3f5 29px 30px);
}
.papier::before { content: ""; position: absolute; left: 1.8rem; top: 0; bottom: 0; border-left: 2px solid #f0a8b4; }
.papier ul { list-style: none; margin: 0; padding: 0; }
.papier li { line-height: 30px; font-size: 1rem; font-weight: 600; color: #1b1f3b; padding-left: 0.2rem; }
.scotch-aut {
  position: absolute; top: -12px; left: 38%; width: 96px; height: 26px; transform: rotate(-4deg); background: rgba(255, 226, 122, 0.8); box-shadow: 0 1px 3px var(--ombre);
  clip-path: polygon(0 8%, 5% 0, 10% 10%, 100% 0, 96% 50%, 100% 100%, 10% 92%, 5% 100%, 0 90%, 3% 50%);
}
.note-aut { margin: 0 0 -0.6rem 1.2rem; display: flex; align-items: flex-end; gap: 0.3rem; transform: rotate(-3deg); font: 700 1.45rem/1 var(--manuscrit); color: var(--accent-clair); }
.note-aut svg { transform: scaleY(-1) rotate(8deg) translateY(-4px); }
.marches-cahier .escalier { display: flex; flex-wrap: wrap; gap: 0.9rem 0.8rem; max-width: 28rem; }
.marches-cahier .escalier li {
  border: 0; border-radius: 4px 12px 5px 10px; padding: 0.65rem 1.2rem; box-shadow: 0 6px 14px var(--ombre); color: #1b1f3b; background: #ffe27a;
}
.marches-cahier .escalier li::before { content: none; }
.marches-cahier .escalier li:nth-child(4n+1) { background: #ffe27a; transform: rotate(-2.2deg); }
.marches-cahier .escalier li:nth-child(4n+2) { background: #bfe3ff; transform: rotate(1.6deg) translateY(4px); border-radius: 10px 4px 12px 5px; }
.marches-cahier .escalier li:nth-child(4n+3) { background: #ffc9d6; transform: rotate(-1deg) translateY(-3px); }
.marches-cahier .escalier li:nth-child(4n+4) { background: #c9f0cf; transform: rotate(2.4deg); border-radius: 5px 12px 4px 10px; }
.gommette-aut {
  position: absolute; right: 2.2rem; bottom: 2.4rem; width: 84px; height: 84px; display: grid; place-items: center; text-align: center; border-radius: 50%;
  transform: rotate(9deg); background: #ffd84d; color: #2a2100; font: 700 1.2rem/1.05 var(--manuscrit); box-shadow: 0 6px 16px var(--ombre), inset 0 0 0 3px rgba(255,255,255,0.35);
}
@media (max-width: 859px) { .marches-cahier .papier, .marches-cahier .note-aut, .gommette-aut { display: none; } .marches-cahier .accroche { font-size: 1.8rem; } }

/* ============================================================
   INSCRIPTION en 3 étapes : barre de progression, liste de filières
   ============================================================ */
.etape-tete { display: flex; justify-content: space-between; align-items: center; min-height: 1.6rem; font-size: 0.85rem; color: var(--texte-doux); }
.retour { background: none; border: 0; padding: 0; font: inherit; color: var(--texte-doux); cursor: pointer; }
.retour:hover { color: var(--blanc); }
.progres { height: 5px; margin: 0.6rem 0 1.4rem; border-radius: 4px; background: var(--panneau-3); overflow: hidden; }
.progres i { display: block; height: 100%; width: 33%; border-radius: 4px; background: linear-gradient(90deg, var(--accent), var(--accent-clair)); transition: width 0.35s cubic-bezier(0.22, 1, 0.36, 1); }
.etape[hidden] { display: none; }
.etape h1 { margin-bottom: 0.4rem; }
.etape .introduction { margin-top: 0; }
.recherche {
  width: 100%; margin: 0.4rem 0 0.8rem; padding: 0.7rem 0.9rem; font: inherit; color: var(--texte);
  background: var(--fond); border: 1px solid var(--bordure); border-radius: 10px;
}
.recherche:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(39, 118, 220, 0.2); outline: 0; }
.choix { display: grid; gap: 0.5rem; max-height: 17rem; overflow-y: auto; padding: 0.15rem 0.15rem 0.15rem 0; margin-bottom: 0.6rem; }
.choix button {
  text-align: left; font: inherit; font-weight: 600; color: var(--texte); background: var(--panneau); border: 1px solid var(--bordure);
  border-radius: 12px; padding: 0.75rem 0.95rem; cursor: pointer; transition: border-color 0.2s, background 0.2s;
}
.choix button:hover { border-color: var(--accent); }
.choix button[aria-checked="true"] { border-color: var(--accent); background: var(--panneau-2); box-shadow: 0 0 0 3px rgba(39, 118, 220, 0.18); }
.choix .vide { color: var(--texte-doux); font-size: 0.9rem; padding: 0.4rem 0; }
.propose { display: block; margin: 0 0 1.2rem; font-size: 0.88rem; color: var(--accent-clair); }
.recap { margin: 0 0 1rem; padding: 0.7rem 0.9rem; border-radius: 10px; background: var(--panneau); border: 1px solid var(--bordure); font-size: 0.9rem; color: var(--texte-doux); }
.recap strong { color: var(--blanc); }


/* Alertes de nouveaux messages */
#pile-alertes { position: fixed; top: 4.6rem; right: 1rem; z-index: 9000; display: flex; flex-direction: column; gap: 0.5rem; width: min(360px, calc(100vw - 2rem)); pointer-events: none; }
.alerte-message {
  pointer-events: auto; display: flex; flex-direction: column; gap: 0.15rem; padding: 0.7rem 0.95rem; border-radius: 14px;
  background: var(--panneau-2, #172236); color: var(--texte, #eef3fa); text-decoration: none; border: 1px solid rgba(105,174,255,0.4);
  border-left: 4px solid var(--accent, #2776dc); box-shadow: 0 10px 30px rgba(0,0,0,0.35); animation: alerte-entre 0.25s ease-out;
  transition: opacity 0.3s, transform 0.3s;
}
.alerte-message:hover { text-decoration: none; color: inherit; }
.alerte-message strong { font-size: 0.88rem; }
.alerte-message span { font-size: 0.85rem; opacity: 0.8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.alerte-message.part { opacity: 0; transform: translateX(20px); }
@keyframes alerte-entre { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
.demande-notif {
  position: fixed; left: 1rem; right: 1rem; bottom: 1rem; margin: 0 auto; max-width: 380px; z-index: 9000; padding: 1rem;
  border-radius: 16px; background: var(--panneau-2, #172236); color: var(--texte, #eef3fa); border: 1px solid rgba(105,174,255,0.4);
  box-shadow: 0 10px 30px rgba(0,0,0,0.4); font-size: 0.88rem;
}
.demande-notif p { margin: 0 0 0.7rem; }
.demande-notif-actions { display: flex; gap: 0.5rem; }
.demande-notif-actions .bouton { padding: 0.45rem 0.9rem; font-size: 0.82rem; }
@media (max-width: 991px) { #pile-alertes { top: 4.2rem; } }
