/* FAB */
#hh-chat-fab {
  position: fixed; bottom: 28px; right: 28px; z-index: 9000;
  width: 60px; height: 60px; border-radius: 50%;
  background: linear-gradient(135deg, #2693cd, #1a78ad);
  color: white; display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem; cursor: pointer; box-shadow: 0 6px 24px rgba(38,147,205,0.45);
  transition: transform 0.3s cubic-bezier(0.34,1.56,0.64,1), box-shadow 0.3s;
  user-select: none;
}
#hh-chat-fab:hover { transform: scale(1.1); box-shadow: 0 10px 32px rgba(38,147,205,0.55); }
#hh-chat-fab.open { transform: rotate(15deg) scale(1.05); }
.hh-unread-badge {
  position: absolute; top: -4px; right: -4px;
  width: 20px; height: 20px; border-radius: 50%; background: #89bf39;
  color: white; font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid white;
}

/* WIDGET */
#hh-chat-widget {
  position: fixed; bottom: 100px; right: 28px; z-index: 9001;
  width: 380px; max-height: 600px;
  display: flex; flex-direction: column;
  background: white; border-radius: 20px;
  box-shadow: 0 20px 60px rgba(26,58,74,0.22), 0 0 0 1px rgba(38,147,205,0.1);
  overflow: hidden;
  transform: translateY(16px) scale(0.97); opacity: 0;
  transition: transform 0.4s cubic-bezier(0.34,1.56,0.64,1), opacity 0.3s ease;
}
#hh-chat-widget.visible { transform: translateY(0) scale(1); opacity: 1; }

/* HEADER */
#hh-chat-header {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 18px; background: #1a3a4a; flex-shrink: 0;
}
.hh-header-avatar {
  width: 42px; height: 42px; border-radius: 50%;
  background: white; display: flex; align-items: center; justify-content: center;
  overflow: hidden; flex-shrink: 0; position: relative;
}
.hh-header-avatar img { width: 38px; height: 38px; object-fit: contain; }
.hh-online-dot {
  position: absolute; bottom: 1px; right: 1px;
  width: 10px; height: 10px; border-radius: 50%;
  background: #89bf39; border: 2px solid #1a3a4a;
}
.hh-header-info { flex: 1; min-width: 0; }
.hh-header-name { font-size: 0.9rem; font-weight: 700; color: white; }
.hh-header-sub  { font-size: 0.72rem; color: rgba(255,255,255,0.55); margin-top: 1px; }
.hh-header-actions { display: flex; gap: 6px; }
.hh-header-actions button {
  width: 30px; height: 30px; border-radius: 50%; border: none;
  background: rgba(255,255,255,0.1); color: rgba(255,255,255,0.7);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  font-size: 0.9rem; transition: all 0.2s;
}
.hh-header-actions button:hover { background: rgba(255,255,255,0.2); color: white; }

/* MESSAGES */
#hh-messages {
  flex: 1; overflow-y: auto; padding: 16px 14px;
  display: flex; flex-direction: column; gap: 10px;
  background: #f0f8ff; scroll-behavior: smooth;
}
#hh-messages::-webkit-scrollbar { width: 4px; }
#hh-messages::-webkit-scrollbar-thumb { background: rgba(38,147,205,0.2); border-radius: 4px; }

/* MESSAGE BUBBLES */
.hh-msg { display: flex; align-items: flex-end; gap: 8px; max-width: 88%; animation: hh-msg-in 0.3s ease; }
.hh-msg.bot { align-self: flex-start; }
.hh-msg.user { align-self: flex-end; flex-direction: row-reverse; }
@keyframes hh-msg-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.hh-avatar-sm {
  width: 28px; height: 28px; border-radius: 50%; background: #2693cd;
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 0.7rem; font-weight: 700; flex-shrink: 0;
}
.hh-bubble {
  padding: 10px 14px; border-radius: 16px; font-size: 0.87rem;
  line-height: 1.55; max-width: 100%;
}
.bot .hh-bubble {
  background: white; color: #1f3040;
  border-radius: 4px 16px 16px 16px;
  box-shadow: 0 1px 4px rgba(38,147,205,0.1);
}
.user .hh-bubble {
  background: linear-gradient(135deg, #2693cd, #1a78ad); color: white;
  border-radius: 16px 4px 16px 16px;
}
.hh-bubble a { color: #2693cd; text-decoration: underline; }
.user .hh-bubble a { color: #c8e8f8; }
.hh-time {
  font-size: 0.65rem; color: #9bb; margin-top: 3px;
  text-align: right; padding: 0 4px;
}
.bot .hh-time { text-align: left; }

/* TYPING INDICATOR */
.hh-typing { display: flex; gap: 4px; align-items: center; padding: 12px 14px; }
.hh-dot { width: 7px; height: 7px; border-radius: 50%; background: #2693cd;
  animation: hh-bounce 1.2s ease infinite; }
.hh-dot:nth-child(2) { animation-delay: 0.2s; }
.hh-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes hh-bounce {
  0%,60%,100% { transform: translateY(0); opacity: 0.5; }
  30%          { transform: translateY(-6px); opacity: 1; }
}

/* QUICK REPLIES */
#hh-quick-replies {
  padding: 8px 14px 6px; display: flex; flex-wrap: wrap; gap: 6px;
  background: white; border-top: 1px solid rgba(38,147,205,0.1);
  max-height: 110px; overflow-y: auto;
}
.hh-chip {
  padding: 6px 12px; border-radius: 20px; font-size: 0.78rem; font-weight: 600;
  background: rgba(38,147,205,0.08); color: #2693cd;
  border: 1px solid rgba(38,147,205,0.25); cursor: pointer;
  transition: all 0.18s ease; white-space: nowrap;
}
.hh-chip:hover { background: #2693cd; color: white; transform: translateY(-1px); }
.hh-chip.green { background: rgba(137,191,57,0.1); color: #4a7a0a; border-color: rgba(137,191,57,0.3); }
.hh-chip.green:hover { background: #89bf39; color: white; }

/* INPUT BAR */
#hh-input-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px; background: white;
  border-top: 1px solid rgba(38,147,205,0.1); flex-shrink: 0;
}
#hh-input {
  flex: 1; padding: 9px 14px; border: 1.5px solid rgba(38,147,205,0.2);
  border-radius: 22px; font-size: 0.87rem; font-family: inherit;
  outline: none; transition: border-color 0.2s;
}
#hh-input:focus { border-color: #2693cd; }
#hh-send {
  width: 38px; height: 38px; border-radius: 50%; border: none;
  background: #2693cd; color: white; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; transition: all 0.2s cubic-bezier(0.34,1.56,0.64,1);
}
#hh-send:hover { background: #1a78ad; transform: scale(1.08); }

/* FOOTER */
#hh-chat-footer {
  text-align: center; padding: 6px; font-size: 0.68rem;
  color: #9bb; background: white; border-top: 1px solid rgba(38,147,205,0.06);
  flex-shrink: 0;
}

/* CTA BUTTON INSIDE BUBBLE */
.hh-cta {
  display: inline-block; margin-top: 8px; padding: 8px 16px;
  background: linear-gradient(135deg, #89bf39, #6ea82a); color: white;
  border-radius: 20px; font-size: 0.82rem; font-weight: 700;
  cursor: pointer; border: none; text-decoration: none;
  transition: all 0.2s ease;
}
.hh-cta:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(137,191,57,0.35); }

/* SYMPTOM CHECKER FORM */
.hh-form { background: #f0f8ff; border-radius: 12px; padding: 12px; margin-top: 6px; }
.hh-form-row { margin-bottom: 10px; }
.hh-form-label { font-size: 0.78rem; font-weight: 600; color: #1a3a4a; margin-bottom: 4px; display: block; }
.hh-form-input, .hh-form-select {
  width: 100%; padding: 7px 10px; border: 1.5px solid rgba(38,147,205,0.2);
  border-radius: 8px; font-size: 0.82rem; font-family: inherit; outline: none;
}
.hh-form-input:focus, .hh-form-select:focus { border-color: #2693cd; }
.hh-pain-slider { width: 100%; accent-color: #2693cd; }
.hh-pain-labels { display: flex; justify-content: space-between; font-size: 0.68rem; color: #9bb; }

/* MOBILE */
@media(max-width: 480px) {
  #hh-chat-widget { width: calc(100vw - 20px); right: 10px; bottom: 80px; max-height: 75vh; }
  #hh-chat-fab { bottom: 16px; right: 16px; }
}

/* MINIMIZED STATE */
#hh-chat-widget.minimized #hh-messages,
#hh-chat-widget.minimized #hh-quick-replies,
#hh-chat-widget.minimized #hh-input-bar,
#hh-chat-widget.minimized #hh-chat-footer { display: none; }
#hh-chat-widget.minimized { max-height: 64px; }
