/* Box Design 97 - Boutons Appel & WhatsApp
   Charte : bleu #17318f (containers), anthracite #383839, vert #4ea705 réservé au devis, police Figtree. */

.bd97c, .bd97c-inline {
  --bd97c-blue: var(--bd97-blue, #17318f);
  --bd97c-blue-dark: var(--bd97-blue-dark, #0f2464);
  --bd97c-dark: var(--bd97-dark, #383839);
  --bd97c-text: var(--bd97-text, #2b2f3a);
  --bd97c-line: var(--v6-line, #dde3ee);
  --bd97c-light: #f4f6fb;
  --bd97c-wa: #1e9e4a;
  --bd97c-wa-soft: #e8f7ee;
  --bd97c-green-grad: var(--v6-green-grad, linear-gradient(180deg, #70c80e 0%, #56ae06 45%, #429700 100%));
  --bd97c-green-grad-hover: var(--v6-green-grad-hover, linear-gradient(180deg, #5fb80a 0%, #4a9d04 45%, #377f00 100%));
  --bd97c-font: var(--bd97-font, "Figtree", "Helvetica Neue", Arial, sans-serif);
  --bd97c-bar-h: 62px;
  font-family: var(--bd97c-font);
  color: var(--bd97c-text);
}
.bd97c *, .bd97c-inline * { box-sizing: border-box; }
.bd97c [hidden], .bd97c-inline [hidden] { display: none !important; }
.bd97c-ico { width: 22px; height: 22px; flex: 0 0 auto; display: block; }

/* ---------- Boutons Appel / WhatsApp (panneau + boutons réutilisables) ---------- */
.bd97c-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.bd97c-actions > * { min-width: 0; }
.bd97c-btn {
  display: flex; align-items: center; gap: 10px;
  min-height: 56px; padding: 9px 12px;
  border-radius: 8px; border: 1.5px solid transparent;
  text-decoration: none !important; line-height: 1.15;
  transition: background-color .15s, border-color .15s, transform .1s, box-shadow .15s;
}
.bd97c-btn:active { transform: scale(.98); }
.bd97c-btn:focus-visible { outline: 3px solid #91b4ff; outline-offset: 2px; }
.bd97c-btn-txt { display: flex; flex-direction: column; min-width: 0; }
.bd97c-btn-txt small { font-size: 12px; font-weight: 600; opacity: .85; text-transform: uppercase; letter-spacing: .04em; }
.bd97c-btn-txt strong { font-size: 15.5px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.bd97c-btn--call { background: var(--bd97c-blue); color: #fff !important; }
.bd97c-btn--call:hover { background: var(--bd97c-blue-dark); }
.bd97c-btn--wa { background: var(--bd97c-wa-soft); color: #0e5a2a !important; border-color: #b9e6c9; }
.bd97c-btn--wa .bd97c-ico { color: var(--bd97c-wa); }
.bd97c-btn--wa:hover { background: #d9f2e2; border-color: var(--bd97c-wa); }

/* ---------- Bouton flottant (ordinateur) ---------- */
.bd97c-launcher {
  position: fixed; right: 22px; bottom: 22px; z-index: 9990;
  display: none; align-items: center; gap: 12px;
  padding: 8px 20px 8px 8px; border: 0; border-radius: 999px; cursor: pointer;
  background: var(--bd97c-blue); color: #fff; font-family: var(--bd97c-font); text-align: left;
  box-shadow: 0 10px 28px rgba(15, 36, 100, .35), 0 2px 6px rgba(0, 0, 0, .12);
  transition: transform .2s, background-color .2s, box-shadow .2s;
}
.bd97c-launcher:hover { background: var(--bd97c-blue-dark); transform: translateY(-2px); }
.bd97c-launcher:focus-visible { outline: 3px solid #91b4ff; outline-offset: 3px; }
.bd97c-launcher-icons { display: flex; }
.bd97c-launcher-dot {
  width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center;
  border: 2px solid var(--bd97c-blue);
}
.bd97c-launcher-dot--call { background: #fff; color: var(--bd97c-blue); }
.bd97c-launcher-dot--wa { background: var(--bd97c-wa); color: #fff; margin-left: -10px; }
.bd97c-launcher-text { display: flex; flex-direction: column; line-height: 1.2; }
.bd97c-launcher-text strong { font-size: 15px; font-weight: 800; }
.bd97c-launcher-text small { font-size: 12.5px; opacity: .85; }
.bd97c.is-open .bd97c-launcher { box-shadow: 0 4px 12px rgba(15, 36, 100, .3); }
.bd97c-launcher.is-pulse .bd97c-launcher-dot--wa { animation: bd97c-pulse 1.6s ease-out 2; }
@keyframes bd97c-pulse {
  0% { box-shadow: 0 0 0 0 rgba(30, 158, 74, .55); }
  100% { box-shadow: 0 0 0 14px rgba(30, 158, 74, 0); }
}

/* ---------- Panneau (popover ordinateur / feuille mobile) ---------- */
.bd97c-backdrop {
  position: fixed; inset: 0; z-index: 10039;
  background: rgba(17, 24, 39, .45);
  animation: bd97c-fade .2s ease;
}
.bd97c-panel {
  position: fixed; z-index: 10040;
  background: #fff; color: var(--bd97c-text);
  box-shadow: 0 24px 60px rgba(15, 36, 100, .28);
  overflow: hidden auto;
}
.bd97c-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 18px 18px 16px; color: #fff;
  background: linear-gradient(135deg, var(--bd97c-blue) 0%, var(--bd97c-blue-dark) 100%);
}
.bd97c-title { margin: 0; font-size: 19px; font-weight: 800; line-height: 1.2; color: #fff; }
.bd97c-title > span { display: none; }
.bd97c-panel[data-mode="all"] .bd97c-title-all,
.bd97c-panel[data-mode="call"] .bd97c-title-call,
.bd97c-panel[data-mode="whatsapp"] .bd97c-title-whatsapp { display: inline; }
.bd97c-sub { margin: 4px 0 0; font-size: 14px; opacity: .88; color: #fff; }
.bd97c-close {
  flex: 0 0 auto; width: 36px; height: 36px; margin: -4px -6px 0 0;
  display: grid; place-items: center; border: 0; border-radius: 50%;
  background: rgba(255, 255, 255, .14); color: #fff; cursor: pointer;
}
.bd97c-close:hover { background: rgba(255, 255, 255, .26); }
.bd97c-close .bd97c-ico { width: 20px; height: 20px; }

.bd97c-terrs { display: flex; flex-direction: column; gap: 10px; padding: 14px 14px 4px; }
.bd97c-terr { padding: 12px; border: 1px solid var(--bd97c-line); border-radius: 10px; background: #fff; }
.bd97c-terr.is-preferred { border-color: var(--bd97c-blue); box-shadow: 0 0 0 1px var(--bd97c-blue) inset; }
.bd97c-terr-name {
  display: flex; align-items: center; gap: 6px; margin: 0 0 10px;
  font-size: 15px; font-weight: 800; color: var(--bd97c-dark);
}
.bd97c-terr-name .bd97c-ico { width: 18px; height: 18px; color: var(--bd97c-blue); }
.bd97c-badge {
  margin-left: auto; padding: 3px 8px; border-radius: 999px;
  background: var(--bd97c-light); color: var(--bd97c-blue); font-size: 11.5px; font-weight: 700;
}

/* Mode « Appeler » ou « WhatsApp » ouvert depuis la barre mobile : un seul bouton, pleine largeur */
.bd97c-panel[data-mode="call"] .bd97c-btn--wa,
.bd97c-panel[data-mode="whatsapp"] .bd97c-btn--call { display: none; }
.bd97c-panel[data-mode="call"] .bd97c-actions,
.bd97c-panel[data-mode="whatsapp"] .bd97c-actions { grid-template-columns: 1fr; }
.bd97c-panel:not([data-mode="call"]) .bd97c-hint--wa { display: block; }
.bd97c-panel[data-mode="call"] .bd97c-hint--wa { display: none; }

.bd97c-hint, .bd97c-hours { margin: 8px 16px 0; font-size: 13px; color: #5b6272; line-height: 1.4; }
.bd97c-hours { font-weight: 600; color: var(--bd97c-dark); }
.bd97c-devis {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  margin: 14px; min-height: 50px; border-radius: 8px;
  background: var(--bd97c-green-grad); color: #fff !important;
  font-size: 16px; font-weight: 800; text-decoration: none !important;
  text-shadow: 0 1px 0 rgba(0, 0, 0, .15);
}
.bd97c-devis:hover { background: var(--bd97c-green-grad-hover); }

/* ---------- Barre fixe mobile ---------- */
.bd97c-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 9990;
  display: none; gap: 6px;
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px));
  background: #fff; border-top: 1px solid var(--bd97c-line);
  box-shadow: 0 -6px 20px rgba(15, 36, 100, .12);
  transition: transform .2s ease;
}
.bd97c-bar.is-hidden { transform: translateY(110%); }
.bd97c-bar-btn {
  flex: 1 1 0; display: flex; align-items: center; justify-content: center; gap: 7px;
  height: 50px; padding: 0 6px; border-radius: 8px; border: 1.5px solid transparent;
  font-family: var(--bd97c-font); font-size: 15px; font-weight: 800; line-height: 1;
  text-decoration: none !important; cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.bd97c-bar-btn:active { transform: scale(.97); }
.bd97c-bar-btn--call { background: var(--bd97c-blue); color: #fff !important; }
.bd97c-bar-btn--wa { background: #fff; color: var(--bd97c-dark) !important; border-color: #b9e6c9; }
.bd97c-bar-btn--wa .bd97c-ico { color: var(--bd97c-wa); }
.bd97c-bar-btn--devis { background: var(--bd97c-green-grad); color: #fff !important; }

/* ---------- Boutons réutilisables (module conseiller, fiches produit, CMS…) ---------- */
.bd97c-inline { display: grid; gap: 12px; margin: 12px 0; }
.bd97c-inline-title { grid-column: 1 / -1; margin: 0; font-size: 17px; font-weight: 800; color: var(--bd97c-blue); }
.bd97c-inline-terr { padding: 12px; border: 1px solid var(--bd97c-line); border-radius: 10px; background: #fff; }
.bd97c-inline-name { margin: 0 0 8px; font-size: 14px; font-weight: 800; color: var(--bd97c-dark); }
.bd97c-inline--row { grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); }
.bd97c-inline--compact { gap: 8px; }
.bd97c-inline--compact .bd97c-inline-terr { padding: 0; border: 0; }
.bd97c-inline--compact .bd97c-btn { min-height: 46px; padding: 7px 10px; }
.bd97c-inline--compact .bd97c-btn-txt strong { font-size: 14.5px; }

/* ---------- Ordinateur ---------- */
@media (min-width: 768px) {
  .bd97c--float .bd97c-launcher { display: inline-flex; }
  .bd97c-backdrop { display: none !important; }
  .bd97c-panel {
    right: 22px; bottom: 94px; width: 420px; max-height: calc(100vh - 120px);
    border-radius: 14px; transform-origin: bottom right;
    animation: bd97c-pop .18s ease;
  }
}

/* ---------- Mobile ---------- */
@media (max-width: 767.98px) {
  .bd97c--bar .bd97c-bar { display: flex; }
  html.bd97c-has-bar body { padding-bottom: calc(var(--bd97c-bar-h, 62px) + env(safe-area-inset-bottom, 0px)); }
  .bd97c-panel {
    left: 0; right: 0; bottom: 0; max-height: 88vh;
    border-radius: 16px 16px 0 0;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    animation: bd97c-up .22s ease;
  }
  .bd97c-head { padding-top: 22px; position: relative; }
  .bd97c-head::before {
    content: ""; position: absolute; top: 8px; left: 50%; width: 40px; height: 4px;
    margin-left: -20px; border-radius: 4px; background: rgba(255, 255, 255, .4);
  }
  .bd97c-btn { min-height: 58px; }
  .bd97c-panel[data-mode="all"] .bd97c-actions,
  .bd97c-inline .bd97c-actions { grid-template-columns: 1fr; }
}

@keyframes bd97c-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes bd97c-pop { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes bd97c-up { from { transform: translateY(100%); } to { transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .bd97c *, .bd97c-inline * { animation: none !important; transition: none !important; }
}
@media print { .bd97c { display: none !important; } }

/* v1.0.1 : libellé WhatsApp plus long (« écrire ou appeler ») */
.bd97c-btn--wa .bd97c-btn-txt small { text-transform: none; letter-spacing: 0; font-size: 12.5px; line-height: 1.2; }
