/* ==========================================================================
   BEING WELL HOMOEOPATHIC CLINIC - INTERACTIVE CLINIC ASSISTANT CHATBOT
   ========================================================================== */

:root {
  --bw-chat-primary: #0056b3;
  --bw-chat-primary-hover: #004494;
  --bw-chat-navy: #0B2545;
  --bw-chat-navy-dark: #071a33;
  --bw-chat-teal: #0d9488;
  --bw-chat-green: #198754;
  --bw-chat-bg: #f8fafc;
  --bw-chat-border: #e2e8f0;
  --bw-chat-text: #1e293b;
  --bw-chat-muted: #64748b;
  --bw-chat-shadow: 0 16px 40px rgba(11, 37, 69, 0.28);
}

/* Floating Scroll To Top Dock */
.floating-actions-dock,
.floating-actions-stack {
  position: fixed !important;
  bottom: 24px !important;
  right: 24px !important;
  z-index: 99999 !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  gap: 10px !important;
  pointer-events: none !important;
}

.floating-btn-scroll {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background-color: var(--bw-chat-primary);
  color: #ffffff !important;
  border: 2px solid #ffffff;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  cursor: pointer;
  transition: all 0.25s ease;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(10px);
}

.floating-btn-scroll.visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto !important;
  transform: translateY(0);
}

.floating-btn-scroll:hover {
  background-color: var(--bw-chat-navy);
  color: #ffffff !important;
  transform: translateY(-3px) scale(1.06);
  box-shadow: 0 6px 18px rgba(0, 86, 179, 0.4);
}

/* Floating Chatbot Widget Launcher (Positioned directly ABOVE Scroll-to-Top Button) */
.clinic-chat-widget {
  position: fixed !important;
  bottom: 84px !important;
  right: 24px !important;
  z-index: 9999999 !important;
  display: block !important;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
  user-select: none;
}

/* Prominent Floating Pill Launcher Button */
.chat-launcher-btn {
  height: 50px !important;
  padding: 0 20px 0 16px !important;
  border-radius: 30px !important;
  background: linear-gradient(135deg, #0056b3 0%, #0B2545 100%) !important;
  color: #ffffff !important;
  border: 2px solid #ffffff !important;
  box-shadow: 0 8px 26px rgba(0, 86, 179, 0.45), 0 4px 10px rgba(0, 0, 0, 0.12) !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 10px !important;
  cursor: pointer !important;
  position: relative !important;
  transition: transform 0.25s ease, box-shadow 0.25s ease !important;
  outline: none !important;
  text-decoration: none !important;
}

.chat-launcher-btn:hover {
  transform: translateY(-3px) scale(1.03) !important;
  box-shadow: 0 12px 32px rgba(0, 86, 179, 0.6) !important;
}

.chat-launcher-btn:active {
  transform: scale(0.97) !important;
}

.chat-launcher-icon {
  font-size: 1.3rem !important;
  color: #38bdf8 !important;
  line-height: 1 !important;
}

.chat-launcher-text {
  font-size: 0.9rem !important;
  font-weight: 700 !important;
  color: #ffffff !important;
  white-space: nowrap !important;
  letter-spacing: -0.2px !important;
}

/* Online Pulse Dot */
.chat-pulse-indicator {
  position: absolute;
  top: -3px;
  right: -3px;
  width: 14px;
  height: 14px;
  display: flex;
}

.chat-pulse-ping {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background-color: #20c997;
  opacity: 0.75;
  animation: chat-ping 1.6s cubic-bezier(0, 0, 0.2, 1) infinite;
}

.chat-pulse-dot {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background-color: #20c997;
  border: 2px solid #ffffff;
}

@keyframes chat-ping {
  75%, 100% {
    transform: scale(2.2);
    opacity: 0;
  }
}

/* Launcher Tooltip */
.chat-launcher-tooltip {
  position: absolute;
  right: 0;
  bottom: 62px;
  background: var(--bw-chat-navy);
  color: #ffffff;
  padding: 7px 13px;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: 0 4px 14px rgba(0,0,0,0.2);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}

.chat-launcher-tooltip::after {
  content: "";
  position: absolute;
  bottom: -6px;
  right: 24px;
  border-width: 6px 6px 0 6px;
  border-style: solid;
  border-color: var(--bw-chat-navy) transparent transparent transparent;
}

.clinic-chat-widget:hover .chat-launcher-tooltip {
  opacity: 1;
  visibility: visible;
  transform: translateY(-4px);
}

/* Hide Launcher Pill button when Chatbot Modal is Active/Open */
.clinic-chat-widget.active .chat-launcher-btn {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
  transform: scale(0.8) translateY(10px) !important;
}

.clinic-chat-widget.active .chat-launcher-tooltip {
  opacity: 0 !important;
  visibility: hidden !important;
}

/* Chat Dialog Panel */
.chat-dialog-panel {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 385px;
  max-width: calc(100vw - 32px);
  height: 570px;
  max-height: calc(100vh - 100px);
  background: #ffffff;
  border-radius: 16px;
  box-shadow: var(--bw-chat-shadow);
  border: 1px solid rgba(11, 37, 69, 0.15);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.95);
  transition: opacity 0.25s ease, transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.25s;
  transform-origin: bottom right;
}

.clinic-chat-widget.active .chat-dialog-panel {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* Chat Header */
.chat-header {
  background: var(--bw-chat-navy);
  color: #ffffff;
  padding: 13px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 3px solid var(--bw-chat-primary);
}

.chat-header-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chat-avatar-wrap {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #ffffff;
  padding: 4px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.chat-header-info h4 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.2;
}

.chat-header-info span {
  font-size: 0.72rem;
  color: #94a3b8;
  display: flex;
  align-items: center;
  gap: 5px;
}

.chat-header-info span::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #20c997;
}

.chat-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.chat-header-btn {
  background: rgba(255, 255, 255, 0.12);
  border: none;
  color: #ffffff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s ease;
}

.chat-header-btn:hover {
  background: rgba(255, 255, 255, 0.28);
}

/* Quick Action Top Bar */
.chat-quick-actions {
  background: #f1f5f9;
  padding: 8px 12px;
  display: flex;
  gap: 6px;
  border-bottom: 1px solid var(--bw-chat-border);
  overflow-x: auto;
}

.chat-quick-btn {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: var(--bw-chat-navy);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 12px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.chat-quick-btn:hover {
  background: var(--bw-chat-primary);
  color: #ffffff;
  border-color: var(--bw-chat-primary);
}

/* Auto-Sliding High-Yield Clinical Topics Bar */
.chat-high-yield-bar {
  background: #0B2545 !important;
  padding: 8px 0 !important;
  overflow: hidden !important;
  position: relative !important;
  border-bottom: 1px solid #1e3a5f !important;
  display: flex !important;
  align-items: center !important;
  user-select: none;
}

.chat-high-yield-track {
  display: flex;
  gap: 8px;
  animation: chat-ticker-slide 28s linear infinite;
  white-space: nowrap;
  will-change: transform;
}

.chat-high-yield-track:hover,
.chat-high-yield-track:active {
  animation-play-state: paused;
}

.chat-high-yield-chip {
  background: rgba(0, 86, 179, 0.4) !important;
  border: 1px solid rgba(56, 189, 248, 0.55) !important;
  color: #38bdf8 !important;
  font-size: 0.74rem !important;
  font-weight: 600 !important;
  padding: 4px 12px !important;
  border-radius: 14px !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 5px !important;
  white-space: nowrap !important;
  flex-shrink: 0;
}

.chat-high-yield-chip:hover {
  background: #0056b3 !important;
  color: #ffffff !important;
  border-color: #ffffff !important;
  transform: scale(1.05) !important;
}

@keyframes chat-ticker-slide {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* Messages Body */
.chat-messages {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: #f8fafc;
  scroll-behavior: smooth;
  position: relative;
}

.chat-msg-row {
  display: flex;
  flex-direction: column;
  max-width: 88%;
  scroll-margin-top: 10px;
}

.chat-msg-row.user {
  align-self: flex-end;
}

.chat-msg-row.bot {
  align-self: flex-start;
}

.chat-bubble {
  padding: 12px 14px;
  border-radius: 14px;
  font-size: 0.84rem;
  line-height: 1.5;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  word-break: break-word;
}

.chat-msg-row.user .chat-bubble {
  background: var(--bw-chat-primary);
  color: #ffffff;
  border-bottom-right-radius: 2px;
}

.chat-msg-row.bot .chat-bubble {
  background: #ffffff;
  color: var(--bw-chat-text);
  border: 1px solid var(--bw-chat-border);
  border-bottom-left-radius: 2px;
}

.chat-msg-row.bot .chat-bubble strong {
  color: var(--bw-chat-navy);
}

.chat-chip-container {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.chat-chip-btn {
  background: #ffffff;
  border: 1px solid var(--bw-chat-primary);
  color: var(--bw-chat-primary);
  font-size: 0.74rem;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: left;
}

.chat-chip-btn:hover {
  background: var(--bw-chat-primary);
  color: #ffffff;
}

/* Link Cards inside chat */
.chat-link-card {
  display: block;
  margin-top: 8px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1d4ed8;
  padding: 8px 12px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.8rem;
  text-decoration: none;
  transition: background 0.15s ease;
}

.chat-link-card:hover {
  background: #dbeafe;
}

/* Typing Indicator */
.chat-typing-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  background: #ffffff;
  padding: 10px 14px;
  border-radius: 14px;
  border-bottom-left-radius: 2px;
  border: 1px solid var(--bw-chat-border);
  width: fit-content;
  align-self: flex-start;
}

.chat-typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--bw-chat-muted);
  animation: chat-bounce 1.4s infinite ease-in-out both;
}

.chat-typing-dot:nth-child(1) { animation-delay: -0.32s; }
.chat-typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes chat-bounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

/* Input Footer */
.chat-footer {
  padding: 12px;
  background: #ffffff;
  border-top: 1px solid var(--bw-chat-border);
}

.chat-input-form {
  display: flex;
  gap: 8px;
  align-items: center;
}

.chat-input-field {
  flex: 1;
  border: 1px solid #cbd5e1;
  border-radius: 20px;
  padding: 8px 14px;
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.2s ease;
}

.chat-input-field:focus {
  border-color: var(--bw-chat-primary);
}

.chat-send-btn {
  background: var(--bw-chat-primary);
  color: #ffffff;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s ease;
}

.chat-send-btn:hover {
  background: var(--bw-chat-primary-hover);
}

@media (max-width: 480px) {
  .floating-actions-dock,
  .floating-actions-stack {
    bottom: 16px !important;
    right: 16px !important;
  }
  .clinic-chat-widget {
    bottom: 74px !important;
    right: 16px !important;
  }
  .chat-launcher-btn {
    height: 46px !important;
    padding: 0 16px 0 12px !important;
  }
  .chat-launcher-text {
    font-size: 0.82rem !important;
  }
  .chat-dialog-panel {
    bottom: 0;
    right: 0;
    width: calc(100vw - 32px);
    height: 520px;
  }
}
