/* ==========================================================================
   IBS-Mali — Chatbot d'assistance (styles)
   Toutes les classes sont préfixées "ibscb-" pour ne jamais entrer en
   conflit avec le thème WordPress / Elementor existant.
   ========================================================================== */

#ibscb-root {
  all: initial; /* isole le widget des styles du thème */
}

#ibscb-root, #ibscb-root * {
  box-sizing: border-box;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

.ibscb-widget {
  position: fixed;
  right: clamp(1rem, 3vw, 1.75rem);
  bottom: clamp(1rem, 3vw, 1.75rem);
  z-index: 999999; /* au-dessus des popups Elementor courants */
}

/* --- Lanceur ------------------------------------------------------------- */
.ibscb-launch {
  display: grid;
  place-content: center;
  width: 60px;
  height: 60px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  background: linear-gradient(135deg, #FFA824 0%, #FEB638 100%);
  color: #100739;
  box-shadow: 0 10px 28px rgba(255, 168, 36, 0.35);
  transition: transform 0.2s ease;
}
.ibscb-launch:hover { transform: translateY(-2px) scale(1.03); }
.ibscb-launch svg { width: 26px; height: 26px; }
.ibscb-launch .ibscb-ic-close { display: none; }
.ibscb-widget.is-open .ibscb-ic-open { display: none; }
.ibscb-widget.is-open .ibscb-ic-close { display: block; }

/* --- Panneau ------------------------------------------------------------- */
.ibscb-panel {
  position: absolute;
  right: 0;
  bottom: 72px;
  width: min(370px, calc(100vw - 32px));
  height: min(500px, calc(100vh - 120px));
  display: flex;
  flex-direction: column;
  background: #ffffff;
  border-radius: 20px;
  box-shadow: 0 20px 48px rgba(16, 7, 57, 0.18);
  overflow: hidden;
  animation: ibscb-in 0.22s ease-out;
}
.ibscb-panel[hidden] { display: none; }
@keyframes ibscb-in {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

.ibscb-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  background: linear-gradient(120deg, #100739 0%, #1B1152 100%);
  color: #fff;
}
.ibscb-head-id { display: flex; align-items: center; gap: 10px; }
.ibscb-avatar {
  display: grid;
  place-content: center;
  width: 38px;
  height: 38px;
  border-radius: 999px;
  background: linear-gradient(135deg, #FFA824 0%, #FEB638 100%);
  color: #100739;
  flex-shrink: 0;
}
.ibscb-avatar svg { width: 20px; height: 20px; }
.ibscb-name { font-weight: 700; font-size: 14px; margin: 0; color: #fff; }
.ibscb-status { font-size: 11px; margin: 2px 0 0; color: #b7b0e0; }
.ibscb-close {
  background: none;
  border: none;
  cursor: pointer;
  color: #fff;
  opacity: 0.85;
  padding: 4px;
  border-radius: 6px;
  display: grid;
  place-content: center;
}
.ibscb-close:hover { opacity: 1; }
.ibscb-close svg { width: 20px; height: 20px; }

.ibscb-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #FBFBFB;
}

.ibscb-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 13.5px;
  line-height: 1.5;
  animation: ibscb-in 0.2s ease-out;
}
.ibscb-msg-bot {
  background: #fff;
  border: 1px solid #E7E9F1;
  color: #3D3D4A;
  border-bottom-left-radius: 6px;
  align-self: flex-start;
}
.ibscb-msg-user {
  background: #100739;
  color: #fff;
  border-bottom-right-radius: 6px;
  align-self: flex-end;
}
.ibscb-msg a { color: #D97D00; font-weight: 600; text-decoration: underline; }
.ibscb-msg-user a { color: #fff; }

.ibscb-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-self: flex-start;
  max-width: 100%;
}
.ibscb-chip {
  font-weight: 600;
  font-size: 12px;
  padding: 7px 13px;
  border-radius: 999px;
  border: 1px solid #FFA824;
  color: #D97D00;
  background: #fff;
  cursor: pointer;
  transition: all 0.2s ease;
}
.ibscb-chip:hover {
  background: linear-gradient(135deg, #FFA824 0%, #FEB638 100%);
  color: #100739;
  border-color: transparent;
}

.ibscb-form {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid #E7E9F1;
  background: #fff;
}
.ibscb-input {
  flex: 1;
  border: 1px solid #D6DAE6;
  border-radius: 999px;
  padding: 10px 16px;
  font-size: 13.5px;
  color: #100739;
  background: #fff;
  outline: none;
}
.ibscb-input:focus {
  border-color: #FFA824;
  box-shadow: 0 0 0 3px rgba(255, 168, 36, 0.2);
}
.ibscb-send {
  display: grid;
  place-content: center;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  background: linear-gradient(135deg, #FFA824 0%, #FEB638 100%);
  color: #100739;
  flex-shrink: 0;
}
.ibscb-send svg { width: 18px; height: 18px; }

@media (prefers-reduced-motion: reduce) {
  .ibscb-panel, .ibscb-msg { animation: none; }
}
