/* ============ Heisenberg Chatbot Widget ============ */

.hb-chat-root {
  --hb-bg: rgba(14, 14, 16, 0.92);
  --hb-bg-solid: #0e0e10;
  --hb-border: rgba(255, 255, 255, 0.08);
  --hb-text: #f0f0f0;
  --hb-text-dim: rgba(240, 240, 240, 0.55);
  --hb-accent: #00ffff;
  --hb-user-bubble: rgba(0, 255, 255, 0.08);
  --hb-user-border: rgba(0, 255, 255, 0.35);
  --hb-bot-bubble: rgba(255, 255, 255, 0.04);
  --hb-bot-border: rgba(255, 255, 255, 0.08);
  font-family: 'Chakra Petch', system-ui, -apple-system, sans-serif;
}

/* ===== Floating button ===== */
.hb-chat-btn {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 99990;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  background: #0e0e10;
  color: #f0f0f0;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  font-family: 'Chakra Petch', system-ui, sans-serif;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(0, 255, 255, 0.05);
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}
.hb-chat-btn:hover {
  transform: translateY(-2px);
  border-color: rgba(0, 255, 255, 0.35);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5), 0 0 20px rgba(0, 255, 255, 0.15);
}
.hb-chat-btn svg { width: 20px; height: 20px; flex-shrink: 0; color: #00ffff; }
.hb-chat-btn.hb-hidden { display: none; }

/* Hide the whole widget on the cover (hero) page */
body.hb-on-cover .hb-chat-btn,
body.hb-on-cover .hb-chat-panel { display: none !important; }

/* ===== Panel ===== */
.hb-chat-panel {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 400px;
  height: 600px;
  max-height: calc(100vh - 48px);
  z-index: 99991;
  display: flex;
  flex-direction: column;
  background: rgba(14, 14, 16, 0.92);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(0, 255, 255, 0.04);
  color: #f0f0f0;
  overflow: hidden;
  opacity: 0;
  transform: translateY(16px) scale(0.98);
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
  font-family: 'Chakra Petch', system-ui, -apple-system, sans-serif;
}
.hb-chat-panel.hb-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* ===== Header ===== */
.hb-chat-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}
.hb-chat-header-logo {
  width: 22px; height: 22px;
  color: #00ffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.hb-chat-header-logo svg { width: 100%; height: 100%; }
.hb-chat-header-name {
  flex: 1;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.hb-chat-header-btn {
  background: transparent;
  border: none;
  color: rgba(240, 240, 240, 0.55);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s, background 0.2s;
}
.hb-chat-header-btn:hover { color: #f0f0f0; background: rgba(255,255,255,0.06); }
.hb-chat-header-btn svg { width: 16px; height: 16px; }

/* ===== Body ===== */
.hb-chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 16px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.15) transparent;
}
.hb-chat-body::-webkit-scrollbar { width: 6px; }
.hb-chat-body::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 3px; }

/* ===== Welcome ===== */
.hb-chat-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 20px 4px;
}
.hb-chat-welcome-logo {
  width: 44px; height: 44px;
  color: #00ffff;
  margin-bottom: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.hb-chat-welcome-logo svg { width: 100%; height: 100%; }
.hb-chat-welcome-title {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 6px;
  letter-spacing: 0.01em;
}
.hb-chat-welcome-sub {
  font-size: 13px;
  color: rgba(240, 240, 240, 0.55);
  margin-bottom: 22px;
  line-height: 1.5;
}
.hb-chat-cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}
.hb-chat-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  color: #f0f0f0;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, transform 0.2s;
  font-family: inherit;
}
.hb-chat-card:hover {
  border-color: rgba(0, 255, 255, 0.35);
  background: rgba(0, 255, 255, 0.04);
  transform: translateY(-1px);
}
.hb-chat-card svg { width: 14px; height: 14px; color: #00ffff; flex-shrink: 0; margin-top: 2px; }

/* ===== Messages ===== */
.hb-chat-msg {
  display: flex;
  margin-bottom: 12px;
  max-width: 100%;
  animation: hb-fade 0.25s ease;
}
@keyframes hb-fade {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
.hb-chat-msg-user { justify-content: flex-end; }
.hb-chat-msg-bot  { justify-content: flex-start; }
.hb-chat-bubble {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.5;
  word-wrap: break-word;
  white-space: pre-wrap;
}
.hb-chat-msg-user .hb-chat-bubble {
  background: rgba(0, 255, 255, 0.08);
  border: 1px solid rgba(0, 255, 255, 0.35);
  color: #f0f0f0;
}
.hb-chat-msg-bot .hb-chat-bubble {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #f0f0f0;
}
.hb-chat-typing {
  display: inline-flex;
  gap: 4px;
  padding: 4px 0;
}
.hb-chat-typing span {
  width: 6px; height: 6px;
  background: rgba(240, 240, 240, 0.55);
  border-radius: 50%;
  animation: hb-bounce 1.2s infinite ease-in-out;
}
.hb-chat-typing span:nth-child(2) { animation-delay: 0.15s; }
.hb-chat-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes hb-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-4px); opacity: 1; }
}

/* ===== Footer / input ===== */
.hb-chat-footer {
  padding: 12px 14px 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}
.hb-chat-input-wrap {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 8px 8px 8px 14px;
  transition: border-color 0.2s;
}
.hb-chat-input-wrap:focus-within { border-color: rgba(0, 255, 255, 0.35); }
.hb-chat-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: #f0f0f0;
  font-family: inherit;
  font-size: 14px;
  resize: none;
  max-height: 120px;
  line-height: 1.4;
  padding: 4px 0;
}
.hb-chat-input::placeholder { color: rgba(240, 240, 240, 0.55); }
.hb-chat-send {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: rgba(0, 255, 255, 0.12);
  border: 1px solid rgba(0, 255, 255, 0.35);
  color: #00ffff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s, transform 0.2s;
}
.hb-chat-send:hover:not(:disabled) { background: rgba(0, 255, 255, 0.2); transform: translateY(-1px); }
.hb-chat-send:disabled { opacity: 0.4; cursor: not-allowed; }
.hb-chat-send svg { width: 16px; height: 16px; }

.hb-chat-mic {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: rgba(240, 240, 240, 0.75);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s, transform 0.2s, color 0.2s, border-color 0.2s;
}
.hb-chat-mic:hover { background: rgba(255, 255, 255, 0.08); color: #f0f0f0; transform: translateY(-1px); }
.hb-chat-mic svg { width: 16px; height: 16px; }
.hb-chat-mic.hb-recording {
  background: rgba(255, 0, 68, 0.16);
  border-color: rgba(255, 0, 68, 0.55);
  color: #ff0044;
  animation: hb-mic-pulse 1.2s ease-in-out infinite;
}
@keyframes hb-mic-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 0, 68, 0.45); }
  50%      { box-shadow: 0 0 0 6px rgba(255, 0, 68, 0); }
}

.hb-chat-accent { color: #00ffff; font-weight: 600; }

.hb-chat-disclaimer {
  text-align: center;
  font-size: 11px;
  color: rgba(240, 240, 240, 0.55);
  margin-top: 8px;
  line-height: 1.4;
}

/* ===== Mobile: full screen ===== */
@media (max-width: 640px) {
  .hb-chat-panel {
    right: 0; bottom: 0; left: 0; top: 0;
    width: 100%; height: 100%;
    max-height: 100vh; max-height: 100dvh;
    border-radius: 0;
  }
  .hb-chat-btn { right: 16px; bottom: 16px; padding: 10px 16px; font-size: 13px; }
}
