/* Bouton flottant « Contacter » + retour en haut. Mobile first.
   Mobile : la pastille occupe la moitié droite de la barre basse
   (.sticky-bar garde « Identifier ma panne » à gauche), même hauteur. */
:root {
  --fab-h: 56px;
  --fab-edge: 12px;
}
.fab-container {
  position: fixed;
  right: var(--fab-edge);
  bottom: calc(var(--fab-edge) + env(safe-area-inset-bottom, 0px));
  width: calc(50% - 16px);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  z-index: 1046;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
  transition: opacity .4s cubic-bezier(.25, 1, .5, 1), transform .4s cubic-bezier(.25, 1, .5, 1), visibility .4s;
}
.fab-container.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.fab-contact-wrapper {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  width: 100%;
}

/* Retour en haut : au-dessus de la pastille sur mobile (la pastille reste alignée sur la barre basse) */
.fab-back-to-top {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 1.25rem;
  color: #fff;
  background: rgba(10, 10, 15, .88);
  border: 1px solid rgba(255, 255, 255, .14);
  box-shadow: 0 8px 22px rgba(8, 10, 19, .5);
  backdrop-filter: blur(10px);
  cursor: pointer;
  transition: transform .3s cubic-bezier(.25, 1, .5, 1), border-color .3s;
}
.fab-back-to-top:hover { transform: translateY(-3px); border-color: rgba(255, 255, 255, .3); }

/* Pastille : mêmes jetons que le bouton « Appeler » (--call-*) */
.fab-trigger {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: var(--fab-h);
  padding: 12px 16px;
  border: 0;
  border-radius: 12px;
  font: inherit;
  font-size: .95rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--call-ink, #fff);
  background: linear-gradient(135deg, var(--call-from, #b5552a), var(--call-to, #b5552a));
  box-shadow: 0 4px 15px rgba(8, 10, 19, .4), 0 8px 26px var(--call-glow, rgba(181, 85, 42, .38));
  cursor: pointer;
  transition: transform .3s cubic-bezier(.25, 1, .5, 1), box-shadow .3s;
}
.fab-trigger:hover { transform: translateY(-3px); box-shadow: 0 4px 15px rgba(8, 10, 19, .4), 0 12px 32px var(--call-glow-strong, rgba(181, 85, 42, .55)); }
.fab-trigger:active { transform: scale(.98); }
.fab-icon-wrap { position: relative; width: 1.25rem; height: 1.25rem; flex: none; font-size: 1.15rem; }
.fab-icon-default, .fab-icon-close {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: transform .3s cubic-bezier(.25, 1, .5, 1), opacity .3s;
}
.fab-icon-close { font-size: 1.7rem; line-height: 1; opacity: 0; transform: rotate(-90deg) scale(.5); }
.fab-contact-wrapper.active .fab-icon-default { opacity: 0; transform: rotate(90deg) scale(.5); }
.fab-contact-wrapper.active .fab-icon-close { opacity: 1; transform: none; }

/* Menu déroulant, ouvert au-dessus de la pastille */
.fab-menu {
  position: absolute;
  right: 0;
  bottom: calc(100% + 12px);
  min-width: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  pointer-events: none;
}
.fab-menu li {
  opacity: 0;
  visibility: hidden;
  transform: translateY(14px);
  transition: opacity .25s ease, transform .25s cubic-bezier(.25, 1, .5, 1), visibility .25s;
  transition-delay: calc((3 - var(--i, 0)) * .04s);
}
.fab-menu a {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 10px 16px;
  border-radius: 12px;
  font-size: .95rem;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  text-decoration: none;
  color: #fff;
  background: rgba(10, 10, 15, .94);
  border: 1px solid rgba(151, 166, 208, .28);
  box-shadow: 0 8px 22px rgba(8, 10, 19, .5);
  backdrop-filter: blur(10px);
  transition: border-color .2s, background-color .2s, transform .2s;
}
.fab-menu a i { color: var(--accent-cyan, #97a6d0); font-size: 1.1rem; flex: none; }
.fab-menu a small { display: block; font-size: .8rem; font-weight: 500; color: var(--text-secondary, #c4c4c4); }
.fab-menu a:hover { border-color: var(--accent-cyan, #97a6d0); background: rgba(20, 24, 34, .96); transform: translateX(-3px); }
.fab-contact-wrapper.active .fab-menu { pointer-events: auto; }
.fab-contact-wrapper.active .fab-menu li { opacity: 1; visibility: visible; transform: none; transition-delay: calc(var(--i, 0) * .04s); }

.fab-trigger:focus-visible, .fab-back-to-top:focus-visible, .fab-menu a:focus-visible {
  outline: 2px solid var(--accent-cyan, #97a6d0);
  outline-offset: 3px;
}

/* Menu ouvert : le retour en haut s'efface pour ne pas dépasser sous les liens */
.fab-container:has(.fab-contact-wrapper.active) .fab-back-to-top { opacity: 0; pointer-events: none; }

/* Desktop : pastille compacte en bas à droite, retour en haut dessous */
@media (min-width: 769px) {
  .fab-contact-wrapper { order: -1; }
  .fab-container { --fab-edge: 20px; width: auto; bottom: 20px; right: 20px; }
  .fab-contact-wrapper { width: auto; }
  .fab-trigger { width: auto; min-height: 52px; padding: 12px 24px 12px 18px; border-radius: 30px; font-size: 1rem; }
  .fab-menu { min-width: 220px; }
}

@media (prefers-reduced-motion: reduce) {
  .fab-container, .fab-trigger, .fab-back-to-top, .fab-menu li, .fab-menu a, .fab-icon-default, .fab-icon-close { transition: none; }
  .fab-trigger:hover, .fab-back-to-top:hover, .fab-menu a:hover { transform: none; }
}
