/* ==========================================================================
   Chatbot WhatsApp SOGE-ALU CI (s'appuie sur les variables de sogealu.css)
   ========================================================================== */
.wa-chat { position: relative; display: grid; justify-items: end; gap: 12px; }

/* Bouton d'ouverture */
.wa-chat__launcher {
  position: relative;
  display: grid;
  place-items: center;
  width: 60px; height: 60px;
  border: 0;
  border-radius: 50%;
  color: #fff;
  background: #25d366;
  font-size: 1.65rem;
  box-shadow: 0 14px 30px -10px rgba(37, 211, 102, .7), var(--sh-md);
  transition: transform var(--t) var(--ease-out), background-color var(--t) var(--ease);
}
.wa-chat__launcher:hover { transform: translateY(-3px) scale(1.03); }
.wa-chat__launcher::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid #25d366;
  animation: waRing 2.6s var(--ease) infinite;
}
.wa-chat.is-open .wa-chat__launcher::before { animation: none; opacity: 0; }
@keyframes waRing { 0% { transform: scale(1); opacity: .8; } 80%, 100% { transform: scale(1.5); opacity: 0; } }
.wa-chat__launcher i { position: absolute; transition: transform var(--t) var(--ease-out), opacity var(--t-fast); }
.wa-chat__icon-close { font-size: 1.25rem; opacity: 0; transform: rotate(-90deg); }
.wa-chat.is-open .wa-chat__launcher { background: var(--ink); box-shadow: var(--sh-lg); }
.wa-chat.is-open .wa-chat__icon-open { opacity: 0; transform: rotate(90deg); }
.wa-chat.is-open .wa-chat__icon-close { opacity: 1; transform: none; }
.wa-chat__badge {
  position: absolute;
  top: -2px; right: -2px;
  display: grid;
  place-items: center;
  min-width: 22px; height: 22px;
  padding: 0 6px;
  font-size: .72rem;
  font-weight: 800;
  color: #fff;
  background: var(--danger);
  border: 2px solid #fff;
  border-radius: 999px;
}
.wa-chat__badge[hidden], .wa-chat.is-open .wa-chat__badge { display: none; }

/* Invitation */
.wa-chat__teaser {
  position: relative;
  max-width: 250px;
  padding: 14px 34px 14px 16px;
  font-size: .88rem;
  line-height: 1.4;
  color: var(--ink);
  background: #fff;
  border-radius: 16px 16px 4px 16px;
  box-shadow: var(--sh-lg);
  cursor: pointer;
  animation: fadeUp .5s var(--ease-out);
}
.wa-chat__teaser[hidden] { display: none; }
.wa-chat__teaser strong { display: block; margin-bottom: 2px; }
.wa-chat__teaser span { color: var(--steel); }
.wa-chat__teaser-close { position: absolute; top: 6px; right: 8px; border: 0; background: none; font-size: 1.2rem; line-height: 1; color: var(--steel-2); }

/* Panneau */
.wa-chat__panel {
  position: absolute;
  right: 0;
  bottom: 76px;
  display: flex;
  flex-direction: column;
  width: min(380px, calc(100vw - 32px));
  height: min(600px, calc(100vh - 140px));
  overflow: hidden;
  background: #efeae2;
  border-radius: 20px;
  box-shadow: 0 30px 70px -20px rgba(10, 26, 34, .45);
  opacity: 0;
  transform: translateY(16px) scale(.97);
  transform-origin: bottom right;
  transition: opacity .25s var(--ease), transform .35s var(--ease-out);
}
.wa-chat__panel[hidden] { display: none; }
.wa-chat.is-open .wa-chat__panel { opacity: 1; transform: none; }

.wa-chat__head { display: flex; align-items: center; gap: 12px; padding: 14px 14px 14px 16px; color: #fff; background: #075e54; }
.wa-chat__avatar { display: grid; place-items: center; flex-shrink: 0; width: 44px; height: 44px; border-radius: 50%; background: #fff; overflow: hidden; }
.wa-chat__avatar img { width: 38px; height: auto; }
.wa-chat__who { flex: 1; min-width: 0; line-height: 1.25; }
.wa-chat__who strong { display: block; font-size: 1rem; color: #fff; }
.wa-chat__who small { display: flex; align-items: center; gap: 6px; font-size: .76rem; opacity: .85; }
.wa-chat__online { width: 8px; height: 8px; flex-shrink: 0; border-radius: 50%; background: #25d366; box-shadow: 0 0 0 2px rgba(255, 255, 255, .3); }
.wa-chat__close { display: grid; place-items: center; width: 36px; height: 36px; border: 0; border-radius: 50%; color: #fff; background: transparent; }
.wa-chat__close:hover { background: rgba(255, 255, 255, .12); }

/* Fil de discussion */
.wa-chat__body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 12px 8px;
  overscroll-behavior: contain;
  background-color: #efeae2;
  background-image: radial-gradient(rgba(7, 94, 84, .06) 1px, transparent 1px);
  background-size: 14px 14px;
}
.wa-msg { display: flex; margin-bottom: 6px; animation: fadeUp .3s var(--ease-out); }
.wa-msg--user { justify-content: flex-end; }
.wa-msg__bubble {
  position: relative;
  max-width: 84%;
  padding: 7px 10px 18px;
  font-size: .9rem;
  line-height: 1.45;
  color: #111b21;
  background: #fff;
  border-radius: 10px 10px 10px 2px;
  box-shadow: 0 1px .5px rgba(11, 20, 26, .13);
  overflow-wrap: anywhere;
}
.wa-msg--user .wa-msg__bubble { background: #d9fdd3; border-radius: 10px 10px 2px 10px; }
.wa-msg__bubble a { color: #027eb5; text-decoration: underline; }
.wa-msg__time { position: absolute; right: 8px; bottom: 3px; font-size: .66rem; color: #667781; }
.wa-msg__time i { color: #53bdeb; }
.wa-msg__list { margin: 6px 0 0; padding-left: 18px; }
.wa-msg__list li { margin: 2px 0; }
.wa-msg__typing { display: inline-flex; gap: 4px; padding: 12px 14px; }
.wa-msg__typing span { width: 7px; height: 7px; border-radius: 50%; background: #8696a0; animation: waDot 1.2s infinite; }
.wa-msg__typing span:nth-child(2) { animation-delay: .15s; }
.wa-msg__typing span:nth-child(3) { animation-delay: .3s; }
@keyframes waDot { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-4px); opacity: 1; } }

/* Réponses rapides */
.wa-chat__chips { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; padding: 4px 12px 10px; background: #efeae2; }
.wa-chat__chips:empty { display: none; }
.wa-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 13px;
  font-size: .84rem;
  font-weight: 600;
  line-height: 1.2;
  color: #075e54;
  background: #fff;
  border: 1px solid rgba(7, 94, 84, .25);
  border-radius: 999px;
  cursor: pointer;
  text-decoration: none;
  transition: background-color var(--t-fast), color var(--t-fast), border-color var(--t-fast), transform var(--t-fast);
  animation: fadeUp .3s var(--ease-out) both;
}
.wa-chip:hover { background: #075e54; color: #fff; border-color: #075e54; }
.wa-chip:active { transform: scale(.97); }
.wa-chip.is-wa { color: #fff; background: #25d366; border-color: #25d366; }
.wa-chip.is-wa:hover { background: #1ebe5b; border-color: #1ebe5b; }

/* Zone de saisie */
.wa-chat__composer { display: flex; align-items: center; gap: 8px; padding: 8px 10px; background: #f0f2f5; }
.wa-chat__input { flex: 1; min-width: 0; height: 42px; padding: 0 16px; font-size: .92rem; color: #111b21; background: #fff; border: 0; border-radius: 999px; outline: none; }
.wa-chat__input:focus { box-shadow: 0 0 0 2px rgba(7, 94, 84, .3); }
.wa-chat__send { display: grid; place-items: center; flex-shrink: 0; width: 42px; height: 42px; border: 0; border-radius: 50%; color: #fff; background: #00a884; font-size: 1rem; transition: background-color var(--t-fast); }
.wa-chat__send:hover { background: #008f72; }
.wa-chat__legal { margin: 0; padding: 0 12px 8px; font-size: .7rem; text-align: center; color: #667781; background: #f0f2f5; }
.wa-chat__legal i { color: #25d366; }

/* Mobile : plein écran */
@media (max-width: 640px) {
  .wa-chat__panel {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    height: 100dvh;
    border-radius: 0;
    z-index: 200;
  }
  .wa-chat.is-open .wa-chat__launcher { display: none; }
  body.wa-chat-lock { overflow: hidden; }
  body.wa-chat-lock .floating { z-index: 300; } /* passe au-dessus de l'en-tête du site */
  body.wa-chat-lock .fab--top { display: none; }
}
@media (prefers-reduced-motion: reduce) { .wa-chat__launcher::before { animation: none; } }
