:root {
  --hb-bg: #ffffff;
  --hb-text: #111827;
  --hb-muted: #6b7280;
  --hb-border: #e5e7eb;
  --hb-accent: #324A60;            /* header + primary button */
  --hb-accent-fg: #ffffff;
  --hb-user: #e6f3ff;
  --hb-bot: #f5f5f5;
  --hb-shadow: 0 10px 30px rgba(0,0,0,.18);
  --hb-radius: 14px;
  --hb-z: 9999;
}

/* Launcher (floating button) */
.hb-launcher {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: var(--hb-z);
  width: 60px; height: 60px;
  border: 0; border-radius: 999px;
  background: var(--hb-accent);
  color: var(--hb-accent-fg);
  display: grid; place-items: center;
  box-shadow: var(--hb-shadow);
  cursor: pointer;
  transition: transform .15s ease, box-shadow .2s ease, background .2s ease;
}
.hb-launcher .hb-icon { transition: transform .2s ease, opacity .2s ease; }
.hb-launcher .icon-close { display: none; }

/* when open, flip which icon is visible */
.hb-launcher[aria-expanded="true"] .icon-chat { display: none; }
.hb-launcher[aria-expanded="true"] .icon-close { display: block; }

.hb-launcher:hover { transform: translateY(-1px); box-shadow: 0 14px 34px rgba(0,0,0,.22); }
.hb-launcher:active { transform: translateY(0); }
.hb-launcher svg { width: 39px; height: 39px; fill: currentColor; }

/* Wrapper panel */
.hb-wrap {
  position: fixed;
  right: 20px; bottom: 90px;          /* sits above the launcher */
  z-index: var(--hb-z);
  width: 360px; max-width: calc(100vw - 24px);
  max-height: min(70vh, 640px);
  background: var(--hb-bg);
  color: var(--hb-text);
  border: 1px solid var(--hb-border);
  border-radius: var(--hb-radius);
  box-shadow: var(--hb-shadow);
  display: none;                      /* hidden by default; JS toggles */
  overflow: hidden;
}

/* Header */
.hb-header {
  background: var(--hb-accent);
  color: var(--hb-accent-fg);
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 12px;
}
.hb-title { font: 600 14px/1.2 system-ui, -apple-system, Segoe UI, Roboto, Arial; }
.hb-close {
  border: 0; background: transparent; color: inherit; cursor: pointer;
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px;
}
.hb-close:hover { background: rgba(255,255,255,.1); }
.hb-close svg { width: 18px; height: 18px; stroke: currentColor; stroke-width: 2; fill: none; }

/* Messages */
.hb-messages {
  height: 360px; overflow: auto;
  padding: 12px 12px 6px;
  scroll-behavior: smooth;
  background: linear-gradient(180deg, #fff 0%, #fff 65%, #fafafa 100%);
}
.hb-msg { margin: 8px 0; display: flex; flex-direction: column; align-items: flex-start; }
.hb-msg.user { justify-content: flex-end; }
.hb-msg.user .hb-bubble { align-self: flex-end; }
.hb-bubble {
    display: block; 
  max-width: 85%;
  padding: 9px 12px;
  border-radius: 12px;
  font: 14px/1.45 system-ui, -apple-system, Segoe UI, Roboto, Arial;
  word-wrap: break-word; white-space: pre-wrap;
  box-shadow: 0 1px 0 rgba(0,0,0,.03);
}
.hb-msg.user .hb-bubble { background: var(--hb-user); }
.hb-msg.bot  .hb-bubble { background: var(--hb-bot); }
.hb-sources .hb-dot { margin: 0 6px; opacity: .6; }
.hb-sources .hb-chip {
  text-decoration: none;
  white-space: nowrap;
}
.hb-sources-label { font-weight: 600; margin-right: 6px; }

.hb-sources {
  margin: 4px 4px 0; color: var(--hb-muted); font: 12px/1.35 system-ui; display: block;
}
.hb-sources a { color: inherit; text-decoration: underline; }
.hb-sources a:hover { text-decoration-thickness: 2px; }


/* container */
.hb-sources {
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px solid rgba(0,0,0,0.06);
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: 100%;
}

.hb-sources-label {
  font-size: 12px;
  font-weight: 600;
  color: rgba(0,0,0,0.55);
}

/* chip row(s) */
.hb-source-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-width: 100%;
}

/* pill chips */
.hb-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 220px;                /* keeps inside bubble */
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(0,0,0,0.04);
  border: 01px solid rgba(0,0,0,0.08);
  text-decoration: none;
  font-size: 10px;
  line-height: 1.2;
  color: inherit;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hb-chip:hover { background: rgba(0,0,0,0.06); }

/* icon + text truncation */
.hb-chip-icon {
  flex: 0 0 auto;
}
.hb-chip-text {
  overflow: hidden;
  text-overflow: ellipsis;
}

/* "+N more" button styled like a chip */
.hb-chip-more {
  cursor: pointer;
  background: rgba(0,0,0,0.05);
  border-style: dashed;
}

/* collapsed / expanded area for the rest */
.more-collapsed { display: none; }
.more-open { display: flex; flex-wrap: wrap; gap: 6px; }

/* ensure bubble doesn't let children overflow horizontally */
.hb-bubble { max-width: 100%; overflow-wrap: anywhere; }




/* Input bar */
.hb-inputbar {
  display: grid; grid-template-columns: 1fr 40px;
  gap: 8px; padding: 10px; border-top: 1px solid var(--hb-border);
  background: #fff;
}
.hb-input {
  border: 1px solid var(--hb-border); border-radius: 10px; padding: 10px 12px;
  font: 14px system-ui; outline: none; background: #fff;
}
.hb-input:focus { border-color: #cfd2d8; box-shadow: 0 0 0 3px rgba(17,17,17,.06); }
.hb-send {
  border: 0; border-radius: 10px; background: var(--hb-accent); color: var(--hb-accent-fg);
  display: grid; place-items: center; cursor: pointer;
  transition: filter .15s ease;
}
.hb-send:hover { filter: brightness(1.1); }
.hb-send svg { width: 18px; height: 18px; fill: currentColor; }

/* typing indicator */
.hb-typing { display:flex; gap:4px; align-items:center; }
.hb-typing-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--hb-muted);
  opacity: .6;
  animation: hb-bounce 1.2s infinite ease-in-out;
}
.hb-typing-dot:nth-child(2) { animation-delay: .15s; }
.hb-typing-dot:nth-child(3) { animation-delay: .30s; }

/* static/css/bot_widget.css */
.hb-actions { margin-top: 10px; display: flex; gap: 8px; flex-wrap: wrap; }
.hb-btn {
  display:inline-block; padding:8px 12px; border-radius:999px;
  border:1px solid #e0e0e0; background:#fff; font-weight:600;
  text-decoration:none; font-size:13px;
}
.hb-btn:hover { background:#f6f6f6; }
.hb-btn-primary {
  background:#111; color:#fff; border-color:#111;
}
.hb-btn-primary:hover { background:#000; }

@keyframes hb-bounce {
  0%, 80%, 100% { transform: translateY(0); opacity:.5; }
  40%           { transform: translateY(-4px); opacity:1; }
}

/* Show state */
.hb-wrap.is-open { display: block; animation: hb-pop .16s ease-out; }
@keyframes hb-pop { from { transform: translateY(8px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* Mobile tweaks */
@media (max-width: 480px) {
  .hb-wrap { right: 12px; bottom: 80px; width: calc(100vw - 24px); max-height: 70vh; }
  .hb-messages { height: 48vh; }
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  .hb-messages { scroll-behavior: auto; }
  .hb-wrap.is-open { animation: none; }
}


#backToTop {
  display: none;
  position: fixed;
  bottom: 20px;
  left: 20px;
  z-index: 99;
  font-size: 20px;
  width: 48px;
  height: 48px;
  border: none;
  outline: none;
  background: #324A60; /* Deep blue button */
  color: #E8AB16; /* Golden icon */
  cursor: pointer;
  border-radius: 50%;
  box-shadow: 0 4px 8px rgba(0,0,0,0.15);
  transition: all 0.3s ease;
}

#backToTop:hover {
  background: #063340; /* Darker hover */
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(0,0,0,0.25);
}

/* Pricing Card */
/* Pricing card */
.hb-price-card {
  background: #fff;
  border-radius: 16px;
  padding: 12px 16px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
  margin: 10px 0; /* reduced vertical spacing */
  max-width: 320px;
  text-align: center;
}

/* Product image */
.hb-product-img {
  max-width: 100%;
  max-height: 160px;
  border-radius: 12px;
  object-fit: cover;
  margin-bottom: 8px; /* tighter gap */
}

/* Title & metadata */
.hb-card-title {
  font-weight: 600;
  font-size: 1.1rem;
  margin-bottom: 4px;
}

.hb-card-meta {
  color: #666;
  font-size: 0.85rem;
  margin-bottom: 6px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}

.hb-badge {
  background: #f2f2f2;
  color: #333;
  font-size: 0.75rem;
  border-radius: 12px;
  padding: 2px 8px;
}

/* Tier list */
.hb-tier-list {
  border-top: 1px solid #eee;
  margin-top: 6px;
  padding-top: 6px;
  font-size: 0.85rem;
}

.hb-tier-row {
  display: flex;
  justify-content: space-between;
  padding: 2px 0;
}

.hb-tier-qty {
  font-weight: 500;
}

.hb-tier-price {
  font-weight: 600;
  color: #324A60;
}


/* ---------------- FEEDBACK CSS ---------------------*/
.hb-feedback {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.hb-thumb {
  border: 0;
  background: #f2f4f7;
  border-radius: 999px;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 14px;
}
.hb-thumb:hover { background:#e7ebf0; }

.hb-comment.hidden, .hb-feedback-status.hidden { display: none; }

.hb-comment {
  display: flex;
  gap: 6px;
  flex: 1;
}
.hb-comment-input {
  flex: 1;
  border-radius: 8px;
  border: 1px solid #e4e7ec;
  padding: 6px 8px;
  font-size: 13px;
}
.hb-comment-send {
  border: 0;
  background: #324A60;
  color: #fff;
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
}

.hb-feedback-status {
  color: #667085;
  font-size: 12px;
}

/* ---------------- END OF FEEDBACK CSS ---------------------*/