/* chatbot/bibi.css
   Styles du widget Bibi — couleurs alignées sur joinsmartwork.com
   Bleu #0a48c8 · Nuit #041c52 · Orange #ff6a00 · Gris #f2f6fd · Bordure #e3eaf7 */

/* ============ Bouton flottant (orange) ============ */
#bibi-launcher {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: #ff6a00;
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 26px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 18px rgba(255, 106, 0, .35);
  z-index: 9998;
  transition: transform .18s ease, background .18s ease;
}
#bibi-launcher:hover { background: #e55f00; transform: scale(1.05); }
#bibi-launcher:focus-visible { outline: 3px solid #0a48c8; outline-offset: 2px; }
#bibi-launcher.bibi-hidden { display: none; }

/* ============ Bulle "Demande à Bibi" ============ */
#bibi-bubble {
  position: fixed;
  bottom: 34px;
  right: 92px;
  background: #fff;
  color: #041c52;
  border: 1px solid #e3eaf7;
  padding: 10px 14px;
  border-radius: 14px;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 6px 20px rgba(4, 28, 82, .12);
  z-index: 9998;
  cursor: pointer;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity .3s ease, transform .3s ease;
  pointer-events: none;
}
#bibi-bubble.bibi-visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
#bibi-bubble::after {
  content: "";
  position: absolute;
  right: -6px;
  bottom: 14px;
  width: 12px;
  height: 12px;
  background: #fff;
  border-right: 1px solid #e3eaf7;
  border-bottom: 1px solid #e3eaf7;
  transform: rotate(-45deg);
}
#bibi-bubble.bibi-hidden { display: none; }

/* ============ Fenêtre de chat ============ */
#bibi-window {
  position: fixed;
  bottom: 92px;
  right: 20px;
  width: 360px;
  height: 520px;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 12px 34px rgba(4, 28, 82, .18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 14px;
  color: #041c52;
  z-index: 9999;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
}
#bibi-window.bibi-open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* ============ Entête ============ */
#bibi-header {
  background: #0a48c8;
  color: #fff;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
#bibi-header .bibi-head-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
#bibi-header .bibi-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #fff;
  flex-shrink: 0;
  object-fit: contain;
  padding: 3px;
  box-sizing: border-box;
}
#bibi-header .bibi-title { font-weight: bold; font-size: 15px; }
#bibi-header .bibi-sub   { font-size: 12px; opacity: .85; margin-top: 2px; }
#bibi-close {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}
#bibi-close:hover { opacity: .8; }

/* ============ Zone des messages ============ */
#bibi-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  background: #f2f6fd;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.bibi-msg {
  max-width: 82%;
  padding: 9px 12px;
  border-radius: 12px;
  line-height: 1.4;
  font-size: 14px;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.bibi-msg.bibi-bot {
  background: #fff;
  border: 1px solid #e3eaf7;
  color: #041c52;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}
.bibi-msg.bibi-user {
  background: #0a48c8;
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}
.bibi-msg.bibi-error {
  background: #ffe0e0;
  color: #b00020;
  border: 1px solid #f3c2c2;
  align-self: flex-start;
}

/* Indicateur "Bibi écrit…" */
.bibi-typing {
  align-self: flex-start;
  background: #fff;
  border: 1px solid #e3eaf7;
  border-radius: 12px;
  padding: 10px 14px;
  display: inline-flex;
  gap: 4px;
}
.bibi-typing span {
  width: 6px; height: 6px; border-radius: 50%;
  background: #4a5a7c;
  animation: bibi-bounce 1.2s infinite;
}
.bibi-typing span:nth-child(2) { animation-delay: .15s; }
.bibi-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes bibi-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: .5; }
  30%           { transform: translateY(-4px); opacity: 1; }
}

/* ============ Zone de saisie ============ */
#bibi-form {
  display: flex;
  align-items: center;
  border-top: 1px solid #e3eaf7;
  background: #fff;
}
#bibi-input {
  flex: 1;
  border: none;
  padding: 12px 14px;
  font-size: 14px;
  font-family: inherit;
  color: #041c52;
  outline: none;
  background: transparent;
}
#bibi-input::placeholder { color: #4a5a7c; }
#bibi-send {
  background: #ff6a00;
  color: #fff;
  border: none;
  padding: 0 14px;
  height: 100%;
  min-height: 44px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s ease;
}
#bibi-send:hover { background: #e55f00; }
#bibi-send:disabled { opacity: .55; cursor: default; }
#bibi-send svg { display: block; }

/* Compteur de caractères */
#bibi-counter {
  font-size: 11px;
  color: #4a5a7c;
  padding: 0 14px 6px;
  text-align: right;
  background: #fff;
}
#bibi-counter.bibi-over { color: #b00020; font-weight: bold; }

/* ============ Pied de fenêtre ============ */
#bibi-footer {
  font-size: 11px;
  color: #4a5a7c;
  background: #fff;
  text-align: center;
  padding: 6px 10px 10px;
  border-top: 1px solid #e3eaf7;
}
#bibi-footer a { color: #0a48c8; text-decoration: none; }
#bibi-footer a:hover { text-decoration: underline; }

/* ============ Mobile ============ */
@media (max-width: 560px) {
  #bibi-window {
    width: 100%;
    height: 100%;
    bottom: 0;
    right: 0;
    border-radius: 0;
  }
  #bibi-launcher { bottom: 16px; right: 16px; }
  #bibi-bubble { right: 84px; bottom: 30px; font-size: 13px; }
}

/* ============ Accessibilité ============ */
@media (prefers-reduced-motion: reduce) {
  #bibi-window, #bibi-launcher, #bibi-bubble, .bibi-typing span {
    transition: none; animation: none;
  }
}