/* ============================================================
   Chat contextuel du centre d'aide — bulle flottante + panneau.
   Injecté uniquement sur les pages de guide (data-help-slug).
   ============================================================ */
.help-chat-btn {
  position: fixed; right: 20px; bottom: 20px; z-index: 50;
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--blue); color: #fff; border: none; border-radius: 999px;
  padding: 12px 18px; font-family: var(--font); font-size: 14px; font-weight: 600;
  box-shadow: var(--shadow-hover); cursor: pointer; transition: background .15s, transform .1s;
}
.help-chat-btn:hover { background: var(--blue-dark); }
.help-chat-btn:active { transform: scale(.97); }
.help-chat-btn svg { width: 18px; height: 18px; }
.help-chat-btn.hidden { display: none; }

.help-chat-panel {
  position: fixed; right: 20px; bottom: 20px; z-index: 51;
  width: 380px; max-width: calc(100vw - 32px);
  height: 560px; max-height: calc(100vh - 40px);
  background: #fff; border: 1px solid var(--border); border-radius: 16px;
  box-shadow: var(--shadow-hover); display: flex; flex-direction: column;
  overflow: hidden; font-family: var(--font);
}
.help-chat-panel[hidden] { display: none; }

.help-chat-head {
  display: flex; align-items: center; gap: 10px; padding: 14px 16px;
  background: linear-gradient(135deg, #0866FF, #1877F2); color: #fff;
}
.help-chat-head .hc-dot {
  width: 30px; height: 30px; border-radius: 50%; background: rgba(255,255,255,.18);
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 14px; flex-shrink: 0;
}
.help-chat-head .hc-meta { flex: 1; min-width: 0; }
.help-chat-head .hc-title { font-size: 14px; font-weight: 700; line-height: 1.2; }
.help-chat-head .hc-sub { font-size: 11.5px; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.help-chat-close { background: none; border: none; color: #fff; font-size: 24px; line-height: 1; cursor: pointer; opacity: .85; padding: 0 4px; }
.help-chat-close:hover { opacity: 1; }

.help-chat-body { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; background: var(--gray-bg); }
.hc-msg { max-width: 86%; padding: 10px 13px; border-radius: 14px; font-size: 13.5px; line-height: 1.55; word-wrap: break-word; }
.hc-msg p { margin: 0 0 6px; } .hc-msg p:last-child { margin-bottom: 0; }
.hc-msg.user { align-self: flex-end; background: var(--blue); color: #fff; border-bottom-right-radius: 4px; }
.hc-msg.bot { align-self: flex-start; background: #fff; color: var(--text); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.hc-msg.bot strong { font-weight: 600; }
.hc-msg.bot ul { margin: 4px 0 4px 1.1rem; } .hc-msg.bot li { margin-bottom: 2px; }
.hc-msg.typing { color: var(--muted); font-style: italic; }
.hc-msg a { color: var(--blue); }
.hc-msg.user a { color: #fff; text-decoration: underline; }

.hc-suggest { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 16px 10px; background: var(--gray-bg); }
.hc-chip { font-size: 12px; color: var(--blue); background: var(--blue-light); border: 1px solid #C3DAFE; border-radius: 999px; padding: 5px 11px; cursor: pointer; transition: background .15s; }
.hc-chip:hover { background: #D8E9FF; }

.help-chat-foot { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--border); background: #fff; }
.help-chat-foot textarea {
  flex: 1; resize: none; border: 1px solid var(--border); border-radius: 10px;
  padding: 9px 12px; font-family: var(--font); font-size: 13.5px; line-height: 1.4; max-height: 90px; outline: none;
}
.help-chat-foot textarea:focus { border-color: var(--blue); }
.help-chat-send { background: var(--blue); color: #fff; border: none; border-radius: 10px; width: 42px; flex-shrink: 0; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: background .15s; }
.help-chat-send:hover { background: var(--blue-dark); }
.help-chat-send:disabled { opacity: .5; cursor: default; }
.help-chat-send svg { width: 18px; height: 18px; }

.hc-disclaimer { font-size: 10.5px; color: var(--muted); text-align: center; padding: 0 12px 10px; background: #fff; }

/* Mise en relation Harry + transitions d'agent */
.hc-handoff { padding: 2px 0; }
.hc-handoff-btn { width: 100%; background: var(--blue); color: #fff; border: none; border-radius: 12px; padding: 11px 14px; font-family: var(--font); font-size: 13.5px; font-weight: 600; cursor: pointer; transition: background .15s; }
.hc-handoff-btn:hover { background: var(--blue-dark); }
.hc-divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 11.5px; margin: 6px 2px; }
.hc-divider span { flex: 0 0 auto; }
.hc-divider::before, .hc-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.hc-switch { background: rgba(255,255,255,0.18); border: none; color: #fff; font-size: 12px; font-weight: 600; border-radius: 8px; padding: 5px 9px; cursor: pointer; transition: background .15s; }
.hc-switch:hover { background: rgba(255,255,255,0.3); }
.hc-switch[hidden] { display: none; }

@media (max-width: 480px) {
  .help-chat-panel { right: 0; bottom: 0; width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; border-radius: 0; }
  .help-chat-btn { right: 14px; bottom: 14px; }
}
