/* ── DMforME Help Bot ─────────────────────────────────────────────────────── */

/* Launcher button */
.hb-launcher {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--blue), #3ba8d8);
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(92, 200, 248, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9998;
  transition: transform 0.2s, box-shadow 0.2s;
}
.hb-launcher:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(92, 200, 248, 0.5);
}
.hb-launcher svg {
  width: 28px;
  height: 28px;
  fill: var(--dark);
}
.hb-launcher .hb-close-icon { display: none; }
.hb-launcher.open .hb-chat-icon { display: none; }
.hb-launcher.open .hb-close-icon { display: block; }

/* Chat panel */
.hb-panel {
  position: fixed;
  bottom: 92px;
  right: 24px;
  width: 370px;
  max-height: 520px;
  background: #0D1117;
  border: 1px solid rgba(92, 200, 248, 0.15);
  border-radius: 16px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.5);
  display: none;
  flex-direction: column;
  z-index: 9999;
  overflow: hidden;
  font-family: 'DM Sans', sans-serif;
}
.hb-panel.open {
  display: flex;
  animation: hbSlideUp 0.25s ease-out;
}
@keyframes hbSlideUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Header */
.hb-header {
  padding: 16px 20px;
  background: linear-gradient(135deg, rgba(92, 200, 248, 0.08), rgba(92, 200, 248, 0.02));
  border-bottom: 1px solid rgba(92, 200, 248, 0.1);
  display: flex;
  align-items: center;
  gap: 10px;
}
.hb-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--blue), #3ba8d8);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.hb-header-text h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: #F0F6FC;
  font-family: 'Syne', sans-serif;
}
.hb-header-text p {
  margin: 2px 0 0;
  font-size: 12px;
  color: rgba(240, 246, 252, 0.5);
}

/* Messages area */
.hb-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 200px;
  max-height: 320px;
}
.hb-messages::-webkit-scrollbar { width: 4px; }
.hb-messages::-webkit-scrollbar-thumb { background: rgba(92, 200, 248, 0.2); border-radius: 4px; }

/* Message bubbles */
.hb-msg {
  max-width: 88%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.5;
  color: #F0F6FC;
  word-wrap: break-word;
}
.hb-msg.bot {
  align-self: flex-start;
  background: rgba(92, 200, 248, 0.08);
  border: 1px solid rgba(92, 200, 248, 0.1);
  border-bottom-left-radius: 4px;
}
.hb-msg.user {
  align-self: flex-end;
  background: rgba(92, 200, 248, 0.18);
  border: 1px solid rgba(92, 200, 248, 0.15);
  border-bottom-right-radius: 4px;
}

/* Inline links in bot messages */
.hb-msg.bot a {
  color: var(--blue);
  text-decoration: underline;
}

/* Step lists inside bot messages */
.hb-msg.bot ol,
.hb-msg.bot ul {
  margin: 6px 0 2px 0;
  padding-left: 18px;
}
.hb-msg.bot li {
  margin-bottom: 4px;
}

/* Suggested topics / quick replies */
.hb-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 16px 12px;
}
.hb-chip {
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  background: rgba(92, 200, 248, 0.06);
  border: 1px solid rgba(92, 200, 248, 0.15);
  color: var(--blue);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.hb-chip:hover {
  background: rgba(92, 200, 248, 0.15);
  border-color: rgba(92, 200, 248, 0.3);
}

/* Category chips (top-level menu) */
.hb-categories {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 16px 12px;
}
.hb-cat-chip {
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
  background: rgba(92, 200, 248, 0.06);
  border: 1px solid rgba(92, 200, 248, 0.12);
  color: #F0F6FC;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  display: flex;
  align-items: center;
  gap: 6px;
}
.hb-cat-chip:hover {
  background: rgba(92, 200, 248, 0.14);
  border-color: rgba(92, 200, 248, 0.25);
}
.hb-cat-chip .hb-cat-icon {
  font-size: 14px;
}

/* Input area */
.hb-input-row {
  padding: 12px 16px;
  border-top: 1px solid rgba(92, 200, 248, 0.1);
  display: flex;
  gap: 8px;
  align-items: center;
}
.hb-input {
  flex: 1;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid rgba(92, 200, 248, 0.15);
  background: rgba(255, 255, 255, 0.04);
  color: #F0F6FC;
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s;
}
.hb-input::placeholder { color: rgba(240, 246, 252, 0.3); }
.hb-input:focus { border-color: rgba(92, 200, 248, 0.4); }
.hb-send-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: none;
  background: var(--blue);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s;
}
.hb-send-btn:hover { background: #3ba8d8; }
.hb-send-btn svg { width: 16px; height: 16px; fill: var(--dark); }

/* Back button */
.hb-back {
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 12px;
  background: none;
  border: 1px solid rgba(92, 200, 248, 0.15);
  color: rgba(240, 246, 252, 0.6);
  cursor: pointer;
  align-self: flex-start;
  margin: 0 16px 8px;
  transition: color 0.15s, border-color 0.15s;
}
.hb-back:hover {
  color: var(--blue);
  border-color: rgba(92, 200, 248, 0.3);
}

/* ── Extension-specific overrides ──────────────────────────────────────────── */
.sidepanel-helpbot .hb-launcher {
  bottom: 16px;
  right: 16px;
  width: 44px;
  height: 44px;
}
.sidepanel-helpbot .hb-launcher svg {
  width: 22px;
  height: 22px;
}
.sidepanel-helpbot .hb-panel {
  bottom: 72px;
  right: 12px;
  left: 12px;
  width: auto;
  max-height: 440px;
}

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .hb-panel {
    right: 12px;
    left: 12px;
    width: auto;
    bottom: 84px;
    max-height: 70vh;
  }
  .hb-launcher {
    bottom: 16px;
    right: 16px;
    width: 48px;
    height: 48px;
  }
}
