/* Fenêtre de discussion WhatsApp (créée par js/site.js). */
:root { --wa-green: #91A849; --wa-dark: #521214; --wa-teal: #91A849; --wa-olive: #7D9638; --wa-cream: #FBF5EC; --wa-sand: #F6EEDF; }

/* Le bouton flottant d'origine (ordinateur) est remplacé par le lanceur ci-dessous. */
a[aria-label="WhatsApp"][style*="position:fixed"] { display: none !important; }
/* Bouton de la barre mobile : logo WhatsApp au lieu de la bulle générique. */
a[aria-label="WhatsApp"] { position: relative; }
a[aria-label="WhatsApp"] > span:not(.wa-badge) {
  -webkit-mask-image: url(https://cdn.jsdelivr.net/npm/simple-icons@13.0.0/icons/whatsapp.svg) !important;
  mask-image: url(https://cdn.jsdelivr.net/npm/simple-icons@13.0.0/icons/whatsapp.svg) !important;
}

.wa-badge {
  position: absolute; top: -2px; right: -2px; min-width: 20px; height: 20px; padding: 0 5px;
  border-radius: 999px; background: #E53935; color: #fff; font: 700 11px/20px Montserrat, sans-serif;
  text-align: center; box-shadow: 0 0 0 2px #fff; pointer-events: none;
  animation: waPop 500ms cubic-bezier(.2, .8, .2, 1.4) both;
}
.wa-seen .wa-badge { display: none; }

/* Lanceur (ordinateur). */
.wa-launch {
  position: fixed; right: 22px; bottom: 22px; z-index: 70;
  width: 62px; height: 62px; border: none; padding: 0; border-radius: 50%; cursor: pointer;
  background: var(--wa-green); color: var(--wa-dark); display: grid; place-items: center;
  box-shadow: 0 12px 30px rgba(82, 18, 20, .3);
  transition: transform 350ms cubic-bezier(.2, .8, .2, 1), background 250ms;
}
.wa-launch:hover { transform: translateY(-3px) scale(1.05); }
.wa-launch::before {
  content: ""; position: absolute; inset: 0; border-radius: 50%; background: var(--wa-green);
  z-index: -1; animation: waRing 2.4s ease-out infinite;
}
.wa-launch .wa-ico, .wa-launch .wa-x { grid-area: 1 / 1; transition: transform 350ms cubic-bezier(.2, .8, .2, 1), opacity 250ms; }
.wa-ico {
  width: 30px; height: 30px; background: currentColor;
  -webkit-mask: url(https://cdn.jsdelivr.net/npm/simple-icons@13.0.0/icons/whatsapp.svg) center/contain no-repeat;
  mask: url(https://cdn.jsdelivr.net/npm/simple-icons@13.0.0/icons/whatsapp.svg) center/contain no-repeat;
}
.wa-x { font: 400 34px/1 Montserrat, sans-serif; opacity: 0; transform: rotate(-90deg); }
.wa-open .wa-launch { background: var(--wa-dark); color: var(--wa-cream); }
.wa-open .wa-launch::before { animation: none; opacity: 0; }
.wa-open .wa-launch .wa-ico { opacity: 0; transform: rotate(90deg) scale(.6); }
.wa-open .wa-launch .wa-x { opacity: 1; transform: none; }

/* Petite bulle d'invitation à côté du lanceur. */
.wa-teaser {
  position: fixed; right: 96px; bottom: 30px; z-index: 70; max-width: 250px;
  background: #fff; color: #521214; border-radius: 18px 18px 4px 18px;
  padding: 12px 34px 12px 14px; font: 500 14px/1.45 Montserrat, sans-serif;
  box-shadow: 0 14px 34px rgba(82, 18, 20, .18); cursor: pointer;
  opacity: 0; transform: translateY(10px) scale(.95); transform-origin: 100% 100%; pointer-events: none;
  transition: opacity 400ms ease, transform 500ms cubic-bezier(.2, .8, .2, 1);
}
.wa-teaser strong { display: block; font-weight: 700; margin-bottom: 2px; }
.wa-teaser.is-on { opacity: 1; transform: none; pointer-events: auto; }
.wa-teaser-x {
  position: absolute; top: 6px; right: 6px; width: 24px; height: 24px; border: none; border-radius: 50%;
  background: transparent; color: #521214; font-size: 16px; line-height: 1; cursor: pointer; opacity: .55;
}
.wa-teaser-x:hover { opacity: 1; background: #FBF5EC; }

/* Panneau de discussion. */
.wa-panel {
  position: fixed; right: 22px; bottom: 100px; z-index: 75;
  width: 370px; max-width: calc(100vw - 24px); height: 560px; max-height: calc(100vh - 130px);
  display: flex; flex-direction: column; overflow: hidden;
  border-radius: 24px; background: var(--wa-cream);
  box-shadow: 0 30px 80px rgba(30, 20, 20, .35), 0 0 0 1px rgba(0, 0, 0, .04);
  font-family: Montserrat, sans-serif; color: var(--wa-dark);
  opacity: 0; transform: translateY(24px) scale(.94); transform-origin: 100% 100%; pointer-events: none; visibility: hidden;
  transition: opacity 300ms ease, transform 450ms cubic-bezier(.2, .8, .2, 1), visibility 0s 450ms;
}
.wa-open .wa-panel {
  opacity: 1; transform: none; pointer-events: auto; visibility: visible;
  transition: opacity 300ms ease, transform 450ms cubic-bezier(.2, .8, .2, 1);
}

.wa-head {
  display: flex; align-items: center; gap: 12px; padding: 16px 16px 16px 18px; color: var(--wa-cream);
  background: linear-gradient(135deg, #6E2124, var(--wa-dark));
}
.wa-avatar { position: relative; flex: none; width: 46px; height: 46px; }
.wa-avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; object-position: 52% 30%; border: 2px solid #F3B916; }
.wa-avatar::after {
  content: ""; position: absolute; right: 1px; bottom: 1px; width: 12px; height: 12px; border-radius: 50%;
  background: var(--wa-green); box-shadow: 0 0 0 2px var(--wa-dark);
}
.wa-who { flex: 1; min-width: 0; }
.wa-name { font-family: var(--tf, 'Bevellier'), 'Bevellier', Montserrat, sans-serif; font-weight: 600; font-size: 19px; line-height: 1.1; color: #F3B916; }
.wa-status { font-size: 12.5px; opacity: .85; margin-top: 2px; }
.wa-close {
  flex: none; width: 34px; height: 34px; border: none; border-radius: 50%; cursor: pointer;
  background: rgba(251, 245, 236, .14); color: var(--wa-cream); font-size: 20px; line-height: 1;
}
.wa-close:hover { background: rgba(251, 245, 236, .28); }

.wa-body {
  flex: 1; overflow-y: auto; padding: 18px 14px 10px; display: flex; flex-direction: column; gap: 8px;
  overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: rgba(0, 0, 0, .2) transparent;
  background-color: var(--wa-cream);
  background-image: radial-gradient(rgba(82, 18, 20, .06) 1.2px, transparent 1.4px);
  background-size: 18px 18px;
}
.wa-day {
  align-self: center; font-size: 11.5px; font-weight: 600; color: var(--wa-olive); background: #fff;
  padding: 4px 10px; border-radius: 8px; box-shadow: 0 1px 1px rgba(0, 0, 0, .06); margin-bottom: 4px;
}
.wa-msg {
  max-width: 85%; padding: 8px 11px 6px; border-radius: 12px; font-size: 14.2px; line-height: 1.45;
  box-shadow: 0 2px 6px rgba(82, 18, 20, .07); animation: waIn 380ms cubic-bezier(.2, .8, .2, 1) both; overflow-wrap: anywhere;
}
.wa-msg time { display: block; text-align: right; font-size: 10.5px; color: rgba(82, 18, 20, .5); margin-top: 2px; }
.wa-in { align-self: flex-start; background: #fff; border-top-left-radius: 3px; }
.wa-out { align-self: flex-end; background: #E3EBC6; border-top-right-radius: 3px; }
.wa-out time::after { content: " ✓✓"; color: var(--wa-olive); }
.wa-cta {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 8px; padding: 9px 14px; border-radius: 999px;
  background: var(--wa-teal); color: var(--wa-dark) !important; font-weight: 600; font-size: 13.5px; text-decoration: none;
  transition: background 200ms, transform 200ms;
}
.wa-cta:hover { background: var(--wa-dark); color: var(--wa-cream) !important; transform: translateY(-1px); }

.wa-typing {
  align-self: flex-start; background: #fff; border-radius: 12px; border-top-left-radius: 3px; padding: 12px 14px;
  display: flex; gap: 4px; box-shadow: 0 2px 6px rgba(82, 18, 20, .07);
}
.wa-typing i { width: 7px; height: 7px; border-radius: 50%; background: rgba(82, 18, 20, .45); animation: waDot 1.2s infinite ease-in-out; }
.wa-typing i:nth-child(2) { animation-delay: .15s; }
.wa-typing i:nth-child(3) { animation-delay: .3s; }

.wa-chips { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; margin-top: 4px; }
.wa-chip {
  border: 1.5px solid var(--wa-teal); background: #fff; color: var(--wa-dark); cursor: pointer;
  padding: 8px 14px; border-radius: 999px; font: 600 13.5px/1.3 Montserrat, sans-serif; text-align: right;
  animation: waIn 380ms cubic-bezier(.2, .8, .2, 1) both; transition: background 200ms, color 200ms, transform 200ms;
}
.wa-chip:hover { background: var(--wa-teal); color: var(--wa-dark); transform: translateX(-3px); }

.wa-foot { display: flex; align-items: flex-end; gap: 8px; padding: 10px; background: var(--wa-sand); }
.wa-input {
  flex: 1; resize: none; border: none; outline: none; border-radius: 22px; padding: 11px 16px; max-height: 110px;
  font: 400 14.5px/1.4 Montserrat, sans-serif; color: var(--wa-dark); background: #fff; box-shadow: 0 1px 2px rgba(82, 18, 20, .08);
}
.wa-input:focus-visible { outline: 2px solid var(--wa-teal); outline-offset: 0; }
.wa-send {
  flex: none; width: 44px; height: 44px; border: none; border-radius: 50%; cursor: pointer;
  background: var(--wa-teal); color: var(--wa-dark); display: grid; place-items: center; transition: background 200ms, color 200ms, transform 200ms;
}
.wa-send:hover { background: var(--wa-dark); color: var(--wa-cream); transform: scale(1.06); }
.wa-send span {
  width: 20px; height: 20px; background: currentColor; margin-left: 2px;
  -webkit-mask: url(https://cdn.jsdelivr.net/npm/lucide-static@0.460.0/icons/send-horizontal.svg) center/contain no-repeat;
  mask: url(https://cdn.jsdelivr.net/npm/lucide-static@0.460.0/icons/send-horizontal.svg) center/contain no-repeat;
}
.wa-legal { text-align: center; font-size: 11px; color: rgba(82, 18, 20, .55); background: var(--wa-sand); padding: 0 10px 9px; }

@keyframes waIn { from { opacity: 0; transform: translateY(8px) scale(.97); } }
@keyframes waPop { from { transform: scale(0); } }
@keyframes waDot { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-4px); opacity: 1; } }
@keyframes waRing { 0% { transform: scale(1); opacity: .55; } 100% { transform: scale(1.6); opacity: 0; } }

/* Le bouton flottant ne doit pas cacher le crédit « Site propulsé par » en bas de page. */
/* La ligne du bas a exactement la largeur du bloc FEDER au-dessus (1240 px + ses marges internes). */
.sc-footbar { max-width: 1288px !important; }
/* Quand les boutons flottants arriveraient sur cette ligne, on laisse de la place dessous plutôt que de la décaler. */
@media (min-width: 1100px) and (max-width: 1467.98px) { .sc-footbar { padding-bottom: 100px !important; } }

@media (max-width: 1099.98px) {
  /* Sur mobile, c'est le bouton de la barre du bas qui ouvre la discussion. */
  .wa-launch, .wa-teaser { display: none; }
  .wa-panel { right: 12px; left: 12px; width: auto; max-width: none; bottom: 92px; height: 72vh; max-height: calc(100vh - 120px); }
  .wa-open .sc-top { opacity: 0; pointer-events: none; }
}
@media (prefers-reduced-motion: reduce) {
  .wa-launch::before, .wa-typing i, .wa-msg, .wa-chip, .wa-badge { animation: none !important; }
}
