/* ── Help Chat Widget ─────────────────────────────────────── */
#helpChatBtn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9800;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0ea5e9, #4dd9ec);
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(14, 165, 233, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  transition: transform 0.18s, box-shadow 0.18s;
}

#helpChatBtn:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 28px rgba(14, 165, 233, 0.6);
}

#helpChatBtn .chat-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  background: #f59e0b;
  color: #000;
  font-size: 0.5rem;
  font-weight: 800;
  padding: 2px 4px;
  border-radius: 4px;
  letter-spacing: 0.04em;
  font-family: 'Courier New', monospace;
  display: none;
}

#helpChatBtn.has-unread .chat-badge { display: block; }

/* ── Chat Panel ───────────────────────────────────────────── */
#helpChatPanel {
  position: fixed;
  bottom: 88px;
  right: 24px;
  z-index: 9800;
  width: 360px;
  max-width: calc(100vw - 48px);
  background: #0b1829;
  border: 1px solid rgba(77, 217, 236, 0.25);
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  max-height: 520px;
  animation: chatSlideUp 0.25s ease;
  overflow: hidden;
}

@keyframes chatSlideUp {
  from { transform: translateY(16px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.chat-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px 12px;
  border-bottom: 1px solid rgba(77, 217, 236, 0.12);
  flex-shrink: 0;
}

.chat-header-icon {
  font-size: 1.2rem;
}

.chat-header-text {
  flex: 1;
}

.chat-header-title {
  font-family: 'Courier New', monospace;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: #4dd9ec;
}

.chat-header-sub {
  font-size: 0.65rem;
  color: rgba(146, 189, 212, 0.45);
  margin-top: 1px;
}

.chat-close-btn {
  background: transparent;
  border: none;
  color: rgba(146, 189, 212, 0.5);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
  transition: color 0.15s;
}

.chat-close-btn:hover { color: #e2e8f0; }

/* ── Messages ─────────────────────────────────────────────── */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px 14px 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
}

.chat-msg {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.chat-msg-bubble {
  max-width: 88%;
  padding: 9px 13px;
  border-radius: 10px;
  font-size: 0.82rem;
  line-height: 1.5;
  word-break: break-word;
}

.chat-msg.user { align-items: flex-end; }
.chat-msg.bot  { align-items: flex-start; }

.chat-msg.user .chat-msg-bubble {
  background: rgba(14, 165, 233, 0.15);
  border: 1px solid rgba(14, 165, 233, 0.3);
  color: #e2e8f0;
}

.chat-msg.bot .chat-msg-bubble {
  background: rgba(77, 217, 236, 0.06);
  border: 1px solid rgba(77, 217, 236, 0.15);
  color: #92bdd4;
}

.chat-msg-time {
  font-size: 0.6rem;
  color: rgba(146, 189, 212, 0.3);
  font-family: 'Courier New', monospace;
  padding: 0 4px;
}

.chat-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 9px 13px;
  background: rgba(77, 217, 236, 0.06);
  border: 1px solid rgba(77, 217, 236, 0.15);
  border-radius: 10px;
  width: fit-content;
}

.chat-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #4dd9ec;
  animation: typingDot 1.2s ease-in-out infinite;
}

.chat-typing span:nth-child(2) { animation-delay: 0.2s; }
.chat-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingDot {
  0%, 60%, 100% { opacity: 0.2; transform: scale(0.85); }
  30% { opacity: 1; transform: scale(1.1); }
}

/* ── Suggested questions ─────────────────────────────────── */
.chat-suggestions {
  padding: 0 14px 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex-shrink: 0;
}

.chat-suggestion-chip {
  background: rgba(77, 217, 236, 0.07);
  border: 1px solid rgba(77, 217, 236, 0.2);
  border-radius: 20px;
  color: rgba(146, 189, 212, 0.7);
  font-size: 0.7rem;
  padding: 4px 10px;
  cursor: pointer;
  transition: all 0.15s;
  font-family: 'Courier New', monospace;
}

.chat-suggestion-chip:hover {
  background: rgba(77, 217, 236, 0.14);
  color: #4dd9ec;
  border-color: rgba(77, 217, 236, 0.4);
}

/* ── Input area ───────────────────────────────────────────── */
.chat-input-row {
  display: flex;
  gap: 8px;
  padding: 10px 14px 14px;
  border-top: 1px solid rgba(77, 217, 236, 0.1);
  flex-shrink: 0;
}

.chat-input {
  flex: 1;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(77, 217, 236, 0.2);
  border-radius: 8px;
  color: #e2e8f0;
  font-size: 0.82rem;
  padding: 9px 12px;
  resize: none;
  min-height: 38px;
  max-height: 100px;
  font-family: inherit;
  transition: border-color 0.15s;
}

.chat-input:focus {
  outline: none;
  border-color: rgba(77, 217, 236, 0.45);
}

.chat-send-btn {
  background: #4dd9ec;
  color: #000;
  border: none;
  border-radius: 8px;
  width: 38px;
  height: 38px;
  font-size: 1.1rem;
  cursor: pointer;
  flex-shrink: 0;
  transition: opacity 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-send-btn:hover { opacity: 0.85; }
.chat-send-btn:disabled { opacity: 0.4; cursor: default; }

/* ── Error state ─────────────────────────────────────────── */
.chat-error {
  color: #f06060;
  font-size: 0.78rem;
  padding: 6px 14px;
  font-family: 'Courier New', monospace;
}
