/* ===================================================
   PUBLIC/CSS/HELPBOT.CSS — Chatbot FAQ + Assistant
   =================================================== */

#helpbot {
  position: fixed;
  bottom: 28px;
  left: 28px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  pointer-events: none;
}
#helpbot > * { pointer-events: all; }

/* ── Bulle ── */
.hb-bubble {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 18px 18px 18px 4px;
  padding: 9px 14px 9px 16px;
  box-shadow: 0 6px 24px rgba(15,23,42,.1);
  font-size: .845rem;
  font-weight: 500;
  color: var(--text);
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.25s ease, transform 0.25s ease;
  pointer-events: none;
  white-space: nowrap;
}
.hb-bubble--visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: all;
  cursor: pointer;
}
.hb-bubble-close {
  background: none;
  border: none;
  padding: 2px;
  color: var(--muted, #94a3b8);
  cursor: pointer;
  display: flex;
  align-items: center;
  transition: color 0.15s;
}
.hb-bubble-close svg { width: 10px; height: 10px; }
.hb-bubble-close:hover { color: var(--text); }

/* ── Bouton flottant ── */
.hb-trigger {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(145deg, #6b57d6 0%, var(--primary) 100%);
  box-shadow: 0 4px 20px rgba(94,74,208,.4);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.hb-trigger:hover {
  transform: scale(1.07) translateY(-2px);
  box-shadow: 0 8px 28px rgba(94,74,208,.5);
}
.hb-trigger:active { transform: scale(0.95); }

.hb-trigger-robot,
.hb-trigger-close {
  display: flex;
  align-items: center;
  justify-content: center;
}
.hb-trigger-robot svg { width: 30px; height: 30px; }
.hb-trigger-close svg { width: 18px; height: 18px; }

/* Animation légère au chargement */
@keyframes hbPulse {
  0%, 100% { box-shadow: 0 4px 20px rgba(94,74,208,.4); }
  50%       { box-shadow: 0 4px 28px rgba(94,74,208,.65); }
}
.hb-trigger { animation: hbPulse 3s ease-in-out 4.5s 3; }

/* ── Panel ── */
.hb-panel {
  position: absolute;
  bottom: 64px;
  left: 0;
  width: 344px;
  background: var(--surface, #fff);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 16px 48px rgba(15,23,42,.14), 0 2px 8px rgba(15,23,42,.06);
  overflow: hidden;
  opacity: 0;
  transform: translateY(12px) scale(0.97);
  pointer-events: none;
  transition: opacity 0.25s cubic-bezier(.16,1,.3,1), transform 0.25s cubic-bezier(.16,1,.3,1);
  transform-origin: bottom left;
  display: flex;
  flex-direction: column;
}
.hb-panel--open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

/* ── Header ── */
.hb-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  background: linear-gradient(135deg, #5040c0 0%, var(--primary) 100%);
  color: #fff;
  flex-shrink: 0;
}
.hb-header-icon {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255,255,255,.12);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.hb-header-icon svg { width: 26px; height: 26px; }
.hb-header-name {
  font-size: .88rem;
  font-weight: 600;
  letter-spacing: -.01em;
}
.hb-header-status {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: .74rem;
  opacity: .8;
  margin-top: 2px;
}
.hb-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #86efac;
  box-shadow: 0 0 0 2px rgba(134,239,172,.25);
}

/* ── Tabs ── */
.hb-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--surface, #fff);
}
.hb-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px;
  background: none;
  border: none;
  font-size: .8rem;
  font-weight: 500;
  color: var(--muted, #64748b);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}
.hb-tab svg { width: 15px; height: 15px; }
.hb-tab--active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}
.hb-tab:hover:not(.hb-tab--active) { color: var(--text); }

/* ── Corps ── */
.hb-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  max-height: 380px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.hb-body::-webkit-scrollbar { width: 3px; }
.hb-body::-webkit-scrollbar-track { background: transparent; }
.hb-body::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.hb-body--exit {
  opacity: 0;
  transform: translateX(-10px);
  transition: opacity 0.14s ease, transform 0.14s ease;
}
.hb-body--enter {
  animation: hbSlideIn 0.22s cubic-bezier(.16,1,.3,1) forwards;
}
@keyframes hbSlideIn {
  from { opacity: 0; transform: translateX(10px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ── Écran ── */
.hb-screen { padding: 18px; }

.hb-section-label {
  font-size: .7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted, #94a3b8);
  margin-bottom: 10px;
}

/* ── Catégories ── */
.hb-cats { display: flex; flex-direction: column; gap: 6px; }

.hb-cat {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg, #F5F2ED);
  cursor: pointer;
  text-align: left;
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
}
.hb-cat:hover {
  background: rgba(94,74,208,.05);
  border-color: rgba(94,74,208,.22);
  transform: translateX(2px);
}
.hb-cat-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(94,74,208,.08);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--primary);
}
.hb-cat-icon svg { width: 16px; height: 16px; }
.hb-cat-label { flex: 1; font-size: .845rem; font-weight: 500; color: var(--text); }
.hb-cat-arrow { width: 14px; height: 14px; color: var(--muted, #cbd5e1); transition: transform 0.15s, color 0.15s; }
.hb-cat:hover .hb-cat-arrow { transform: translateX(2px); color: var(--primary); }

/* ── Back / Navigation ── */
.hb-back {
  display: flex;
  align-items: center;
  gap: 5px;
  background: none;
  border: none;
  font-size: .78rem;
  font-weight: 500;
  color: var(--primary);
  cursor: pointer;
  padding: 0;
  margin-bottom: 12px;
  transition: gap 0.15s;
}
.hb-back:hover { gap: 8px; }
.hb-back svg { width: 13px; height: 13px; }

/* ── Questions ── */
.hb-questions { display: flex; flex-direction: column; gap: 5px; }

.hb-question {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--bg, #F5F2ED);
  cursor: pointer;
  text-align: left;
  transition: background 0.15s, border-color 0.15s;
}
.hb-question:hover {
  background: rgba(94,74,208,.05);
  border-color: rgba(94,74,208,.22);
}
.hb-question-text { font-size: .83rem; color: var(--text); line-height: 1.4; flex: 1; }
.hb-question svg { width: 13px; height: 13px; color: var(--muted, #cbd5e1); flex-shrink: 0; }
.hb-question:hover svg { color: var(--primary); }

/* ── Réponse ── */
.hb-answer-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg, #F5F2ED);
  padding: 14px;
  margin-bottom: 14px;
}
.hb-answer-q {
  font-size: .82rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.hb-answer-a {
  font-size: .82rem;
  line-height: 1.65;
  color: var(--muted, #4b5563);
}
.hb-answer-a strong { color: var(--text); font-weight: 600; }
.hb-inline-link { color: var(--primary); text-decoration: underline; text-underline-offset: 2px; }

.hb-answer-vote { margin-bottom: 10px; }
.hb-vote-label { font-size: .76rem; color: var(--muted, #94a3b8); display: block; margin-bottom: 7px; }
.hb-vote-btns { display: flex; gap: 7px; }
.hb-vote {
  padding: 5px 14px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: none;
  font-size: .78rem;
  cursor: pointer;
  color: var(--muted, #64748b);
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.hb-vote:hover { background: rgba(94,74,208,.07); border-color: var(--primary); color: var(--primary); }

.hb-other-q {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 9px;
  border-radius: 9px;
  border: 1.5px dashed var(--border);
  background: none;
  font-size: .82rem;
  color: var(--muted, #64748b);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.hb-other-q:hover { border-color: var(--primary); color: var(--primary); }

/* ── Chat ── */
.hb-chat-screen { padding: 0; }

.hb-chat-messages {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.hb-msg {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}
.hb-msg--user { flex-direction: row-reverse; }

.hb-msg-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #5040c0 0%, var(--primary) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.hb-msg-avatar svg { width: 20px; height: 20px; }

.hb-msg-bubble {
  max-width: 78%;
  padding: 9px 13px;
  border-radius: 14px;
  font-size: .82rem;
  line-height: 1.55;
}
.hb-msg--bot .hb-msg-bubble {
  background: var(--bg, #F5F2ED);
  border: 1px solid var(--border);
  color: var(--text);
  border-bottom-left-radius: 4px;
}
.hb-msg--user .hb-msg-bubble {
  background: var(--primary);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.hb-msg--bot .hb-msg-bubble strong { font-weight: 600; }
.hb-msg--bot .hb-msg-bubble a { color: var(--primary); text-decoration: underline; text-underline-offset: 2px; }

/* Apparition nouveau message */
.hb-msg--new {
  animation: hbMsgIn 0.2s ease forwards;
}
@keyframes hbMsgIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Typing indicator */
.hb-msg--typing .hb-msg-bubble {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 14px;
}
.hb-typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted, #94a3b8);
  animation: hbTyping 1.2s ease-in-out infinite;
}
.hb-typing-dot:nth-child(2) { animation-delay: .15s; }
.hb-typing-dot:nth-child(3) { animation-delay: .3s; }
@keyframes hbTyping {
  0%, 60%, 100% { transform: translateY(0); opacity: .4; }
  30%            { transform: translateY(-5px); opacity: 1; }
}

/* ── Chat input ── */
.hb-chat-input-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  background: var(--surface, #fff);
  flex-shrink: 0;
}
.hb-chat-input {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 8px 14px;
  font-size: .83rem;
  color: var(--text);
  background: var(--bg, #F5F2ED);
  outline: none;
  transition: border-color 0.15s;
  font-family: inherit;
}
.hb-chat-input:focus { border-color: var(--primary); background: var(--surface, #fff); }
.hb-chat-input::placeholder { color: var(--muted, #94a3b8); }

.hb-chat-send {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, transform 0.15s;
}
.hb-chat-send:hover { background: var(--primary-hover); transform: scale(1.06); }
.hb-chat-send svg { width: 15px; height: 15px; }

/* ── Responsive ── */
@media (max-width: 480px) {
  #helpbot { bottom: 16px; left: 14px; }
  .hb-panel { width: calc(100vw - 28px); }
}
