/* ===================================================================
   HLI AI CHATBOT ADVISOR | LUXURY GLASSMORPHISM DESIGN SYSTEM
   Dual-Wing Interactive Intelligence (Advertising + Medical)
   =================================================================== */

/* Floating Launcher Trigger (Bottom-Left to avoid conflict with right actions) */
.hli-chat-trigger {
  position: fixed;
  bottom: 2rem;
  left: 2rem;
  z-index: 999;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  background: linear-gradient(135deg, rgba(14, 21, 38, 0.95), rgba(99, 102, 241, 0.25));
  border: 1px solid rgba(139, 92, 246, 0.45);
  backdrop-filter: blur(16px);
  padding: 0.65rem 1.25rem 0.65rem 0.75rem;
  border-radius: var(--radius-full);
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.7), 0 0 25px rgba(99, 102, 241, 0.35);
  cursor: pointer;
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
}

.hli-chat-trigger:hover {
  transform: translateY(-4px) scale(1.03);
  border-color: var(--gold-light);
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.85), 0 0 30px var(--gold-glow);
}

.chat-trigger-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--indigo-primary), var(--violet-vivid));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 1.2rem;
  box-shadow: 0 0 15px var(--indigo-glow);
}

.chat-trigger-label {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.chat-trigger-title {
  font-family: var(--font-heading);
  font-size: 0.92rem;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: 0.02em;
}

.chat-trigger-sub {
  font-size: 0.72rem;
  color: var(--emerald-light);
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.pulse-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--emerald-impact);
  box-shadow: 0 0 8px var(--emerald-glow);
  animation: pulseGreen 2s infinite;
}

@keyframes pulseGreen {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

.chat-trigger-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--rose-vivid);
  color: #ffffff;
  font-size: 0.7rem;
  font-weight: 800;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg-dark);
}

/* Chat Modal Container */
.hli-chat-modal {
  position: fixed;
  bottom: 5.5rem;
  left: 2rem;
  width: 410px;
  max-width: calc(100vw - 3rem);
  height: 600px;
  max-height: calc(100vh - 7rem);
  background: #090e1c;
  border: 1px solid rgba(139, 92, 246, 0.4);
  border-radius: var(--radius-lg);
  box-shadow: 0 25px 70px rgba(0, 0, 0, 0.9), 0 0 50px rgba(99, 102, 241, 0.25);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  overflow: hidden;
  backdrop-filter: blur(25px);
  animation: chatModalSlideIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes chatModalSlideIn {
  from {
    opacity: 0;
    transform: translateY(25px) scale(0.94);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Header */
.chat-header {
  padding: 1rem 1.25rem;
  background: linear-gradient(90deg, rgba(17, 24, 44, 0.98), rgba(15, 23, 42, 0.98));
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chat-header-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.chat-avatar {
  position: relative;
  width: 40px;
  height: 40px;
}

.chat-avatar img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #ffffff;
  padding: 2px;
  border-radius: 10px;
}

.chat-avatar-status {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--emerald-impact);
  border: 2px solid #090e1c;
}

.chat-header-title {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 800;
  color: #ffffff;
  margin: 0;
  line-height: 1.2;
}

.chat-header-subtitle {
  font-size: 0.74rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.status-indicator {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--medical-cyan);
}

.chat-header-controls {
  display: flex;
  gap: 0.4rem;
}

.chat-control-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-size: 0.85rem;
}

.chat-control-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
}

/* Wing Switcher Tabs */
.chat-wing-switcher {
  display: flex;
  background: rgba(10, 15, 29, 0.9);
  padding: 0.35rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  gap: 0.35rem;
}

.chat-wing-tab {
  flex: 1;
  padding: 0.45rem 0.5rem;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 700;
  border-radius: var(--radius-xs);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  transition: all var(--transition-fast);
}

.chat-wing-tab.active {
  background: rgba(99, 102, 241, 0.2);
  color: #ffffff;
  border-color: rgba(99, 102, 241, 0.4);
}

.chat-wing-tab[data-wing="medical"].active {
  background: rgba(6, 182, 212, 0.2);
  border-color: rgba(6, 182, 212, 0.4);
  color: var(--medical-light);
}

/* Messages Feed */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  scroll-behavior: smooth;
}

.chat-messages::-webkit-scrollbar {
  width: 5px;
}
.chat-messages::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}

/* Message Bubbles */
.chat-msg {
  display: flex;
  gap: 0.65rem;
  max-width: 90%;
  animation: fadeInMsg 0.3s ease-out;
}

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

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

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

.chat-msg-avatar {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--indigo-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  color: #fff;
  flex-shrink: 0;
}

.chat-msg.bot .chat-msg-avatar {
  background: linear-gradient(135deg, #6366f1, #06b6d4);
}

.chat-msg.user .chat-msg-avatar {
  background: linear-gradient(135deg, #f59e0b, #f43f5e);
}

.chat-bubble {
  padding: 0.75rem 1rem;
  border-radius: 14px;
  font-size: 0.88rem;
  line-height: 1.5;
  color: #f1f5f9;
  position: relative;
  word-break: break-word;
}

.chat-msg.bot .chat-bubble {
  background: rgba(18, 27, 49, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-top-left-radius: 4px;
}

.chat-msg.user .chat-bubble {
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  color: #ffffff;
  border-top-right-radius: 4px;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.chat-msg-time {
  font-size: 0.65rem;
  color: var(--text-dim);
  margin-top: 0.3rem;
  text-align: right;
}

/* Typing Indicator Animation */
.chat-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0.6rem 0.9rem;
  background: rgba(18, 27, 49, 0.85);
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  width: fit-content;
}

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

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

@keyframes typingBounce {
  0%, 80%, 100% { transform: scale(0); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

/* Action Chips */
.chat-quick-chips {
  padding: 0.5rem 0.85rem;
  display: flex;
  gap: 0.4rem;
  overflow-x: auto;
  white-space: nowrap;
  background: rgba(6, 10, 20, 0.8);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.chat-quick-chips::-webkit-scrollbar {
  display: none;
}

.chip-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-body);
  font-size: 0.74rem;
  font-weight: 600;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.chip-btn:hover {
  background: rgba(99, 102, 241, 0.25);
  color: #ffffff;
  border-color: var(--indigo-light);
}

/* Input Bar */
.chat-input-bar {
  display: flex;
  padding: 0.75rem 1rem;
  background: rgba(14, 21, 38, 0.98);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  gap: 0.6rem;
  align-items: center;
}

.chat-input-bar input {
  flex: 1;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 0.65rem 0.95rem;
  border-radius: var(--radius-full);
  color: #ffffff;
  font-size: 0.88rem;
  outline: none;
  transition: border-color var(--transition-fast);
}

.chat-input-bar input:focus {
  border-color: var(--indigo-light);
  box-shadow: 0 0 12px var(--indigo-glow);
}

.chat-input-bar button {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold-light), var(--rose-vivid));
  border: none;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.chat-input-bar button:hover {
  transform: scale(1.08);
  box-shadow: 0 0 15px var(--gold-glow);
}

.chat-footer-note {
  font-size: 0.68rem;
  color: var(--text-dim);
  text-align: center;
  padding: 0.35rem 0.5rem 0.5rem;
  background: rgba(14, 21, 38, 0.98);
}

/* Mobile Responsive Chat */
@media (max-width: 640px) {
  .hli-chat-trigger {
    left: 1rem;
    bottom: 1rem;
    padding: 0.5rem 0.95rem 0.5rem 0.5rem;
  }
  .chat-trigger-icon {
    width: 38px;
    height: 38px;
    font-size: 1rem;
  }
  .hli-chat-modal {
    left: 0.5rem;
    right: 0.5rem;
    bottom: 4.8rem;
    width: auto;
    max-width: none;
    height: 520px;
  }
}
