/* Bouton flottant « Assistant d'étude » (components/footer.php) : coin bas droit ; sur téléphone, au-dessus de la barre d'onglets du bas. */
.chat-fab {
  --fab: clamp(54px, 4.6vw, 64px);
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 180;
  width: var(--fab);
  height: var(--fab);
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(160deg, #1d7a50, #146040);
  box-shadow: 0 8px 22px rgba(15, 40, 30, 0.38), 0 0 0 3px rgba(255, 255, 255, 0.9);
  color: #fff;
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.chat-fab svg { width: 64%; height: 64%; display: block; }
.chat-fab:hover, .chat-fab:focus-visible { transform: translateY(-2px) scale(1.04); box-shadow: 0 12px 28px rgba(15, 40, 30, 0.45), 0 0 0 3px #fff; outline: none; }
.chat-fab:focus-visible { box-shadow: 0 0 0 3px #fff, 0 0 0 6px #1d7a50; }
/* Petite étiquette qui apparaît au survol (ordinateur) */
.chat-fab-label {
  position: absolute; right: calc(100% + 10px); top: 50%; transform: translateY(-50%) translateX(6px);
  padding: 0.3rem 0.7rem; border-radius: 999px; background: #16233a; color: #fff;
  font-size: 0.82rem; font-weight: 700; white-space: nowrap; opacity: 0; pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
}
@media (hover: hover) { .chat-fab:hover .chat-fab-label, .chat-fab:focus-visible .chat-fab-label { opacity: 1; transform: translateY(-50%); } }
/* Léger battement à l'arrivée sur la page (une fois) */
@keyframes chat-fab-pulse { 0% { box-shadow: 0 8px 22px rgba(15, 40, 30, 0.38), 0 0 0 3px rgba(255, 255, 255, 0.9), 0 0 0 0 rgba(29, 122, 80, 0.55); } 100% { box-shadow: 0 8px 22px rgba(15, 40, 30, 0.38), 0 0 0 3px rgba(255, 255, 255, 0.9), 0 0 0 18px rgba(29, 122, 80, 0); } }
.chat-fab { animation: chat-fab-pulse 1.8s ease-out 1.2s 2; }
@media (prefers-reduced-motion: reduce) { .chat-fab { animation: none; transition: none; } }

/* Téléphone : au-dessus de la barre d'onglets (60 px) et de la zone de sécurité de l'appareil */
@media (max-width: 767px) {
  .chat-fab {
    --fab: clamp(48px, 13vw, 56px);
    right: 14px;
    bottom: calc(var(--tabbar-height, 60px) + env(safe-area-inset-bottom, 0px) + 14px);
  }
  .chat-fab-label { display: none; }
}
/* Écrans très larges : un peu plus grand et plus loin du bord */
@media (min-width: 1500px) { .chat-fab { --fab: 68px; right: 28px; bottom: 28px; } }
/* Impression : jamais */
@media print { .chat-fab { display: none; } }
/* Plein écran du lecteur ou du navigateur : masqué */
body.is-fullscreen .chat-fab { display: none; }
