/* =========================================================================
   aide.css — panneau d'aide d'un cours ISBI
   -------------------------------------------------------------------------
   Autonome : ne depend d'aucune variable des feuilles de style des cours,
   qui different d'un module a l'autre. Tout est prefixe .aide- pour ne
   jamais entrer en collision avec le style du cours.

   Position fixed : le panneau ne deplace jamais le contenu de la page.
   Sous 700 px il devient une feuille qui monte du bas — on le garde, les
   cours se suivent aussi en distanciel depuis un telephone.

   GENERE par scripts/07-generer-aide.py — ne pas editer dans un module.
   ========================================================================= */

.aide-lanceur,
.aide-panneau {
  --aide-fond: #15111c;
  --aide-fond-2: #1e1a28;
  --aide-texte: #f2f0f7;
  --aide-doux: #a8a2b8;
  --aide-bord: rgba(255, 255, 255, .14);
  --aide-accent: #7E4DD2;
  --aide-bord-champ: #8A8597;      /* la bordure d'un champ se voit : 3:1 au moins */
  --aide-accent-txt: #C9B3F5;     /* l'accent en TEXTE sur le fond sombre : 2,79:1 avec #7E4DD2 */
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  box-sizing: border-box;
}

.aide-lanceur *,
.aide-panneau * { box-sizing: border-box; }

/* Le cours est en theme clair : le panneau suit. */
[data-theme="light"] .aide-lanceur,
[data-theme="light"] .aide-panneau {
  --aide-fond: #ffffff;
  --aide-fond-2: #f4f2f8;
  --aide-texte: #1d1a24;
  --aide-doux: #5d5770;
  --aide-bord: rgba(0, 0, 0, .14);
  --aide-accent-txt: #6B3FC0;
  --aide-bord-champ: #817A98;
}

/* ------------------------------------------------------------- lanceur --- */

.aide-lanceur {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 9998;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  border: 1px solid var(--aide-bord);
  border-radius: 999px;
  background: var(--aide-accent);
  color: #fff;
  font-size: .92rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .35);
  transition: transform .2s ease, box-shadow .2s ease;
}

.aide-lanceur:hover { transform: translateY(-2px); box-shadow: 0 12px 30px rgba(0, 0, 0, .45); }
.aide-lanceur:focus-visible { outline: 3px solid var(--aide-accent); outline-offset: 3px; }
.aide-lanceur span { font-weight: 800; }

/* ------------------------------------------------------------- panneau --- */

.aide-panneau {
  position: fixed;
  right: 20px;
  bottom: 84px;
  z-index: 9999;
  width: 380px;
  max-width: calc(100vw - 40px);
  max-height: min(70vh, 620px);
  display: flex;
  flex-direction: column;
  background: var(--aide-fond);
  color: var(--aide-texte);
  border: 1px solid var(--aide-bord);
  border-radius: var(--r-bloc, 16px);
  box-shadow: 0 24px 60px rgba(0, 0, 0, .5);
  overflow: hidden;
}

.aide-panneau[hidden] { display: none; }

.aide-tete {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: var(--aide-fond-2);
  border-bottom: 1px solid var(--aide-bord);
  font-size: .95rem;
}

.aide-fermer {
  border: 0;
  background: transparent;
  color: var(--aide-doux);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}

.aide-fermer:hover { color: var(--aide-texte); }

/* -------------------------------------------------------------- onglets --- */

.aide-onglets { display: flex; border-bottom: 1px solid var(--aide-bord); }

.aide-onglet {
  flex: 1;
  padding: 11px 8px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--aide-doux);
  font-size: .83rem;
  font-weight: 600;
  cursor: pointer;
}

.aide-onglet.actif { color: var(--aide-texte); border-bottom-color: var(--aide-accent); }
.aide-onglet:focus-visible { outline: 2px solid var(--aide-accent); outline-offset: -2px; }

/* ----------------------------------------------------------------- vues --- */

.aide-vue { padding: 14px 16px; overflow-y: auto; }
.aide-vue[hidden] { display: none; }

.aide-champ,
.aide-question {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--aide-bord-champ);
  border-radius: var(--r-bloc, 10px);
  background: var(--aide-fond-2);
  color: var(--aide-texte);
  font-size: .9rem;
  font-family: inherit;
}

.aide-champ:focus,
.aide-question:focus { outline: 2px solid var(--aide-accent); outline-offset: 1px; }
.aide-question { resize: vertical; margin-bottom: 10px; }
/* l'indication des champs : le gris du navigateur donnait 3,26:1 en sombre et 4,27:1 en clair */
.aide-champ::placeholder, .aide-question::placeholder { color: var(--aide-doux); opacity: 1; }
.aide-resultats { margin-top: 12px; }

.aide-vide { color: var(--aide-doux); font-size: .84rem; line-height: 1.6; margin-bottom: 12px; }

/* Le piege a robots : invisible pour l'humain, rempli par la machine. */
.aide-piege { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

/* ------------------------------------------------------------ reponses --- */

.aide-item {
  border: 1px solid var(--aide-bord);
  border-radius: var(--r-bloc, 10px);
  margin-bottom: 8px;
  background: var(--aide-fond-2);
}

.aide-item summary {
  padding: 10px 12px;
  cursor: pointer;
  font-size: .88rem;
  font-weight: 600;
  line-height: 1.45;
}

.aide-item summary::marker { color: var(--aide-accent); }
.aide-item[open] summary { border-bottom: 1px solid var(--aide-bord); }

.aide-rep {
  padding: 10px 12px;
  font-size: .85rem;
  line-height: 1.65;
  color: var(--aide-doux);
}

.aide-rep code {
  background: rgba(126, 77, 210, .16);
  color: var(--aide-texte);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: .92em;
}

.aide-rep b, .aide-rep strong { color: var(--aide-texte); }
.aide-rep ol, .aide-rep ul { margin: 6px 0 6px 18px; }
.aide-rep li { margin-bottom: 4px; }

mark { background: rgba(126, 77, 210, .35); color: inherit; border-radius: 3px; padding: 0 2px; }

/* -------------------------------------------------------------- envoyer --- */

.aide-envoyer {
  width: 100%;
  padding: 11px;
  border: 0;
  border-radius: var(--r-bloc, 10px);
  background: var(--aide-accent);
  color: #fff;
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
}

.aide-envoyer:hover { filter: brightness(1.1); }
.aide-envoyer:focus-visible { outline: 3px solid var(--aide-accent); outline-offset: 2px; }

.aide-etat { margin-top: 10px; font-size: .82rem; line-height: 1.6; color: var(--aide-doux); }
.aide-etat.aide-ok { color: #12B886; }
.aide-etat.aide-ko { color: #E8553F; }

.aide-export {
  display: inline-block;
  margin-top: 6px;
  padding: 6px 12px;
  border: 1px solid var(--aide-bord);
  border-radius: var(--r-bloc, 8px);
  background: transparent;
  color: var(--aide-texte);
  font-size: .8rem;
  cursor: pointer;
}

/* ------------------------------------------- resultats dans le cours ----- */

.aide-groupe {
  margin: 14px 0 6px;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--aide-accent-txt);
}

.aide-groupe:first-child { margin-top: 0; }

/* Mes questions et reponse du formateur (22/10/2026, p-036) */
.aide-mes { margin-top: 14px; }
.aide-rep-auteur { margin: 0 0 4px; font-size: .78rem; font-weight: 700; color: var(--aide-texte); }

.aide-lien {
  display: block;
  padding: 10px 12px;
  text-decoration: none;
  color: inherit;
}

.aide-lien:hover { border-color: var(--aide-accent); }
.aide-lien:focus-visible { outline: 2px solid var(--aide-accent); outline-offset: 1px; }

.aide-ou {
  display: block;
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--aide-accent);
  margin-bottom: 3px;
}

.aide-titre { display: block; font-weight: 600; font-size: .87rem; line-height: 1.45; }

.aide-extrait {
  display: block;
  margin-top: 4px;
  font-size: .79rem;
  line-height: 1.55;
  color: var(--aide-doux);
}

/* --------------------------------------------------------- telephone ----- */

@media (max-width: 700px) {
  .aide-lanceur { right: 14px; bottom: 14px; padding: 11px 17px; }
  .aide-panneau {
    right: 0;
    left: 0;
    bottom: 0;
    width: 100%;
    max-width: 100%;
    max-height: 82vh;
    border-radius: var(--r-bloc, 16px) var(--r-bloc, 16px) 0 0;
    border-left: 0;
    border-right: 0;
    border-bottom: 0;
  }
}

/* ------------------------------------------- mouvement et impression ----- */

@media (prefers-reduced-motion: reduce) {
  .aide-lanceur { transition: none; }
  .aide-lanceur:hover { transform: none; }
}

@media print {
  .aide-lanceur, .aide-panneau { display: none !important; }
}
