/* ═══════════════════════════════════════════════════════
   Généabot — Widget CSS
   Couleur principale : --gbot-c (indigo #4F46E5 par défaut)
═══════════════════════════════════════════════════════ */

:root {
  --gbot-radius: 14px;
  --gbot-shadow: 0 8px 32px rgba(0,0,0,.14), 0 2px 8px rgba(0,0,0,.08);
  --gbot-z: 99999;
}

/* ── Conteneur principal ──────────────────────────────── */
#gbot-wrap {
  position: fixed;
  z-index: var(--gbot-z);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}

#gbot-wrap.gbot-pos-bottom-right { bottom: 24px; right: 24px; }
#gbot-wrap.gbot-pos-bottom-left  { bottom: 24px; left: 24px; align-items: flex-start; }

/* ── Bouton flottant ──────────────────────────────────── */
#gbot-btn {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: var(--gbot-c, #4F46E5);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--gbot-shadow);
  transition: transform .2s, background .15s;
  flex-shrink: 0;
}

#gbot-btn:hover  { filter: brightness(1.1); transform: scale(1.06); }
#gbot-btn:active { transform: scale(0.95); }
#gbot-btn svg    { width: 22px; height: 22px; fill: #fff; pointer-events: none; }

/* ── Panneau de chat ──────────────────────────────────── */
#gbot-panel {
  width: 360px;
  max-width: calc(100vw - 32px);
  height: 520px;
  max-height: calc(100vh - 110px);
  background: #fff;
  border-radius: var(--gbot-radius);
  box-shadow: var(--gbot-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: gbot-slide-up .2s ease;
  transform-origin: bottom right;
}

#gbot-wrap.gbot-pos-bottom-left #gbot-panel { transform-origin: bottom left; }

@keyframes gbot-slide-up {
  from { opacity: 0; transform: scale(.92) translateY(10px); }
  to   { opacity: 1; transform: scale(1)   translateY(0); }
}

#gbot-panel[hidden] { display: none; }

/* ── En-tête ──────────────────────────────────────────── */
#gbot-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 15px;
  background: var(--gbot-c, #4F46E5);
  flex-shrink: 0;
}

.gbot-hd-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.gbot-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255,255,255,.2);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.gbot-avatar svg { width: 17px; height: 17px; fill: #fff; }

#gbot-name {
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  line-height: 1.2;
}

#gbot-status {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: rgba(255,255,255,.8);
}

.gbot-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #86efac;
  animation: gbot-pulse 2s infinite;
}

@keyframes gbot-pulse {
  0%,100% { opacity: 1; }
  50%      { opacity: .5; }
}

.gbot-hd-right { display: flex; gap: 2px; }

.gbot-hd-right button {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  background: transparent;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s;
}
.gbot-hd-right button:hover { background: rgba(255,255,255,.15); }
.gbot-hd-right button svg { width: 15px; height: 15px; fill: rgba(255,255,255,.85); }

/* ── Barre plan Free ──────────────────────────────────── */
#gbot-plan-bar {
  padding: 6px 14px;
  background: #fef9c3;
  border-bottom: 1px solid #fde68a;
  font-size: 12px;
  color: #854d0e;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

#gbot-upgrade-link {
  font-weight: 600;
  color: #7c3aed;
  text-decoration: none;
  font-size: 11px;
}
#gbot-upgrade-link:hover { text-decoration: underline; }

/* ── Zone messages ────────────────────────────────────── */
#gbot-msgs {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}

#gbot-msgs::-webkit-scrollbar        { width: 4px; }
#gbot-msgs::-webkit-scrollbar-track  { background: transparent; }
#gbot-msgs::-webkit-scrollbar-thumb  { background: #d1d5db; border-radius: 4px; }

/* ── Messages ─────────────────────────────────────────── */
.gbot-row {
  display: flex;
  gap: 7px;
  align-items: flex-end;
  max-width: 88%;
}
.gbot-row--user { align-self: flex-end; flex-direction: row-reverse; }
.gbot-row--bot  { align-self: flex-start; }

.gbot-av {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  flex-shrink: 0;
}
.gbot-av--bot  { background: var(--gbot-c, #4F46E5); color: #fff; }
.gbot-av--user { background: #e0e7ff; color: #4338ca; }

.gbot-bubble {
  padding: 9px 13px;
  font-size: 13px;
  line-height: 1.55;
  word-break: break-word;
}

.gbot-row--bot  .gbot-bubble {
  background: #f3f4f6;
  color: #111827;
  border-radius: 4px 13px 13px 13px;
}
.gbot-row--user .gbot-bubble {
  background: var(--gbot-c, #4F46E5);
  color: #fff;
  border-radius: 13px 4px 13px 13px;
}

/* Markdown dans les bulles bot */
.gbot-bubble strong { font-weight: 600; }
.gbot-bubble em     { font-style: italic; }
.gbot-bubble code   { background: rgba(0,0,0,.07); padding: 1px 5px; border-radius: 4px; font-size: 12px; }
.gbot-bubble a      { color: var(--gbot-c, #4F46E5); }
.gbot-row--user .gbot-bubble a { color: #e0e7ff; }
.gbot-bubble ul { padding-left: 16px; margin: 4px 0; }
.gbot-bubble li { margin: 2px 0; }

/* Indicateur de frappe */
.gbot-typing {
  display: flex;
  gap: 4px;
  padding: 10px 13px;
  background: #f3f4f6;
  border-radius: 4px 13px 13px 13px;
}
.gbot-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #9ca3af;
  animation: gbot-bounce 1.2s infinite;
}
.gbot-typing span:nth-child(2) { animation-delay: .18s; }
.gbot-typing span:nth-child(3) { animation-delay: .36s; }

@keyframes gbot-bounce {
  0%,60%,100% { transform: translateY(0); }
  30%          { transform: translateY(-6px); }
}

/* ── Chips ─────────────────────────────────────────────── */
#gbot-chips {
  padding: 7px 11px;
  display: flex;
  gap: 5px;
  overflow-x: auto;
  border-top: 1px solid #f3f4f6;
  flex-shrink: 0;
  scrollbar-width: none;
}
#gbot-chips::-webkit-scrollbar { display: none; }

.gbot-chip {
  white-space: nowrap;
  padding: 4px 11px;
  border-radius: 18px;
  font-size: 11.5px;
  border: 1px solid #e5e7eb;
  color: #374151;
  cursor: pointer;
  background: #fff;
  transition: all .15s;
  flex-shrink: 0;
  font-family: inherit;
}
.gbot-chip:hover {
  background: var(--gbot-c, #4F46E5);
  color: #fff;
  border-color: var(--gbot-c, #4F46E5);
}

/* ── Zone de saisie ────────────────────────────────────── */
#gbot-input-row {
  padding: 10px 11px;
  border-top: 1px solid #f3f4f6;
  display: flex;
  gap: 7px;
  align-items: flex-end;
  flex-shrink: 0;
}

#gbot-input {
  flex: 1;
  resize: none;
  border: 1.5px solid #e5e7eb;
  border-radius: 10px;
  padding: 8px 11px;
  font-size: 13px;
  font-family: inherit;
  background: #fff;
  color: #111827;
  outline: none;
  min-height: 38px;
  max-height: 100px;
  line-height: 1.45;
  transition: border-color .15s;
}
#gbot-input:focus { border-color: var(--gbot-c, #4F46E5); }

#gbot-send {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--gbot-c, #4F46E5);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: opacity .15s;
}
#gbot-send:hover   { opacity: .85; }
#gbot-send:active  { transform: scale(.95); }
#gbot-send:disabled { opacity: .35; cursor: not-allowed; }
#gbot-send svg { width: 15px; height: 15px; fill: #fff; }

/* ── Footer ─────────────────────────────────────────────── */
#gbot-footer {
  text-align: center;
  font-size: 10px;
  color: #9ca3af;
  padding: 4px;
  flex-shrink: 0;
}

/* ── Mobile ─────────────────────────────────────────────── */
@media (max-width: 480px) {
  #gbot-wrap.gbot-pos-bottom-right { bottom: 16px; right: 16px; }
  #gbot-wrap.gbot-pos-bottom-left  { bottom: 16px; left: 16px; }
  #gbot-panel {
    width: calc(100vw - 32px);
    height: 72vh;
  }
}
