/* ===== Chatbot avant-vente (builder) — widget flottant ===== */
:root { --sc-coral: #e71a65; }

#sc-root { position: fixed; left: 18px; bottom: 18px; z-index: 9000; font-family: 'Open Sans', system-ui, sans-serif; }

/* Bouton flottant */
#sc-fab {
  width: 60px; height: 60px; border-radius: 50%; border: none; cursor: pointer;
  background: linear-gradient(135deg, #e71a65 0%, #f04080 100%); color: #fff;
  box-shadow: 0 6px 20px rgba(231,26,101,.4); display: flex; align-items: center; justify-content: center;
  transition: transform .15s; position: relative;
}
#sc-fab:active { transform: scale(.92); }
#sc-fab svg { width: 28px; height: 28px; }
#sc-fab .sc-dot { position: absolute; top: 2px; right: 2px; width: 14px; height: 14px; border-radius: 50%; background: #34c759; border: 2px solid #fff; }

/* Bulle d'accroche proactive */
#sc-nudge {
  position: absolute; left: 0; bottom: 72px; width: 220px;
  background: #fff; color: #3d3d3d; border-radius: 16px 16px 16px 4px;
  padding: 12px 14px; font-size: .9rem; line-height: 1.35;
  box-shadow: 0 8px 26px rgba(180,120,110,.28); cursor: pointer;
  animation: sc-pop .25s ease;
}
#sc-nudge .sc-nudge-close { position: absolute; top: 4px; right: 8px; color: #bbb; font-size: 1rem; line-height: 1; }
@keyframes sc-pop { from { opacity: 0; transform: translateY(8px) scale(.96); } to { opacity: 1; transform: none; } }

/* Panneau de chat */
#sc-panel {
  position: absolute; left: 0; bottom: 0; width: 360px; max-width: calc(100vw - 24px);
  height: 540px; max-height: calc(100dvh - 36px);
  background: linear-gradient(180deg, #fff6f2 0%, #ffe9e3 100%);
  border-radius: 18px; box-shadow: 0 16px 48px rgba(60,40,40,.32);
  display: flex; flex-direction: column; overflow: hidden;
  animation: sc-pop .2s ease;
}
#sc-panel[hidden] { display: none; }

.sc-head { flex: 0 0 auto; display: flex; align-items: center; gap: 10px; padding: 14px 16px;
  background: rgba(255,255,255,.8); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); border-bottom: 1px solid #ffd9cf; }
.sc-head__avatar { width: 38px; height: 38px; border-radius: 50%; background: #fff; box-shadow: 0 2px 8px rgba(231,26,101,.18); display: flex; align-items: center; justify-content: center; }
.sc-head__avatar img { width: 24px; height: 24px; object-fit: contain; }
.sc-head__id { display: flex; flex-direction: column; line-height: 1.25; flex: 1 1 auto; }
.sc-head__id strong { font-family: 'Nunito', sans-serif; color: #3d3d3d; font-size: .98rem; }
.sc-head__id span { font-size: .75rem; color: #8a8a8a; display: flex; align-items: center; gap: 5px; }
.sc-head__id span i { width: 7px; height: 7px; border-radius: 50%; background: #34c759; box-shadow: 0 0 0 3px rgba(52,199,89,.18); }
.sc-head__close { background: none; border: none; color: #999; font-size: 1.5rem; line-height: 1; cursor: pointer; padding: 0 4px; }

.sc-chat { flex: 1 1 auto; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; display: flex; flex-direction: column; gap: 9px; padding: 16px 12px; }

.sc-row { display: flex; align-items: flex-end; gap: 7px; max-width: 100%; }
.sc-row--bot { justify-content: flex-start; }
.sc-row--user { justify-content: flex-end; }
.sc-row__avatar { width: 26px; height: 26px; border-radius: 50%; background: #fff; flex: 0 0 auto; display: flex; align-items: center; justify-content: center; box-shadow: 0 1px 4px rgba(231,26,101,.15); }
.sc-row__avatar img { width: 16px; height: 16px; object-fit: contain; }

.sc-bubble { max-width: 80%; padding: 10px 14px; font-size: .94rem; line-height: 1.45; white-space: pre-wrap; word-wrap: break-word; overflow-wrap: anywhere; }
.sc-bubble--bot { background: #fff; color: #3d3d3d; border-radius: 16px 16px 16px 4px; box-shadow: 0 2px 10px rgba(180,120,110,.14); }
.sc-bubble--user { background: linear-gradient(135deg, #e71a65 0%, #f04080 100%); color: #fff; border-radius: 16px 16px 4px 16px; box-shadow: 0 3px 12px rgba(231,26,101,.28); }
.sc-bubble--bot a { color: var(--sc-coral); font-weight: 700; }
.sc-bubble--user a { color: #fff; text-decoration: underline; }
.sc-bubble strong { font-weight: 800; }

.sc-typing { display: flex; gap: 4px; padding: 12px 14px; }
.sc-typing span { width: 7px; height: 7px; border-radius: 50%; background: #e7a8b6; animation: sc-bounce 1.2s infinite ease-in-out; }
.sc-typing span:nth-child(2) { animation-delay: .15s; }
.sc-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes sc-bounce { 0%, 80%, 100% { transform: translateY(0); opacity: .5; } 40% { transform: translateY(-5px); opacity: 1; } }

.sc-form { flex: 0 0 auto; display: flex; gap: 7px; align-items: flex-end; padding: 10px 12px;
  background: rgba(255,255,255,.9); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); border-top: 1px solid #ffd9cf; }
.sc-form textarea { flex: 1 1 auto; padding: 10px 14px; border: 1.5px solid #ffd0c4; border-radius: 20px;
  font-size: 16px; resize: none; max-height: 100px; font-family: inherit; background: #fff; }
.sc-form textarea:focus { outline: none; border-color: var(--sc-coral); box-shadow: 0 0 0 3px rgba(231,26,101,.12); }
.sc-form button { flex: 0 0 42px; height: 42px; border: none; border-radius: 50%;
  background: linear-gradient(135deg, #e71a65 0%, #f04080 100%); color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center; box-shadow: 0 3px 10px rgba(231,26,101,.3); transition: transform .12s; }
.sc-form button:active { transform: scale(.92); }
.sc-form button:disabled { opacity: .5; }

/* Mobile : panneau en « bottom sheet » FIXÉE AU VIEWPORT (et non au bouton, qui est
   remonté de 96px au-dessus de la barre Réserver — sinon le haut du panneau sort de
   l'écran et coupe les premiers messages). Hauteur limitée à ~72 % pour laisser le
   configurateur visible derrière. */
@media (max-width: 480px) {
  #sc-panel {
    position: fixed; left: 10px; right: 10px; bottom: 10px; top: auto;
    width: auto; max-width: none;
    height: min(72dvh, 560px); max-height: calc(100dvh - 20px);
    border-radius: 20px;
  }
  /* Zone tactile confortable pour fermer (44px) */
  .sc-head__close { font-size: 1.8rem; padding: 8px 14px; margin: -8px -6px -8px 0; }
}

/* Mobile : la bulle ne doit pas chevaucher la barre « Réserver » (07/07) */
@media (max-width: 768px) {
  #sc-root { bottom: 96px; left: 12px; }
  #sc-fab { width: 48px; height: 48px; }
  #sc-fab svg { width: 22px; height: 22px; }
  /* Le panneau ancré au bouton part 96px plus haut : on retranche ce décalage
     pour que le haut ne sorte jamais de l'écran (paysage, petites hauteurs). */
  #sc-panel { max-height: calc(100dvh - 120px); }
}

/* Images inline dans les bulles (07/07) */
.sc-img { max-width: 100%; border-radius: 12px; display: block; margin: 6px 0; }
