/* Unipop – Assistant : fenêtre de discussion.
   Couleurs et polices lues dans les variables du site (unipop-theme/assets/identite.css) ;
   les valeurs après la virgule ne servent que si le thème ne les fournit pas. */
.ua-fenetre {
  --ua-primaire: var(--up-nuit, #102f4f);
  --ua-fond: var(--up-fond, #fff);
  --ua-encre: var(--up-encre, #1c2733);
  --ua-doux: var(--up-doux, #5b6672);
  --ua-trait: var(--up-trait, #dfe4ea);
  --ua-bulle: var(--up-fond-2, #eef4f8);
  --ua-accent: var(--up-accent, #478ac9);
  box-sizing: border-box;
  width: min(460px, calc(100vw - 32px));
  height: min(720px, calc(100vh - 48px));
  max-width: none;
  max-height: none;
  padding: 0;
  border: 0;
  border-radius: 18px;
  background: var(--ua-fond);
  color: var(--ua-encre);
  font-family: var(--up-police, inherit);
  font-size: 1rem;
  line-height: 1.5;
  text-align: left;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .35);
  overflow: hidden;
}
[data-mode="sombre"] .ua-fenetre { --ua-primaire: #2b6f9e; }
.ua-fenetre *, .ua-fenetre *::before, .ua-fenetre *::after { box-sizing: border-box; }
.ua-fenetre[open] { display: flex; flex-direction: column; }
.ua-fenetre::backdrop { background: rgba(13, 26, 45, .55); }
.ua-fenetre [hidden] { display: none !important; }
.ua-fenetre :focus-visible { outline: 2px solid var(--ua-accent); outline-offset: 2px; }
@media (max-width: 767px) {
  .ua-fenetre { width: 100vw; height: 100vh; height: 100dvh; max-height: 100dvh; margin: 0; border-radius: 0; }
}

/* En-tête */
.ua-tete { display: flex; align-items: center; gap: 10px; padding: 12px 10px 12px 16px; background: var(--ua-primaire); color: #fff; }
.ua-icone { flex: none; display: flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 50%; background: rgba(255, 255, 255, .16); }
.ua-tete__texte { flex: 1; min-width: 0; }
.ua-fenetre .ua-titre { margin: 0; padding: 0; color: #fff; font-family: inherit; font-size: 1.0625rem; font-weight: 700; line-height: 1.25; letter-spacing: 0; text-transform: none; }
.ua-fenetre .ua-sous { margin: 2px 0 0; color: rgba(255, 255, 255, .85); font-size: .78rem; line-height: 1.35; }
.ua-test { display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 4px; background: #ffd34d; color: #3d2f00; font-size: .7rem; font-weight: 700; vertical-align: 1px; }
.ua-langues { display: flex; flex: none; }
.ua-langues button, .ua-fermer { min-width: 44px; min-height: 44px; padding: 0 6px; border: 0; border-radius: 8px; background: none; color: #fff; font: inherit; cursor: pointer; }
.ua-langues button { font-size: .8125rem; font-weight: 700; opacity: .7; }
.ua-langues button[aria-pressed="true"] { opacity: 1; text-decoration: underline; text-underline-offset: 4px; }
.ua-fermer { font-size: 1.6rem; line-height: 1; }
.ua-langues button:hover, .ua-fermer:hover { background: rgba(255, 255, 255, .12); opacity: 1; }
.ua-tete :focus-visible { outline-color: #fff; }

/* Progression */
.ua-progres { padding: 10px 16px 9px; border-bottom: 1px solid var(--ua-trait); }
.ua-progres__texte { display: block; min-height: 1.1em; color: var(--ua-doux); font-size: .75rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.ua-progres__barre { height: 4px; margin-top: 6px; border-radius: 2px; background: var(--up-fond-3, #e9eef4); overflow: hidden; }
.ua-progres__barre span { display: block; width: 0; height: 100%; background: var(--ua-accent); transition: width .3s; }

/* Fil de la conversation */
.ua-fil { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; gap: 10px; padding: 16px; }
.ua-bulle { max-width: 86%; padding: 10px 14px; border-radius: 16px; font-size: .9375rem; line-height: 1.5; overflow-wrap: anywhere; }
.ua-bulle--assistant { align-self: flex-start; border-bottom-left-radius: 4px; background: var(--ua-bulle); color: var(--ua-encre); }
.ua-bulle--visiteur { align-self: flex-end; border-bottom-right-radius: 4px; background: var(--ua-primaire); color: #fff; white-space: pre-wrap; }
.ua-fenetre .ua-bulle p { margin: 0 0 .6em; color: inherit; font-size: inherit; line-height: inherit; }
.ua-fenetre .ua-bulle :is(ul, ol) { margin: 0 0 .6em; padding-left: 1.2em; }
.ua-fenetre .ua-bulle li { margin: 0 0 .2em; }
.ua-bulle > :last-child { margin-bottom: 0 !important; }
.ua-bulle a { color: inherit; text-decoration: underline; }
.ua-ecrit { align-self: flex-start; color: var(--ua-doux); font-size: .8125rem; font-style: italic; }
.ua-avis { align-self: stretch; padding: 12px 14px; border: 1px solid var(--ua-trait); border-radius: 12px; background: var(--ua-bulle); font-size: .875rem; }
.ua-avis .ua-primaire { margin-top: 10px; }

/* Boutons */
.ua-primaire { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 10px 20px; border: 0; border-radius: 999px; background: var(--ua-primaire); color: #fff !important; font: inherit; font-weight: 700; text-decoration: none !important; cursor: pointer; }
.ua-primaire:disabled { opacity: .45; cursor: not-allowed; }

/* Réponses proposées */
.ua-choix { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 16px 10px; }
.ua-choix:empty { display: none; }
.ua-choix button { min-height: 44px; padding: 8px 14px; border: 1.5px solid var(--ua-accent); border-radius: 999px; background: var(--ua-fond); color: var(--ua-encre); font: inherit; font-size: .875rem; font-weight: 600; line-height: 1.2; cursor: pointer; }
.ua-choix button:hover { background: var(--ua-bulle); }
.ua-choix button[aria-pressed="true"] { border-color: var(--ua-primaire); background: var(--ua-bulle); color: var(--ua-encre); }
.ua-choix button[aria-pressed="true"]::before { content: "✓ "; }
.ua-choix .ua-valider { border-color: var(--ua-primaire); background: var(--ua-primaire); color: #fff; }
.ua-choix button:disabled { opacity: .5; cursor: default; }

/* Récapitulatif : case de confidentialité et envoi */
.ua-recap { padding: 4px 16px 10px; }
.ua-recap label { display: flex; align-items: flex-start; gap: 10px; margin: 0 0 10px; font-size: .8125rem; line-height: 1.45; cursor: pointer; }
.ua-recap input { flex: none; width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--ua-primaire); }
.ua-recap a { color: inherit; text-decoration: underline; }
.ua-recap .ua-primaire { width: 100%; min-height: 48px; }

/* Saisie */
.ua-saisie { display: flex; align-items: flex-end; gap: 8px; margin: 0; padding: 10px 16px; border-top: 1px solid var(--ua-trait); }
.ua-saisie textarea { flex: 1; min-width: 0; min-height: 44px; max-height: 140px; margin: 0; padding: 11px 16px; border: 1px solid var(--ua-trait); border-radius: 22px; background: var(--ua-fond); color: var(--ua-encre); font: inherit; font-size: 1rem; line-height: 1.35; resize: none; }
.ua-saisie textarea::placeholder { color: var(--ua-doux); opacity: 1; }
.ua-envoyer { flex: none; display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%; background: var(--ua-primaire); color: #fff; cursor: pointer; }
.ua-envoyer:disabled, .ua-saisie textarea:disabled { opacity: .5; cursor: default; }

/* Pied */
.ua-pied { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; padding: 0 16px 12px; font-size: .75rem; }
.ua-pied a { color: var(--ua-doux); text-decoration: underline; }
.ua-turnstile:empty { display: none; }
.ua-turnstile { padding: 0 16px 10px; }
.ua-masque { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@media (prefers-reduced-motion: reduce) { .ua-progres__barre span { transition: none; } }

/* Bouton flottant « Une question ? » (assistant secrétariat) : présent sur toutes les pages, discret mais visible.
   Bordure : dégradé conique (cyan, avec un éclat or et blanc) qui tourne lentement autour du bouton. */
@property --ua-angle { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
.ua-flottant {
  --ua-fond-bouton: var(--up-nuit, #102f4f);
  --ua-cyan: var(--up-cyan, #1ca9cf);
  position: fixed;
  right: max(20px, env(safe-area-inset-right));
  bottom: max(20px, env(safe-area-inset-bottom));
  z-index: 9990;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 54px;
  margin: 0;
  padding: 7px 22px 7px 7px;
  border: 2.5px solid transparent;
  border-radius: 999px;
  background:
    linear-gradient(var(--ua-fond-bouton), var(--ua-fond-bouton)) padding-box,
    conic-gradient(from var(--ua-angle), var(--ua-cyan) 0deg, var(--ua-cyan) 190deg, #ffc94d 250deg, #fff 275deg, #ff8a3d 300deg, var(--ua-cyan) 350deg) border-box;
  color: #fff;
  font-family: var(--up-police, inherit);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: .01em;
  line-height: 1;
  text-transform: none;
  box-shadow: 0 12px 32px rgba(6, 24, 40, .34), 0 2px 6px rgba(6, 24, 40, .2);
  cursor: pointer;
  opacity: 0;
  translate: 0 14px;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
  animation: ua-apparait .55s cubic-bezier(.2, .8, .2, 1) 2s forwards, ua-tour 4.5s linear infinite;
}
.ua-flottant__icone { display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 50%; background: var(--up-cyan, #1ca9cf); color: var(--up-nuit, #102f4f); }
.ua-flottant:hover { box-shadow: 0 16px 38px rgba(6, 24, 40, .42), 0 0 0 4px rgba(28, 169, 207, .18); transform: translateY(-2px); }
.ua-flottant:focus-visible { outline: 3px solid var(--up-cyan, #1ca9cf); outline-offset: 3px; }
.ua-flottant--lueur::after {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  box-shadow: 0 0 0 0 rgba(28, 169, 207, .55);
  animation: ua-lueur 1.8s ease-out 2.7s 1;
  pointer-events: none;
}
[data-mode="sombre"] .ua-flottant { --ua-fond-bouton: #0f2a40; box-shadow: 0 12px 32px rgba(0, 0, 0, .55), 0 0 0 1px rgba(255, 255, 255, .06); }
@keyframes ua-apparait { to { opacity: 1; translate: 0 0; } }
@keyframes ua-tour { to { --ua-angle: 360deg; } }
@keyframes ua-lueur { 0% { box-shadow: 0 0 0 0 rgba(28, 169, 207, .55); } 100% { box-shadow: 0 0 0 16px rgba(28, 169, 207, 0); } }
@media (max-width: 600px) {
  .ua-flottant { right: max(14px, env(safe-area-inset-right)); bottom: max(14px, env(safe-area-inset-bottom)); padding: 6px; min-height: 0; }
  .ua-flottant__icone { width: 46px; height: 46px; }
  .ua-flottant__texte { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
}
@media (prefers-reduced-motion: reduce) {
  .ua-flottant { opacity: 1; translate: none; animation: none; transition: none; }
  .ua-flottant--lueur::after { animation: none; }
}
@media print { .ua-flottant { display: none; } }
