/* ═══ Barre de contact flottante — js/floating-contact.js ═══
   Composition :
   ┌───────────────────────┬────────┐
   │  ☎ Appeler            │  rail  │  ← rail (collapsed) : mini-icônes empilées
   │  ✉ Email              │ (toggle│  ← lage s'ouvre VERS LA GAUCHE
   │  ◎ Réseaux sociaux ›  │   ✕ )  │  le bord droit reste fixe sur l'écran
   │  ◉ 12 458 visiteurs   │        │
   └───────────────────────┴────────┘
   Icônes vectorielles (SVG Lucide + logos officiels) : nettes à toute
   résolution, aucun sprite raster. Dégradés, halos et séparateurs calquent
   la matière du header du portail (--primary/--gray-*).
   Il n'existe ni bouton WhatsApp flottant, ni retour en haut, ni chatbot :
   la barre est le seul élément position:fixed (hors toasts/hint PWA). */

/* ── Conteneur fixe ── */
.fc-bar {
  position: fixed;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 390; /* au-dessus du header (200), sous les modales (1000)/toasts (1100) */
  display: flex;
  align-items: stretch;
  direction: ltr; /* layout ancré au bord droit, même en RTL : le panneau pousse à gauche */
  filter: drop-shadow(0 14px 24px rgba(15, 52, 96, 0.14));
}

/* ── Panneau développé ── */
.fc-panel {
  display: flex;
  flex-direction: column;
  gap: 1px;
  width: 0;
  max-width: 0;
  min-width: 0;
  overflow: hidden;
  background: linear-gradient(180deg, #ffffff 0%, #f6f9fe 100%);
  border: 1px solid rgba(27, 77, 142, 0.14);
  border-right: none;
  border-radius: 20px 0 0 20px;
  box-shadow: inset 1px 0 0 rgba(255, 255, 255, 0.9);
  padding: 8px 6px;
  opacity: 0;
  pointer-events: none;
  transition: width 260ms cubic-bezier(0.22, 1, 0.36, 1),
              max-width 260ms cubic-bezier(0.22, 1, 0.36, 1),
              padding 260ms ease,
              border-width 260ms ease,
              opacity 200ms ease;
}

/* État fermé : rien ne dépasse — pilule propre de 48px, pas de liseré */
.fc-bar:not(.fc-open) .fc-panel { padding: 0; border-width: 0; }

.fc-bar.fc-open .fc-panel {
  width: 266px;
  max-width: 266px;
  opacity: 1;
  pointer-events: auto;
  transition-delay: 40ms;
}

/* ── Lignes ── */
.fc-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 54px;
  padding: 7px 14px 7px 12px;
  border: 0;
  background: transparent;
  width: 100%;
  text-align: left;
  font-family: var(--font-family);
  font-size: 14px;
  color: var(--gray-700);
  text-decoration: none;
  cursor: pointer;
  border-radius: 14px;
  transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.fc-row:hover,
.fc-row:focus-visible { background: rgba(232, 240, 254, 0.85); color: var(--primary); transform: translateX(-2px); }
.fc-row:focus-visible { outline: 3px solid rgba(27, 77, 142, 0.35); outline-offset: 1px; background: var(--primary-bg); }

.fc-row .fc-ic {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--white);
  background: linear-gradient(145deg, var(--primary-light) 0%, var(--primary) 55%, var(--primary-dark) 100%);
  box-shadow: 0 3px 8px rgba(27, 77, 142, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.35);
  font-size: 16px;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.fc-row:hover .fc-ic,
.fc-row:focus-visible .fc-ic { transform: scale(1.08); box-shadow: 0 5px 12px rgba(27, 77, 142, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.35); }
.fc-row .fc-ic svg { width: 17px; height: 17px; }
.fc-row .fc-ic svg { shape-rendering: geometricPrecision; }

.fc-lbl {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
  white-space: nowrap;
}
.fc-t { font-weight: 700; font-size: 13.5px; line-height: 1.3; letter-spacing: 0.1px; }
.fc-sub { font-size: 11.5px; color: var(--gray-500); line-height: 1.3; }

.fc-caret {
  margin-left: auto;
  color: var(--gray-400);
  font-size: 15px;
  font-weight: 700;
  transition: transform 0.18s ease, color 0.18s ease;
}
.fc-social-toggle:hover .fc-caret { color: var(--primary); }
.fc-social-wrap.fc-sub-open .fc-caret { transform: rotate(90deg); color: var(--primary); }

/* Ligne visiteurs : information, non cliquable ; pastille en aplat doux */
.fc-row.fc-nonlink { cursor: default; }
.fc-row.fc-nonlink:hover { background: transparent; transform: none; }
.fc-row.fc-nonlink .fc-ic {
  background: linear-gradient(145deg, #4b5563 0%, #374151 60%, #1f2937 100%);
  box-shadow: 0 3px 8px rgba(17, 24, 39, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}
.fc-count {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--primary-dark);
  background: var(--primary-bg);
  border-radius: 8px;
  padding: 0 6px;
}

/* ── Rail de gauche (état réduit) ── */
.fc-rail {
  flex: 0 0 48px;
  width: 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 13px 0;
  background: linear-gradient(180deg, #ffffff 0%, #f6f9fe 100%);
  border: 1px solid rgba(27, 77, 142, 0.14);
  border-radius: 20px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
  transition: background 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}
.fc-rail:hover,
.fc-rail:focus-visible { background: var(--primary-bg); border-color: var(--primary-light); box-shadow: 0 6px 14px rgba(27, 77, 142, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.8); }
.fc-rail:focus-visible { outline: 3px solid rgba(27, 77, 142, 0.35); outline-offset: 1px; }

.fc-rail .fc-rail-ic {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: var(--primary);
  background: rgba(232, 240, 254, 0.55);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
  transition: transform 0.16s ease, background 0.16s ease, color 0.16s ease;
}
.fc-rail:hover .fc-rail-ic,
.fc-rail:focus-visible .fc-rail-ic { background: #ffffff; color: var(--primary-dark); transform: scale(1.1); }
.fc-rail .fc-rail-ic svg { width: 18px; height: 18px; }
.fc-rail .fc-rail-ic svg { shape-rendering: geometricPrecision; }

/* Rail visible en état réduit, masqué quand le panneau est ouvert */
.fc-bar.fc-open .fc-rail {
  width: 36px;
  flex-basis: 36px;
  gap: 9px;
  padding: 10px 0;
  background: linear-gradient(180deg, #ffffff 0%, #eef3fb 100%);
  border-color: rgba(27, 77, 142, 0.16);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}
.fc-bar.fc-open .fc-rail .fc-rail-ic {
  width: 28px;
  height: 28px;
  background: transparent;
  box-shadow: none;
  opacity: 0.45;
}
.fc-bar.fc-open .fc-rail:hover .fc-rail-ic { opacity: 0.75; }

/* ── Sous-menu réseaux sociaux (coule à l'intérieur de la barre) ── */
.fc-social-wrap { position: relative; padding: 0; }
.fc-social-wrap .fc-submenu {
  display: none;
}
.fc-social-wrap.fc-sub-open .fc-submenu {
  display: grid;
  gap: 3px;
  padding: 8px;
  background: linear-gradient(180deg, #ffffff 0%, #f6f9fe 100%);
  border: 1px solid rgba(27, 77, 142, 0.14);
  border-radius: 16px;
  box-shadow: 0 10px 20px rgba(15, 52, 96, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.9);
  margin: 2px 12px 10px 51px;
  animation: fc-fade-in 180ms ease;
}
@keyframes fc-fade-in {
  from { opacity: 0; transform: translateY(-3px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.fc-submenu .fc-soc {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-800);
  text-decoration: none;
  transition: background 0.15s ease, transform 0.15s ease;
}
.fc-submenu .fc-soc:hover,
.fc-submenu .fc-soc:focus-visible { background: #ffffff; box-shadow: 0 2px 6px rgba(15, 52, 96, 0.1); transform: translateX(-1px); }
.fc-submenu .fc-soc:focus-visible { outline: 3px solid rgba(27, 77, 142, 0.35); outline-offset: 1px; }

.fc-submenu .fc-soc .fc-soc-ic {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--white);
  box-shadow: 0 2px 5px rgba(15, 52, 96, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.3);
  transition: transform 0.15s ease;
}
.fc-submenu .fc-soc:hover .fc-soc-ic { transform: scale(1.1); }
.fc-submenu .fc-soc .fc-soc-ic svg { width: 15px; height: 15px; }
.fc-submenu .fc-soc .fc-soc-ic svg { shape-rendering: geometricPrecision; }

.fc-social-facebook  .fc-soc-ic { background: linear-gradient(145deg, #4c9aff 0%, #1877F2 60%, #1456b9 100%); }
.fc-social-instagram .fc-soc-ic { background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%); }
.fc-social-tiktok    .fc-soc-ic { background: linear-gradient(145deg, #313131 0%, #000000 55%, #1c1c1e 100%); box-shadow: 0 2px 5px rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.18); }
.fc-social-whatsapp  .fc-soc-ic { background: linear-gradient(145deg, #4ff58d 0%, #25D366 55%, #128c4a 100%); box-shadow: 0 2px 5px rgba(37, 211, 102, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.35); }

/* ── Réglages RTL : texte arabe, barre toujours à droite ── */
[dir="rtl"] .fc-row { text-align: right; flex-direction: row; }
[dir="rtl"] .fc-row:hover,
[dir="rtl"] .fc-row:focus-visible { transform: translateX(2px); }
[dir="rtl"] .fc-caret { margin-left: 0; margin-right: auto; transform: rotate(180deg); }
[dir="rtl"] .fc-social-wrap.fc-sub-open .fc-caret { transform: rotate(90deg); }
[dir="rtl"] .fc-panel { border-radius: 0 20px 20px 0; border-right: 1px solid rgba(27, 77, 142, 0.14); border-left: none; }

/* ── Tablette : dimensions légèrement réduites ── */
@media (max-width: 1024px) {
  .fc-bar.fc-open .fc-panel { width: 238px; max-width: 238px; }
  .fc-row { font-size: 13.5px; }
  .fc-sub { font-size: 11px; }
}

/* ── Mobile : pas de hover (le geste tactile ouvre), panneau compact ──
    La barre reste fixe à droite ; aucun débordement horizontal n'est créé. */
@media (max-width: 768px) {
  .fc-bar { right: 10px; }
  .fc-bar.fc-open .fc-panel { width: min(238px, calc(100vw - 74px)); max-width: min(238px, calc(100vw - 74px)); }
  .fc-row { padding: 6px 11px 6px 11px; gap: 10px; }
  .fc-row .fc-ic { width: 34px; height: 34px; }
  .fc-rail { flex-basis: 44px; width: 44px; border-radius: 18px; gap: 10px; }
  .fc-social-wrap.fc-sub-open .fc-submenu { margin-left: 46px; }
}

/* ── Confort réduit en mouvement : pas d'animation ── */
@media (prefers-reduced-motion: reduce) {
  .fc-bar,
  .fc-panel,
  .fc-submenu { transition: none !important; }
  .fc-social-wrap.fc-sub-open .fc-submenu { animation: none; }
  .fc-row, .fc-rail, .fc-ic, .fc-rail-ic, .fc-soc, .fc-soc-ic { transition: none !important; }
}