/**
 * Bulle de chat custom ov_brevo_chat.
 *
 * États pilotés par classes (le JS ne touche jamais au DOM au-delà) :
 *  - .ov-bchat--on    : Brevo chargé -> bulle visible (double verrou)
 *  - .ov-bchat--link  : fallback adblock -> la bulle est un lien contact
 * Variables CSS injectées côté serveur sur #ovBchat (couleurs, tailles,
 * offsets, z-index) — voir hookDisplayBeforeBodyClosingTag.
 */

.ov-bchat {
  position: fixed;
  bottom: calc(var(--ov-bchat-y-d, 24px) + env(safe-area-inset-bottom, 0px));
  z-index: var(--ov-bchat-z, 1030);
  /* Invisible tant que le JS n'a pas confirmé le chargement de Brevo :
     zéro flash au premier paint, zéro bouton mort sous adblock. */
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity .25s ease, transform .25s ease, visibility 0s linear .25s;
}
.ov-bchat--right { right: var(--ov-bchat-x-d, 24px); }
.ov-bchat--left { left: var(--ov-bchat-x-d, 24px); }

.ov-bchat--on {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
  transition: opacity .25s ease, transform .25s ease;
}

.ov-bchat__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: var(--ov-bchat-size-d, 60px);
  min-width: var(--ov-bchat-size-d, 60px);
  padding: 0;
  border: none;
  border-radius: 999px;
  background: var(--ov-bchat-bg, #223A88);
  color: var(--ov-bchat-fg, #fff);
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .25);
  position: relative;
  transition: transform .15s ease, box-shadow .15s ease;
}
.ov-bchat__btn:hover {
  transform: scale(1.06);
  box-shadow: 0 6px 20px rgba(0, 0, 0, .3);
}
.ov-bchat__btn:focus-visible {
  outline: 2px solid var(--ov-bchat-fg, #fff);
  outline-offset: 2px;
}

.ov-bchat__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.ov-bchat__label {
  display: none;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}
/* Forme pilule : libellé visible sur desktop uniquement. */
@media (min-width: 768px) {
  .ov-bchat--pill .ov-bchat__btn { padding: 0 18px 0 14px; }
  .ov-bchat--pill .ov-bchat__label { display: inline; }
}

.ov-bchat__badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 10px;
  background: #e5534b;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 20px;
  text-align: center;
}

/* Appareils (réglage BO). */
@media (max-width: 767.98px) {
  .ov-bchat--dev-desktop { display: none; }
  .ov-bchat {
    bottom: calc(var(--ov-bchat-y-m, 16px) + env(safe-area-inset-bottom, 0px));
  }
  .ov-bchat--right { right: var(--ov-bchat-x-m, 16px); }
  .ov-bchat--left { left: var(--ov-bchat-x-m, 16px); }
  .ov-bchat__btn {
    height: var(--ov-bchat-size-m, 52px);
    min-width: var(--ov-bchat-size-m, 52px);
  }
}
@media (min-width: 768px) {
  .ov-bchat--dev-mobile { display: none; }
}

/* Compensation du dézoom global du thème : ovelo_2025 applique
   body { zoom: 0.8 } sur 768–1599.98px (_overrides.scss / _commons.scss).
   Sans compensation, la bulle fixed serait rendue à 80 % et mal positionnée.
   0.8 × 1.25 = 1 -> taille et offsets redeviennent exacts. */
@media (min-width: 768px) and (max-width: 1599.98px) {
  .ov-bchat { zoom: 1.25; }
}
