/* Château de Bogard — assistant. Préfixe .bga- pour ne jamais toucher au thème. */
.bga-root {
  --bga-green: #2e4636;      /* charmille */
  --bga-green-hover: #3b5845;
  --bga-ink: #1d2320;
  --bga-muted: #535c56;
  --bga-paper: #ffffff;
  --bga-bot: #eef1ec;
  --bga-line: #d6dcd5;
  --bga-brass: #a07f45;      /* décor uniquement */
  --bga-focus: #1f5fbf;
  --bga-serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --bga-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  position: fixed;
  right: 16px;
  bottom: calc(16px + var(--bga-extra, 0px) + env(safe-area-inset-bottom, 0px));
  z-index: 99990;
  --bga-top: 0px;
  font-family: var(--bga-sans);
  font-size: 16px;
  line-height: 1.45;
  color: var(--bga-ink);
  -webkit-text-size-adjust: 100%;
}
.bga-root.bga-left { right: auto; left: 16px; }
/* Ouvert : le conteneur passe au-dessus de la barre d'administration WordPress (99999). */
.bga-root.bga-open { z-index: 100000; }
.bga-root *, .bga-root *::before, .bga-root *::after { box-sizing: border-box; }
.bga-root button, .bga-root input, .bga-root select, .bga-root textarea, .bga-root a {
  font-family: var(--bga-sans); letter-spacing: normal; text-transform: none; text-shadow: none;
  margin: 0; box-shadow: none; float: none; min-width: 0; max-width: none;
}

/* ---------- Bulle d'ouverture (en bas à droite) ---------- */
.bga-root .bga-launch {
  position: relative;
  display: block;
  width: 64px; height: 64px; min-height: 0; padding: 0;
  border: 3px solid #fff; border-radius: 50%;
  background: var(--bga-green);
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(29, 35, 32, .32);
  transition: transform .15s ease, box-shadow .15s ease;
  -webkit-tap-highlight-color: transparent;
}
.bga-root .bga-launch:hover { transform: scale(1.05); box-shadow: 0 8px 24px rgba(29, 35, 32, .38); }
.bga-root .bga-launch:active { transform: scale(.96); }
.bga-open .bga-launch { display: none; }
.bga-badge {
  position: absolute; left: -4px; bottom: -2px;
  display: flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--bga-green); color: #fff; border: 2px solid #fff;
}

.bga-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 100%; height: 100%;
  border-radius: 50%;
  background: #fff; color: var(--bga-green);
  font-family: var(--bga-serif); font-size: 26px; font-weight: 600; line-height: 1;
}

/* ---------- Photo de Nathalie ---------- */
.bga-root .bga-avatar {
  display: block; border-radius: 50%; object-fit: cover; background: #e4e9e5;
  max-width: none; margin: 0; padding: 0; border: 0; box-shadow: none;
}
.bga-root .bga-avatar-launch { width: 100%; height: 100%; }
.bga-root .bga-avatar-head { width: 44px; height: 44px; flex: 0 0 44px; border: 2px solid var(--bga-brass); }
.bga-root .bga-avatar-msg { width: 30px; height: 30px; flex: 0 0 30px; }
.bga-avatar-gap { display: block; width: 30px; flex: 0 0 30px; }
.bga-row { display: flex; align-items: flex-start; gap: 8px; max-width: 94%; }
.bga-row .bga-msg { max-width: none; }

/* ---------- Panneau ---------- */
.bga-panel {
  position: fixed;
  right: 16px;
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  z-index: 100000; /* au-dessus de la barre d'administration WordPress (99999) */
  width: 384px;
  max-width: calc(100vw - 32px);
  top: auto;
  height: min(640px, calc(100vh - var(--bga-top) - 32px));
  height: min(640px, calc(100dvh - var(--bga-top) - 32px));
  display: flex; flex-direction: column;
  background: var(--bga-paper);
  border: 1px solid var(--bga-line);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 18px 48px rgba(29, 35, 32, .22);
}
.bga-left .bga-panel { right: auto; left: 16px; }
.bga-panel[hidden] { display: none; }

.bga-head {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 8px 12px 14px;
  background: var(--bga-green); color: #fff;
  border-bottom: 3px solid var(--bga-brass);
}
.bga-head-text { flex: 1; min-width: 0; }
.bga-root .bga-title {
  margin: 0; padding: 0; border: 0; outline: none;
  font-family: var(--bga-serif); font-size: 20px; font-weight: 600; line-height: 1.15; color: #fff;
}
.bga-root .bga-sub { margin: 2px 0 0; padding: 0; font-size: 13px; line-height: 1.3; color: #dfe7e1; }
.bga-root .bga-close, .bga-root .bga-reset {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; flex: 0 0 44px;
  border: 0; border-radius: 10px; background: transparent; color: #fff; cursor: pointer; padding: 0;
}
.bga-root .bga-close:hover, .bga-root .bga-reset:hover { background: rgba(255, 255, 255, .14); color: #fff; }
.bga-root .bga-reset { margin-right: -6px; }

.bga-log {
  flex: 1; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  padding: 16px 14px 8px;
  display: flex; flex-direction: column; gap: 8px;
}
.bga-msg {
  max-width: 88%;
  padding: 10px 13px;
  border-radius: 14px;
  font-size: 16px; line-height: 1.45;
  word-wrap: break-word; overflow-wrap: anywhere;
}
.bga-bot { align-self: flex-start; background: var(--bga-bot); color: var(--bga-ink); border-bottom-left-radius: 4px; }
.bga-user { align-self: flex-end; background: var(--bga-green); color: #fff; border-bottom-right-radius: 4px; }

.bga-typing { display: inline-flex; gap: 5px; padding: 14px 14px; margin-left: 38px; }
.bga-typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--bga-muted); opacity: .4; animation: bga-dot 1s infinite; }
.bga-typing span:nth-child(2) { animation-delay: .15s; }
.bga-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes bga-dot { 0%, 80%, 100% { opacity: .3; } 40% { opacity: 1; } }

.bga-chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 2px 0 6px 38px; }
.bga-form { margin-left: 38px !important; }
.bga-root .bga-chip {
  display: inline-flex; align-items: center;
  min-height: 44px; padding: 8px 14px;
  border: 1.5px solid var(--bga-green); border-radius: 22px;
  background: #fff; color: var(--bga-green);
  font-size: 15px; font-weight: 600; line-height: 1.2; text-align: left; text-decoration: none;
  cursor: pointer;
}
.bga-root .bga-chip:hover { background: #f1f5f2; }
.bga-root .bga-chip-strong { background: var(--bga-green); color: #fff; }
.bga-root .bga-chip-strong:hover { background: var(--bga-green-hover); }

/* ---------- Saisie ---------- */
.bga-foot {
  display: flex; gap: 8px; align-items: center;
  padding: 10px 12px; margin: 0;
  border-top: 1px solid var(--bga-line); background: #fff;
}
.bga-root .bga-input {
  flex: 1; min-height: 48px; padding: 10px 14px;
  border: 1.5px solid var(--bga-line); border-radius: 24px;
  background: #fff; color: var(--bga-ink);
  font-size: 16px; /* 16 px : évite le zoom automatique d'iPhone */
}
.bga-root .bga-input::placeholder { color: #6b746e; opacity: 1; }
.bga-root .bga-send {
  display: inline-flex; align-items: center; justify-content: center;
  width: 48px; height: 48px; flex: 0 0 48px; padding: 0;
  border: 0; border-radius: 50%; background: var(--bga-green); color: #fff; cursor: pointer;
}
.bga-root .bga-send:hover { background: var(--bga-green-hover); color: #fff; }
.bga-root .bga-legal { margin: 0; padding: 0 14px 10px; font-size: 12px; line-height: 1.35; color: var(--bga-muted); background: #fff; }
.bga-root .bga-legal a { color: var(--bga-muted); text-decoration: underline; font-size: 12px; }

/* ---------- Formulaire de demande ---------- */
.bga-form {
  display: flex; flex-direction: column; gap: 10px;
  padding: 14px; margin: 2px 0 8px;
  border: 1px solid var(--bga-line); border-radius: 12px; background: #fafbf9;
}
.bga-field { display: flex; flex-direction: column; gap: 4px; margin: 0; }
.bga-field-label { font-size: 14px; font-weight: 600; color: var(--bga-ink); }
.bga-root .bga-in {
  width: 100%; min-height: 46px; padding: 10px 12px;
  border: 1.5px solid var(--bga-line); border-radius: 10px;
  background: #fff; color: var(--bga-ink); font-size: 16px; line-height: 1.3;
}
.bga-root textarea.bga-in { min-height: 84px; resize: vertical; }
.bga-hp { position: absolute !important; left: -9999px !important; width: 1px !important; height: 1px !important; opacity: 0 !important; }
.bga-root .bga-err { margin: 0; min-height: 0; font-size: 14px; color: #a1261b; }
.bga-root .bga-err:empty { display: none; }
.bga-submit {
  min-height: 50px; padding: 12px 16px;
  border: 0; border-radius: 12px; background: var(--bga-green); color: #fff;
  font-size: 16px; font-weight: 700; cursor: pointer;
}
.bga-submit:disabled { opacity: .6; cursor: wait; }

/* ---------- Focus clavier visible ---------- */
.bga-root button:focus-visible, .bga-root a:focus-visible, .bga-root input:focus-visible,
.bga-root select:focus-visible, .bga-root textarea:focus-visible {
  outline: 2px solid var(--bga-focus); outline-offset: 2px;
}
.bga-root .bga-in:focus, .bga-root .bga-input:focus { border-color: var(--bga-green); }
.bga-head button:focus-visible { outline-color: #fff; }

/* ---------- Téléphone : plein écran ---------- */
@media (max-width: 600px) {
  .bga-root { right: 14px; bottom: calc(14px + var(--bga-extra, 0px) + env(safe-area-inset-bottom, 0px)); }
  .bga-root .bga-launch { width: 60px; height: 60px; }
  .bga-root.bga-left { left: 12px; }
  .bga-panel, .bga-left .bga-panel {
    left: 0; right: 0; top: 0; bottom: auto;
    width: 100%; max-width: none;
    height: 100vh; height: 100dvh;
    border: 0; border-radius: 0;
    z-index: auto;
  }
  .bga-root.bga-open { z-index: 2147483000; }
  .bga-head { padding-top: calc(10px + env(safe-area-inset-top, 0px)); }
  .bga-legal { padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px)); }
  .bga-msg { max-width: 92%; }
  .bga-row { max-width: 100%; }
  .bga-form { margin-left: 0 !important; }
}
/* Clavier ouvert / écran très bas : on libère de la place pour la conversation. */
@media (max-height: 520px) {
  .bga-head { padding-top: calc(6px + env(safe-area-inset-top, 0px)); padding-bottom: 6px; }
  .bga-root .bga-avatar-head { width: 34px; height: 34px; flex-basis: 34px; }
  .bga-root .bga-title { font-size: 17px; }
  .bga-root .bga-sub { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .bga-root .bga-legal { display: none; }
  .bga-log { padding-top: 10px; }
}
html.bga-lock, html.bga-lock body { overflow: hidden !important; }

@media (prefers-reduced-motion: reduce) {
  .bga-launch, .bga-typing span { transition: none; animation: none; }
}
@media print { .bga-root { display: none !important; } }
