/* [ABC-4-223] Assistant d'IA du site : icône flottante en bas à droite et fenêtre de conversation (templates/assistant/). */
.assistant-icone {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 1040;
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  min-width: 3.5rem;
  min-height: 3.5rem;
  padding: .75rem;
  border-radius: 1.75rem;
  background: #0b3d91;
  color: #fff;
  box-shadow: 0 .25rem 1rem rgba(0, 0, 0, .3);
  text-decoration: none;
  justify-content: center;
}
/* [ABC-4-236] Texte et pictogramme BLANCS sur le bleu de la charte (#0b3d91 : 10:1, WCAG 1.4.3 ; #082c6a au survol : 13,3:1).
   !important : la feuille compilée d'EPE impose « a { color: … !important } » (neutralisation-bootstrap4.css), qui rendait le texte bleu sur bleu. */
.assistant-icone, .assistant-icone:visited, .assistant-icone:hover, .assistant-icone:focus, .assistant-icone:focus-visible, .assistant-icone:active,
.assistant-icone .assistant-icone__texte { color: #fff !important; text-decoration: none !important; }
.assistant-icone:hover, .assistant-icone:focus-visible { background: #082c6a; }
/* Focus visible ≥ 3:1 (WCAG 1.4.11) sur fond clair comme sombre : anneau blanc puis anneau bleu foncé. */
.assistant-icone:focus-visible { outline: 3px solid transparent; box-shadow: 0 0 0 3px #fff, 0 0 0 6px #0b3d91, 0 .25rem 1rem rgba(0, 0, 0, .3); }
.assistant-fenetre__bouton:focus-visible { outline: 3px solid #ffbf47; outline-offset: 2px; }
.assistant-icone__texte { font-weight: 600; }
/* [ABC-4-236] Le bouton « retour en haut » (#btn-back-top, base.html.twig) ne recouvre plus l'Assistant : il est posé AU-DESSUS. */
#btn-back-top { right: 1rem; bottom: 5.75rem; z-index: 1039; }
/* Petit écran : l'icône se réduit au pictogramme, la fenêtre prend la largeur de l'écran. */
@media (max-width: 575.98px) {
  .assistant-icone__texte { display: none; }
  .assistant-icone { border-radius: 50%; width: 3.5rem; padding: 0; }
}
.assistant-fenetre {
  position: fixed;
  right: 1rem;
  bottom: 5.5rem;
  z-index: 1041;
  display: flex;
  flex-direction: column;
  width: min(24rem, calc(100vw - 2rem));
  max-height: min(46rem, calc(100vh - 7rem));
  background: #fff;
  color: #212529;
  border: 1px solid #adb5bd;
  border-radius: .75rem;
  box-shadow: 0 .5rem 2rem rgba(0, 0, 0, .3);
  overflow: hidden;
}
.assistant-fenetre[hidden] { display: none; }
.assistant-fenetre__entete { display: flex; align-items: center; gap: .25rem; padding: .5rem .75rem; background: #0b3d91; color: #fff; }
.assistant-fenetre__titre { flex: 1; margin: 0; font-size: 1.05rem; }
.assistant-fenetre__bouton { min-width: 2.5rem; min-height: 2.5rem; border: 0; border-radius: .5rem; background: transparent; color: #fff; font-size: 1.5rem; line-height: 1; }
.assistant-fenetre__bouton:hover { background: rgba(255, 255, 255, .2); }
.assistant-fenetre__corps { flex: 1 1 auto; min-height: 18rem; overflow-y: auto; padding: .75rem; }
/* [C-R-127] Zoom 200 % (fenêtre de 450 px de haut) : le fil se réduit pour que le champ et le bouton d'envoi restent dans la fenêtre. */
@media (max-height: 600px) { .assistant-fenetre__corps { min-height: 5rem; } }
.assistant-fenetre__formulaire { flex: 0 0 auto; }
.assistant-fenetre__corps:has(.assistant-echanges:not(:empty)) .assistant-fenetre__accueil { display: none; }
.assistant-fenetre .assistant-fenetre__formulaire textarea.form-control { height: 4.5rem; min-height: 0; max-height: 5rem; resize: none; }
.assistant-fenetre__accueil { margin: 0 0 .75rem; color: #495057; }
.assistant-fenetre__formulaire { display: flex; flex-direction: column; gap: .5rem; padding: .75rem; border-top: 1px solid #dee2e6; background: #f8f9fa; }
.assistant-fenetre__libelle { font-weight: 600; }
.assistant-echange { margin: 0 0 .5rem; padding: .5rem .75rem; border-radius: .5rem; }
.assistant-echange--reponse { background: #eef3fb; border: 1px solid #c9d8f0; }
.assistant-echange--question { background: #f1f3f5; }
.assistant-echange__texte { margin: 0 0 .25rem; white-space: pre-line; overflow-wrap: anywhere; }
.assistant-echange__sous-titre { margin: 0 0 .25rem; font-size: .9rem; font-weight: 600; }
.assistant-echange__liens { margin: 0; padding-left: 1.25rem; }
.assistant-echange--question p { margin: 0; overflow-wrap: anywhere; }
/* Contraste élevé du site : l'assistant suit. */
.contraste-eleve .assistant-icone, .contraste-eleve .assistant-fenetre__entete { background: #000; border: 2px solid #fff; }
.contraste-eleve .assistant-fenetre { border: 2px solid #000; }
@media print { .assistant-icone, .assistant-fenetre { display: none !important; } }
@media (prefers-reduced-motion: no-preference) { .assistant-fenetre { animation: assistant-apparition .15s ease-out; } }
@keyframes assistant-apparition { from { opacity: 0; transform: translateY(.5rem); } to { opacity: 1; transform: none; } }

/* [ABC-4-278] Une seule roue d'attente : celle du bouton (envoi-en-cours.css) ; plus de pastille sous la conversation. */
/* [ABC-4-236] L'état (« Réponse en cours de préparation… ») est VISIBLE pour tous, et annoncé (role=status) ; vide, il ne prend aucune place. */
.assistant-etat { margin: .5rem 0 0; font-size: .9rem; font-style: italic; color: #212529; }
.assistant-etat:empty { margin: 0; }

/* [C-R-127] Deux bulles distinctes : la réponse de « Assistant EPE » à gauche (fond bleu clair, bordure), la question de « Vous » à droite
   (fond bleu de la charte, texte blanc 10:1) ; auteur en gras et date « jj/mm/aaaa à HH:MM » sur UNE ligne (G14) au-dessus du texte ;
   les pages proposées dans un bloc à part sous un filet. Un échange = la réponse au-dessus de la question (G41), séparé du suivant. */
/* Réouverture : texte 15 px, interligne 1,47 (le corps du site impose 17 px / 1,65), tout le reste du contenu ≥ 14 px ; le gain vient des marges. */
.assistant-bulle { display: block; max-width: 92%; margin: 0 0 .375rem; padding: .5rem .75rem; border-radius: .75rem; overflow-wrap: anywhere; font-size: .9375rem; line-height: 1.47; }
.assistant-bulle--assistant { margin-right: auto; background: #eef3fb; border: 1px solid #c9d8f0; border-top-left-radius: .125rem; color: #212529; }
.assistant-bulle--usager { margin-left: auto; margin-bottom: .875rem; background: #0b3d91; border: 1px solid #0b3d91; border-top-right-radius: .125rem; color: #fff; }
.assistant-bulle--erreur { background: #fff3cd; border-color: #e0c36a; margin-bottom: .875rem; }
.assistant-bulle__entete { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: .25rem .75rem; margin: 0 0 .125rem; font-size: .875rem; }
.assistant-bulle__auteur { font-weight: 700; }
.assistant-bulle__horodatage { white-space: nowrap; font-size: .875rem; }
.assistant-bulle--assistant .assistant-bulle__horodatage { color: #495057; }
.assistant-bulle--usager .assistant-bulle__horodatage { color: #fff; }
.assistant-bulle__texte { margin: 0 0 .25rem; white-space: pre-line; }
/* Les paragraphes de la réponse sont des <p> (une ligne vide de « pre-line » coûtait une ligne pleine) : simple marge entre eux. */
div.assistant-bulle__texte { white-space: normal; }
.assistant-bulle__texte p { margin: 0 0 .375rem; white-space: pre-line; }
.assistant-bulle__texte p:last-child { margin-bottom: 0; }
.assistant-bulle__texte sup { font-size: .875rem; }
.assistant-bulle--usager .assistant-bulle__texte { margin: 0; color: #fff; }
.assistant-bulle__complements { margin-top: .375rem; padding-top: .375rem; border-top: 1px solid #c9d8f0; }
.assistant-bulle__complements-titre { margin: 0 0 .125rem; font-size: .9375rem; font-weight: 600; }
.assistant-bulle .assistant-echange__liens { margin: 0; padding-left: 1.25rem; }
.assistant-bulle .assistant-echange__liens li { margin: 0; }
.assistant-bulle--assistant .disclaimer-ia { margin: 0 0 .375rem; font-size: .875rem; line-height: 1.45; }
.contraste-eleve .assistant-bulle--usager { background: #000; border: 2px solid #fff; }
.contraste-eleve .assistant-bulle--assistant { background: #fff; border: 2px solid #000; }
