/* ============================================================
   Chatbot / assistant IA — bulle flottante en bas à droite.
   Feuille partagée : site public ET backoffice (assistant admin).
   ============================================================ */
.chatbot { position: fixed; right: 1.1rem; bottom: 1.1rem; z-index: 80; font-size: 0.92rem; }
.chatbot__launcher {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: 0;
  cursor: pointer;
  background: var(--chatbot-color, #12a6a3);
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.28);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  overflow: hidden;
  transition: transform 0.15s ease;
  margin-left: auto;
}
.chatbot__launcher:hover { transform: scale(1.06); }
.chatbot__launcher-avatar { width: 100%; height: 100%; object-fit: cover; display: block; }
.chatbot__avatar--fallback { display: inline-flex; align-items: center; justify-content: center; font-size: 1.5rem; width: 100%; height: 100%; color: #fff; }
.chatbot__panel {
  width: min(360px, calc(100vw - 2.2rem));
  height: min(540px, calc(100vh - 7rem));
  background: #fff;
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: 16px;
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.24);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  margin-bottom: 0.8rem;
}
.chatbot__head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.7rem 0.85rem;
  background: var(--chatbot-color, #12a6a3);
  color: #fff;
}
.chatbot__head-avatar { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; background: rgba(255,255,255,0.25); flex: none; }
.chatbot__head .chatbot__avatar--fallback { width: 34px; height: 34px; border-radius: 50%; background: rgba(255,255,255,0.22); font-size: 1.1rem; flex: none; }
.chatbot__head-title { font-weight: 700; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chatbot__close { border: 0; background: none; color: #fff; font-size: 1rem; cursor: pointer; opacity: 0.85; padding: 0.2rem 0.35rem; }
.chatbot__close:hover { opacity: 1; }
.chatbot__body { flex: 1; overflow-y: auto; padding: 0.85rem 0.8rem 0.4rem; background: #f6f7f9; }
.chatbot__row { display: flex; align-items: flex-end; gap: 0.45rem; margin-bottom: 0.55rem; }
.chatbot__row--user { justify-content: flex-end; }
.chatbot__msg-avatar { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; flex: none; background: #e4e7ec; }
.chatbot__row .chatbot__avatar--fallback { width: 24px; height: 24px; border-radius: 50%; background: var(--chatbot-color, #12a6a3); font-size: 0.8rem; flex: none; }
.chatbot__msg {
  max-width: 82%;
  padding: 0.5rem 0.7rem;
  border-radius: 12px;
  line-height: 1.4;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.chatbot__msg--assistant { background: #fff; border: 1px solid rgba(15, 23, 42, 0.08); color: #1c2431; border-bottom-left-radius: 4px; }
.chatbot__msg--user { background: var(--chatbot-color, #12a6a3); color: #fff; border-bottom-right-radius: 4px; }
.chatbot__typing span {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin: 0 2px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.4);
  animation: chatbot-blink 1.2s infinite;
}
.chatbot__typing span:nth-child(2) { animation-delay: 0.2s; }
.chatbot__typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes chatbot-blink { 0%, 80%, 100% { opacity: 0.25; } 40% { opacity: 1; } }
.chatbot__chips { display: flex; flex-wrap: wrap; gap: 0.4rem; padding: 0.3rem 0.8rem 0.5rem; background: #f6f7f9; }
.chatbot__chips[hidden] { display: none; }
.chatbot__chip {
  border: 1px solid var(--chatbot-color, #12a6a3);
  color: var(--chatbot-color, #12a6a3);
  background: #fff;
  border-radius: 999px;
  padding: 0.3rem 0.7rem;
  font-size: 0.82rem;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.chatbot__chip:hover { background: var(--chatbot-color, #12a6a3); color: #fff; }
.chatbot__form { display: flex; gap: 0.45rem; padding: 0.6rem 0.7rem; border-top: 1px solid rgba(15, 23, 42, 0.08); background: #fff; }
.chatbot__input {
  flex: 1;
  border: 1px solid rgba(15, 23, 42, 0.16);
  border-radius: 999px;
  padding: 0.5rem 0.9rem;
  font: inherit;
  outline: none;
}
.chatbot__input:focus { border-color: var(--chatbot-color, #12a6a3); }
.chatbot__send {
  border: 0;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  background: var(--chatbot-color, #12a6a3);
  color: #fff;
  font-size: 1rem;
  cursor: pointer;
  flex: none;
}
.chatbot:not(.is-open) .chatbot__panel { display: none; }
@media (max-width: 640px) {
  .chatbot { right: 0.7rem; bottom: 0.7rem; }
  .chatbot__panel { height: min(480px, calc(100vh - 6rem)); }
}
@media print { .chatbot { display: none; } }

/* Backoffice : la bulle doit passer au-dessus de l'éditeur plein écran (z-index 200). */
body.admin .chatbot { z-index: 300; }
body.admin .chatbot__panel { color: #1c2431; }
