/* =========================================================
   RZ ENERGY — Widget de chat
   Reprend la palette et les fontes du site (Inter / Manrope,
   bleu #134b9e, vert #4b972a) pour se fondre dans l'existant.
   Tout est prefixe .rzc- pour ne rien casser sur la page.
   ========================================================= */

.rzc,
.rzc * { box-sizing: border-box; }

.rzc {
  --rzc-blue: #134b9e;
  --rzc-blue-700: #0e3f86;
  --rzc-green: #4b972a;
  --rzc-ink: #1b2634;
  --rzc-slate: #57647a;
  --rzc-line: #e5eaf1;
  --rzc-paper: #f6f9fc;
  --rzc-radius: 16px;
  --rzc-shadow: 0 18px 50px rgba(19, 75, 158, .22);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

/* Le site a déjà un bouton WhatsApp flottant (.wa-float) en bas à droite.
   On le remonte pour qu'il se place AU-DESSUS de notre bulle de chat,
   au lieu de se superposer. On ne touche pas au fichier CSS du site. */
.wa-float {
  bottom: clamp(5.5rem, 3vw + 4.2rem, 6rem) !important;
  z-index: 9997 !important;
}

/* ---------- bouton flottant du chat ---------- */
.rzc-launcher {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 9998;
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  padding: .9rem 1.25rem .9rem 1.1rem;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(150deg, var(--rzc-blue), var(--rzc-blue-700));
  color: #fff;
  font: 700 .96rem/1 "Inter", sans-serif;
  cursor: pointer;
  box-shadow: var(--rzc-shadow);
  transition: transform .18s ease, box-shadow .18s ease;
}
.rzc-launcher:hover { transform: translateY(-2px); }
.rzc-launcher svg { width: 24px; height: 24px; flex: none; }
.rzc-launcher .rzc-launcher-close { display: none; font-size: 1.15rem; line-height: 1; }
.rzc.rzc-open .rzc-launcher .rzc-launcher-open { display: none; }
.rzc.rzc-open .rzc-launcher .rzc-launcher-close { display: inline; }

/* petit point d'attention vert */
.rzc-dot {
  position: absolute;
  top: 3px; right: 5px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--rzc-green);
  border: 2px solid #fff;
  animation: rzc-pulse 2s ease-in-out infinite;
}
.rzc.rzc-open .rzc-dot { display: none; }
@keyframes rzc-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(75,151,42,.5); }
  50% { box-shadow: 0 0 0 6px rgba(75,151,42,0); }
}

/* ---------- panneau ---------- */
.rzc-panel {
  position: fixed;
  right: 22px;
  bottom: 88px;
  z-index: 9999;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 580px;
  max-height: calc(100vh - 120px);
  background: #fff;
  border: 1px solid var(--rzc-line);
  border-radius: var(--rzc-radius);
  box-shadow: var(--rzc-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(12px) scale(.98);
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
}
.rzc.rzc-open .rzc-panel {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

/* ---------- en-tete ---------- */
.rzc-head {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .9rem 1rem;
  background: linear-gradient(150deg, var(--rzc-blue), var(--rzc-blue-700));
  color: #fff;
}
.rzc-head img { width: 38px; height: 38px; border-radius: 9px; background: #fff; padding: 3px; flex: none; object-fit: contain; }
.rzc-head-txt { line-height: 1.25; }
.rzc-head-txt strong { font-size: .98rem; font-weight: 700; display: block; }
.rzc-head-txt span { font-size: .78rem; opacity: .85; display: inline-flex; align-items: center; gap: .35rem; }
.rzc-head-txt span::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%;
  background: #7be07b; display: inline-block;
}
.rzc-head-x {
  margin-left: auto; background: rgba(255,255,255,.15); border: 0; color: #fff;
  width: 30px; height: 30px; border-radius: 8px; cursor: pointer; font-size: 1.1rem;
  display: grid; place-items: center;
}
.rzc-head-x:hover { background: rgba(255,255,255,.28); }

/* ---------- fil de messages ---------- */
.rzc-log {
  flex: 1;
  overflow-y: auto;
  padding: 1rem .9rem;
  background: var(--rzc-paper);
  display: flex;
  flex-direction: column;
  gap: .6rem;
  scroll-behavior: smooth;
}
.rzc-msg {
  max-width: 84%;
  padding: .62rem .8rem;
  border-radius: 13px;
  font-size: .92rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.rzc-msg.bot {
  background: #fff;
  border: 1px solid var(--rzc-line);
  color: var(--rzc-ink);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}
.rzc-msg.me {
  background: var(--rzc-blue);
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

/* indicateur de saisie */
.rzc-typing { display: inline-flex; gap: 4px; padding: .2rem 0; }
.rzc-typing i {
  width: 7px; height: 7px; border-radius: 50%; background: var(--rzc-slate);
  opacity: .5; animation: rzc-bounce 1.2s infinite;
}
.rzc-typing i:nth-child(2) { animation-delay: .18s; }
.rzc-typing i:nth-child(3) { animation-delay: .36s; }
@keyframes rzc-bounce { 0%,60%,100% { transform: translateY(0); opacity: .4; } 30% { transform: translateY(-5px); opacity: .9; } }

/* ---------- boutons d'action (les 3 portes) ---------- */
.rzc-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
  padding: 0 .9rem;
  margin-bottom: .3rem;
}
.rzc-chip {
  border: 1px solid var(--rzc-blue);
  background: #fff;
  color: var(--rzc-blue);
  border-radius: 999px;
  padding: .5rem .85rem;
  font: 600 .86rem "Inter", sans-serif;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  transition: background .15s ease, color .15s ease;
}
.rzc-chip:hover { background: var(--rzc-blue); color: #fff; }
.rzc-chip svg { width: 16px; height: 16px; }
.rzc-chip.green { border-color: var(--rzc-green); color: var(--rzc-green); }
.rzc-chip.green:hover { background: var(--rzc-green); color: #fff; }

/* ---------- zone de saisie ---------- */
.rzc-input {
  border-top: 1px solid var(--rzc-line);
  padding: .6rem .6rem .7rem;
  background: #fff;
}
.rzc-input-row { display: flex; gap: .5rem; align-items: flex-end; }
.rzc-input textarea {
  flex: 1;
  border: 1px solid var(--rzc-line);
  border-radius: 12px;
  padding: .6rem .7rem;
  font: 400 .92rem/1.4 "Inter", sans-serif;
  color: var(--rzc-ink);
  resize: none;
  max-height: 96px;
  outline: none;
}
.rzc-input textarea:focus { border-color: var(--rzc-blue); }
.rzc-input.rzc-locked textarea {
  background: #f2f5f9;
  color: var(--rzc-slate);
  cursor: not-allowed;
}
.rzc-input.rzc-locked textarea::placeholder { color: var(--rzc-blue); font-weight: 600; }
.rzc-send {
  flex: none;
  width: 42px; height: 42px;
  border: 0; border-radius: 12px;
  background: var(--rzc-blue);
  color: #fff; cursor: pointer;
  display: grid; place-items: center;
  transition: background .15s ease;
}
.rzc-send:hover { background: var(--rzc-blue-700); }
.rzc-send:disabled { opacity: .5; cursor: default; }
.rzc-send svg { width: 20px; height: 20px; }
.rzc-legal { margin: .45rem .2rem 0; font-size: .72rem; color: var(--rzc-slate); text-align: center; }
.rzc-legal a { color: var(--rzc-blue); }

/* ---------- mini-formulaire (rappel / rdv) ---------- */
.rzc-form {
  background: #fff;
  border: 1px solid var(--rzc-line);
  border-radius: 13px;
  padding: .85rem;
  margin: 0 .9rem .3rem;
  align-self: stretch;
}
.rzc-form h4 { margin: 0 0 .6rem; font: 700 .95rem "Manrope", "Inter", sans-serif; color: var(--rzc-ink); }
.rzc-form label { display: block; font-size: .8rem; color: var(--rzc-slate); margin: .5rem 0 .2rem; }
.rzc-form input {
  width: 100%; border: 1px solid var(--rzc-line); border-radius: 9px;
  padding: .5rem .6rem; font: 400 .9rem "Inter", sans-serif; outline: none;
}
.rzc-form input:focus { border-color: var(--rzc-blue); }
.rzc-form .rzc-consent { display: flex; gap: .5rem; align-items: flex-start; margin-top: .6rem; font-size: .78rem; color: var(--rzc-slate); }
.rzc-form .rzc-consent input { width: auto; margin-top: .15rem; }
.rzc-form .rzc-hp { position: absolute; left: -9999px; }
.rzc-form-btn {
  width: 100%; margin-top: .7rem; border: 0; border-radius: 10px;
  background: var(--rzc-green); color: #fff; padding: .65rem;
  font: 700 .92rem "Inter", sans-serif; cursor: pointer;
}
.rzc-form-btn:hover { filter: brightness(.95); }
.rzc-form-cancel {
  width: 100%; margin-top: .4rem; border: 0; background: none;
  color: var(--rzc-slate); font: 500 .84rem "Inter", sans-serif;
  cursor: pointer; padding: .3rem;
}
.rzc-form-cancel:hover { color: var(--rzc-ink); text-decoration: underline; }
.rzc-form-err { color: #c0392b; font-size: .78rem; margin-top: .4rem; min-height: 1em; }

.rzc-note { text-align: center; font-size: .82rem; color: var(--rzc-slate); padding: .3rem .9rem; }

@media (max-width: 480px) {
  .rzc-panel {
    right: 8px; left: 8px; bottom: 84px;
    width: auto; height: calc(100dvh - 104px);
  }
  /* on masque le libellé texte mais on garde une pastille ronde nette
     avec l'icône de chat bien visible — plus jamais un simple point */
  .rzc-launcher-label { display: none; }
  .rzc-launcher {
    padding: 0;
    width: 60px; height: 60px;
    justify-content: center;
    gap: 0;
  }
  .rzc-launcher svg { width: 28px; height: 28px; }
  .rzc-dot { top: 6px; right: 6px; }
  /* le bouton WhatsApp du site remonte au-dessus de la pastille ronde */
  .wa-float { bottom: 92px !important; }
}
@media (prefers-reduced-motion: reduce) {
  .rzc-launcher, .rzc-panel, .rzc-typing i { transition: none; animation: none; }
}
