@import url(https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Poppins:wght@400;500;600;700&display=swap);
@import url(https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap);
/* Enterprise-Level KaireAI ChatBot Styles - Enhanced */

/* Advanced CSS Custom Properties */
:root {
  /* Enterprise Color Palette */
  --primary-blue: #2563eb;
  --primary-blue-dark: #1d4ed8;
  --primary-blue-light: #60a5fa;
  --secondary-purple: #7c3aed;
  --accent-green: #059669;
  --accent-orange: #ea580c;
  --accent-red: #dc2626;
  
  /* Healthcare-specific colors */
  --healthcare-primary: #0891b2;
  --healthcare-secondary: #06b6d4;
  --healthcare-accent: #10b981;
  --healthcare-warm: #f59e0b;
  
  /* Sophisticated Grays */
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --gray-900: #0f172a;
  
  /* Glassmorphism Effects */
  --glass-bg: rgba(255, 255, 255, 0.95);
  --glass-bg-dark: rgba(15, 23, 42, 0.95);
  --glass-border: rgba(255, 255, 255, 0.2);
  --glass-shadow: rgba(15, 23, 42, 0.1);
  --backdrop-blur: blur(20px) saturate(180%);
  
  /* Premium Gradients */
  --gradient-primary: linear-gradient(135deg, var(--healthcare-primary) 0%, var(--healthcare-secondary) 100%);
  --gradient-secondary: linear-gradient(135deg, var(--secondary-purple) 0%, var(--primary-blue) 100%);
  --gradient-success: linear-gradient(135deg, var(--healthcare-accent) 0%, var(--accent-green) 100%);
  --gradient-warning: linear-gradient(135deg, var(--healthcare-warm) 0%, var(--accent-orange) 100%);
  --gradient-ai: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  --gradient-overlay: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0.05) 100%);
  
  /* Typography Scale */
  --font-primary: 'Inter', 'SF Pro Display', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-accent: 'Poppins', 'Inter', sans-serif;
  
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;
  
  /* Spacing Scale */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  
  /* Border Radius Scale */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-2xl: 1.5rem;
  --radius-full: 50%;
  
  /* Shadow Scale */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07), 0 2px 4px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1), 0 4px 6px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.1), 0 10px 10px rgba(0, 0, 0, 0.04);
  --shadow-2xl: 0 25px 50px rgba(0, 0, 0, 0.25);
  
  /* Enhanced Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-bounce: 400ms cubic-bezier(0.68, -0.55, 0.265, 1.55);
  --transition-spring: 300ms cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Advanced Keyframes */
@keyframes slideInUp {
  0% {
    opacity: 0;
    transform: translateY(30px) scale(0.95);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes slideInRight {
  0% {
    opacity: 0;
    transform: translateX(-30px) scale(0.95);
  }
  100% {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

@keyframes fadeInScale {
  0% {
    opacity: 0;
    transform: scale(0.9);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes pulseGlow {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.4);
  }
  50% {
    box-shadow: 0 0 0 10px rgba(37, 99, 235, 0);
  }
}

@keyframes typingDots {
  0%, 60%, 100% {
    opacity: 0.3;
    transform: translateY(0) scale(1);
  }
  30% {
    opacity: 1;
    transform: translateY(-8px) scale(1.2);
  }
}

@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

@keyframes heartbeat {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

@keyframes buttonPress {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(0.98);
  }
  100% {
    transform: scale(1);
  }
}

/* Main Container */
.chatbot-container {
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--glass-bg);
  backdrop-filter: var(--backdrop-blur);
  font-family: var(--font-primary);
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-2xl);
  border: 1px solid var(--glass-border);
  transition: all var(--transition-base);
  padding-bottom: 0;
  box-sizing: border-box;
  min-height: 0; /* Add this */
}

/* Connection Status Indicator */
.connection-status {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  background: var(--gray-100);
  border-bottom: 1px solid var(--gray-200);
  font-size: var(--text-xs);
  font-weight: 500;
  transition: all var(--transition-base);
}

.connection-status.connected {
  background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
  color: var(--accent-green);
}

.connection-status.sending {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  color: var(--healthcare-warm);
}

.connection-status.error {
  background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
  color: var(--accent-red);
}

.status-indicator {
  width: 6px;
}

.messages-container::-webkit-scrollbar-track {
  background: transparent;
}

.messages-container::-webkit-scrollbar-thumb {
  background: var(--gray-300);
  border-radius: 3px;
}

.messages-container::-webkit-scrollbar-thumb:hover {
  background: var(--gray-400);
}

/* Enhanced Welcome Message */
.welcome-message {
  text-align: center;
  padding: var(--space-12) var(--space-6);
  color: var(--gray-600);
  animation: fadeInScale var(--transition-slow) ease-out;
}

.bot-avatar-large {
  width: 100px;
  height: 100px;
  margin: 0 auto var(--space-6);
  background: var(--gradient-primary);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-xl);
  border: 4px solid rgba(255, 255, 255, 0.3);
  position: relative;
  animation: heartbeat 3s ease-in-out infinite;
  overflow: hidden;
}

.bot-avatar-large img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--radius-full);
}

.bot-avatar-large::before {
  content: '';
  position: absolute;
  top: -4px;
  left: -4px;
  right: -4px;
  bottom: -4px;
  background: var(--gradient-primary);
  border-radius: var(--radius-full);
  z-index: -1;
  filter: blur(10px);
  opacity: 0.6;
}

.welcome-message h3 {
  margin: 0 0 var(--space-4) 0;
  color: var(--gray-800);
  font-size: var(--text-2xl);
  font-weight: 700;
  font-family: var(--font-accent);
  line-height: 1.2;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.welcome-message p {
  margin: 0 0 var(--space-8) 0;
  font-size: var(--text-base);
  line-height: 1.6;
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
  color: var(--gray-600);
}

.welcome-features {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin: var(--space-6) 0 var(--space-8) 0;
}

.feature-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: rgba(255, 255, 255, 0.5);
  border-radius: var(--radius-lg);
  border: 1px solid var(--gray-200);
  transition: all var(--transition-base);
}

.feature-item:hover {
  background: rgba(255, 255, 255, 0.8);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.feature-icon {
  font-size: var(--text-lg);
}

/* Enhanced Welcome Buttons */
.welcome-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
  margin-top: var(--space-8);
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
}

.welcome-button {
  background: var(--glass-bg);
  backdrop-filter: var(--backdrop-blur);
  border: 2px solid var(--glass-border);
  border-radius: var(--radius-xl);
  padding: var(--space-5) var(--space-6);
  cursor: pointer;
  transition: all var(--transition-spring);
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--gray-700);
  outline: none;
  position: relative;
  overflow: hidden;
  font-family: var(--font-primary);
  text-align: center;
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
  line-height: 1.3;
}

.welcome-button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
  transition: left var(--transition-base);
}

.welcome-button:hover {
  background: var(--gradient-primary);
  border-color: var(--healthcare-primary);
  color: white;
  transform: translateY(-3px) scale(1.02);
  box-shadow: var(--shadow-xl);
}

.welcome-button:hover::before {
  left: 100%;
}

.welcome-button:active {
  transform: translateY(-1px) scale(0.99);
  animation: buttonPress 0.15s ease;
}

.welcome-button:focus-visible {
  outline: 2px solid var(--primary-blue);
  outline-offset: 2px;
}

/* Message Styling */
.message {
  display: flex;
  flex-direction: column;
  max-width: 100%;
  animation: slideInUp var(--transition-base) ease-out;
}

.message.user {
  align-items: flex-end;
}

.message.bot {
  align-items: flex-start;
}

.message-wrapper {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  max-width: 85%;
  position: relative;
}

.message.user .message-wrapper {
  margin-left: auto;
  flex-direction: row-reverse;
}

.message-avatar {
  flex-shrink: 0;
  margin-top: var(--space-1);
}

/* Bot Avatar */
.bot-avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background: var(--gradient-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
  border: 2px solid rgba(255, 255, 255, 0.3);
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
}

.bot-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--radius-full);
}

.bot-avatar::before {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  background: var(--gradient-primary);
  border-radius: var(--radius-full);
  z-index: -1;
  filter: blur(6px);
  opacity: 0.4;
}

.bot-avatar:hover {
  transform: scale(1.05);
  box-shadow: var(--shadow-lg);
}


.ai-avatar::before {
  background: var(--gradient-ai) !important;
}

/* Message Bubble */
.message-bubble {
  max-width: 100%;
  min-width: 0;
  position: relative;
}

.message-content {
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-xl);
  word-wrap: break-word;
  line-height: 1.6;
  font-size: var(--text-sm);
  position: relative;
  transition: all var(--transition-base);
  font-weight: 400;
}

.message-text {
  margin: 0;
}

.message-line {
  margin-bottom: var(--space-2);
}

.message-line:last-child {
  margin-bottom: 0;
}

/* User Messages */
.message.user .message-content {
  background: var(--gradient-primary);
  color: white;
  border-bottom-right-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
}

.message.user .message-content::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--gradient-overlay);
  pointer-events: none;
}

.message.user .message-content::after {
  content: '';
  position: absolute;
  bottom: 0;
  right: -8px;
  width: 0;
  height: 0;
  border: 8px solid transparent;
  border-left-color: var(--healthcare-primary);
  border-bottom: none;
  border-right: none;
}

/* Bot Messages */
.message.bot .message-content {
  background: var(--glass-bg);
  backdrop-filter: var(--backdrop-blur);
  color: var(--gray-800);
  border: 1px solid var(--glass-border);
  border-bottom-left-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  position: relative;
}

.message.bot .message-content::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: -9px;
  width: 0;
  height: 0;
  border: 8px solid transparent;
  border-right-color: var(--glass-bg);
  border-bottom: none;
  border-left: none;
  filter: drop-shadow(-1px 0 0 var(--glass-border));
}



.message.ai-response .message-content::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--gradient-ai);
  opacity: 0.03;
  border-radius: inherit;
  pointer-events: none;
}




/* Enhanced Buttons Layout */
.message-buttons {
  display: grid;
  grid-template-columns: 1fr;  /* Changed from repeat(2, 1fr) to 1fr */
  gap: var(--space-3);
  margin-top: var(--space-4);
  padding: 0;
}

.message-buttons.many-buttons {
  grid-template-columns: 1fr;  /* Changed from repeat(3, 1fr) to 1fr */
  gap: var(--space-2);
}


.chat-button {
 background: linear-gradient(135deg, 
    rgba(8, 145, 178, 0.08) 0%, 
    rgba(6, 182, 212, 0.08) 100%);
  backdrop-filter: var(--backdrop-blur);
  border: 2px solid rgba(8, 145, 178, 0.25);
  border-radius: var(--radius-xl);
  padding: 12px var(--space-5);
  cursor: pointer;
  transition: all var(--transition-spring);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--gray-700);
  outline: none;
  position: relative;
  overflow: hidden;
  font-family: var(--font-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 40px;
  text-align: center;
  white-space: normal;
  word-wrap: break-word;
  box-shadow: var(--shadow-md);
}

.chat-button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
  transition: left var(--transition-base);
}

.chat-button:hover {
  background: var(--gradient-primary);
  border-color: var(--healthcare-primary);
  color: white;
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.chat-button:hover::before {
  left: 100%;
}

.chat-button:active {
  background: var(--gradient-primary);
  border-color: var(--healthcare-primary);
  color: white;
  transform: translateY(0) scale(0.96);
  box-shadow: var(--shadow-lg);
  animation: buttonPress 0.15s ease;
}

.chat-button:focus-visible {
  outline: 2px solid var(--primary-blue);
  outline-offset: 2px;
}

/* AI Button Special Styling */


.ai-button:hover {
  background: var(--gradient-ai);
  border-color: rgba(99, 102, 241, 0.5);
  color: white;
  box-shadow: 0 0 20px rgba(99, 102, 241, 0.3);
}

.button-text {
  flex: 1;
  line-height: 1.3;
}

.button-icon {
  font-size: var(--text-xs);
  opacity: 0.7;
  flex-shrink: 0;
}

/* URL buttons */
.chat-button.url {
  background: linear-gradient(135deg, var(--accent-green) 0%, var(--healthcare-accent) 100%);
  color: white;
  border-color: transparent;
}

.chat-button.url:hover {
  background: linear-gradient(135deg, var(--healthcare-accent) 0%, var(--accent-green) 100%);
  color: white;
}

/* Responsive Button Layout */
@media (max-width: 480px) {
 .message-buttons {
    grid-template-columns: 1fr;
    gap: var(--space-2);
  }
  
  .welcome-buttons {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 481px) and (max-width: 768px) {
  .message-buttons {
    grid-template-columns: 1fr;
    gap: var(--space-2);
  }
}

/* Rich Content Components remain the same but with enhanced transitions */
.message-cards,
.message-carousels,
.message-lists,
.message-images {
  animation: slideInUp var(--transition-base) ease-out;
  animation-delay: 0.1s;
  animation-fill-mode: both;
}

/* Typing Indicator */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-2) 0;
}

.typing-dots {
  display: flex;
  gap: var(--space-2);
}

.typing-dots span {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--gradient-primary);
  animation: typingDots 1.6s infinite;
  box-shadow: var(--shadow-sm);
}

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

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

.typing-text {
  font-size: var(--text-sm);
  color: var(--gray-500);
  font-style: italic;
}

/* Chat Footer */
.chat-footer {
  padding: var(--space-6);
  background: var(--glass-bg);
  backdrop-filter: var(--backdrop-blur);
  border-top: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  position: relative;
  transition: all var(--transition-base);
  box-sizing: border-box;
  flex-shrink: 0;
  min-height: auto;
  width: 100%;
}


.chat-footer::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--gradient-overlay);
  pointer-events: none;
}

.chat-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  z-index: 2;
}

.clear-chat-btn {
  background: linear-gradient(135deg, #ef4444 0%, #f87171 100%);
  border: none;
  color: white;
  font-size: var(--text-sm);
  cursor: pointer;
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-xl);
  transition: all var(--transition-spring);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  outline: none;
  font-family: var(--font-primary);
  font-weight: 600;
  box-shadow: 0 4px 20px rgba(239, 68, 68, 0.3);
}

.clear-chat-btn:hover {
  background: linear-gradient(135deg, #dc2626 0%, #ef4444 100%);
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 6px 25px rgba(239, 68, 68, 0.4);
}

.clear-chat-btn:active {
  animation: buttonPress 0.15s ease;
}

.btn-icon {
  width: 16px;
  height: 16px;
  stroke-width: 2;
}

/* Input Form */
.input-form {
  position: relative;
  z-index: 2;
}

.input-container {
  display: flex;
  align-items: flex-end;
  gap: var(--space-3);
  background: white;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-2xl);
  padding: var(--space-2);
  transition: all var(--transition-base);
  box-shadow: var(--shadow-sm);
}

.input-container:focus-within {
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1), var(--shadow-md);
}

.message-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-size: var(--text-sm);
  font-family: inherit;
  resize: none;
  max-height: 120px;
  min-height: 44px;
  padding: var(--space-3) var(--space-4);
  color: var(--gray-800);
  line-height: 1.5;
  transition: all var(--transition-base);
}

.message-input::placeholder {
  color: var(--gray-400);
  font-style: italic;
}

/* Voice Button */
.voice-button {
  background: var(--glass-bg);
  backdrop-filter: var(--backdrop-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-full);
  width: 44px;
  height: 44px;
  cursor: pointer;
  transition: all var(--transition-spring);
  outline: none;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: var(--text-lg);
  color: var(--gray-600);
  position: relative;
  overflow: hidden;
}

.voice-button::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--gradient-overlay);
  opacity: 0;
  transition: opacity var(--transition-base);
}

.voice-button:hover:not(:disabled) {
  background: var(--primary-blue-light);
  border-color: var(--primary-blue);
  color: white;
  transform: scale(1.05);
  box-shadow: var(--shadow-md);
}

.voice-button:hover:not(:disabled)::before {
  opacity: 1;
}

.voice-button:active:not(:disabled) {
  transform: scale(1.02);
  animation: buttonPress 0.15s ease;
}

.voice-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Listening State */
.voice-button.listening {
  background: linear-gradient(135deg, var(--accent-red) 0%, #ff6b6b 100%);
  border-color: var(--accent-red);
  color: white;
  animation: pulseGlow 1.5s ease-in-out infinite;
}

/* Send Button */
.send-button {
  background: var(--gradient-primary);
  color: white;
  border: none;
  border-radius: var(--radius-full);
  width: 44px;
  height: 44px;
  cursor: pointer;
  transition: all var(--transition-spring);
  outline: none;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}

.send-button::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--gradient-overlay);
  opacity: 0;
  transition: opacity var(--transition-base);
}

.send-button:hover:not(:disabled) {
  transform: scale(1.1);
  box-shadow: var(--shadow-lg);
  background: var(--gradient-secondary);
}

.send-button:hover:not(:disabled)::before {
  opacity: 1;
}

.send-button:active:not(:disabled) {
  transform: scale(1.05);
  animation: buttonPress 0.15s ease;
}

.send-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  animation: none;
}

.send-icon {
  font-size: var(--text-lg);
  font-weight: bold;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
  .chatbot-container {
    height: 100%;
    border-radius: var(--radius-xl);
  }
  
    .messages-container {
    padding: var(--space-4);
  }
  
  .message-wrapper {
    max-width: 95%;
  }
  
  .message-content {
    font-size: var(--text-sm);
    padding: var(--space-3) var(--space-4);
  }
  
 .chat-footer {
    padding: var(--space-4);
  }
  
  .welcome-message {
    padding: var(--space-8) var(--space-4);
  }
  
  .bot-avatar-large {
    width: 80px;
    height: 80px;
  }
  
  .input-container {
    padding: var(--space-2);
  }
  
  .voice-button,
  .send-button {
    width: 40px;
    height: 40px;
  }
  
 .welcome-buttons {
    grid-template-columns: 1fr;
    gap: var(--space-3);
    max-width: 100%;
  }
  
 .welcome-button {
    min-height: 60px;
    font-size: var(--text-sm);
    padding: var(--space-4) var(--space-5);
  }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  .welcome-button:hover {
    transform: none;
  }
  
  .chat-button:hover {
    transform: none;
  }
}
/* Messages Container */
.messages-container {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-4);
  background: transparent;
  scrollbar-width: thin;
  scrollbar-color: var(--gray-300) transparent;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  transition: all var(--transition-base);
  min-height: 0;
  height: 0; /* Important: Let flex handle the height */
}

.messages-container::-webkit-scrollbar {
  width: 8px;
}

.messages-container::-webkit-scrollbar-track {
  background: transparent;
}

.messages-container::-webkit-scrollbar-thumb {
  background: var(--gray-300);
  border-radius: 4px;
}

.messages-container::-webkit-scrollbar-thumb:hover {
  background: var(--gray-400);
}
.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background: currentColor;
  animation: pulseGlow 2s infinite;
}
.pulse-dot:nth-child(2) {
  animation-delay: 0.2s;
}
/* Priority Signup Button Styling */
.chat-button.priority-signup {
  background: linear-gradient(135deg, #0066FF 0%, #3385FF 100%) !important;
  border: 2px solid #0066FF !important;
  color: white !important;
  position: relative;
  overflow: hidden;
  animation: signupPulse 2s infinite;
  box-shadow: 0 8px 25px rgba(0, 102, 255, 0.4) !important;
  transform: scale(1.05);
  font-weight: 700;
  z-index: 10;
}

.chat-button.priority-signup::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  animation: shimmerSignup 1.5s infinite;
  z-index: 1;
}

.chat-button.priority-signup .button-text {
  position: relative;
  z-index: 2;
}

.chat-button.priority-signup:hover {
  background: linear-gradient(135deg, #0050CC 0%, #0066FF 100%) !important;
  transform: scale(1.08) !important;
  box-shadow: 0 12px 35px rgba(0, 102, 255, 0.6) !important;
}

.priority-indicator {
  font-size: 16px;
  margin-left: 8px;
  animation: sparkle 1s infinite;
  position: relative;
  z-index: 2;
}

/* Keyframes for signup button animations */
@keyframes signupPulse {
  0%, 100% {
    box-shadow: 0 8px 25px rgba(0, 102, 255, 0.4); /* 40% opacity */
  }
  50% {
    box-shadow: 0 8px 25px rgba(0, 102, 255, 0.7), 0 0 0 4px rgba(0, 102, 255, 0.2); /* 70% + outer ring 20% */
  }
}


@keyframes shimmerSignup {
  0% { left: -100%; }
  100% { left: 100%; }
}

@keyframes sparkle {
  0%, 100% { 
    opacity: 1; 
    transform: scale(1); 
  }
  50% { 
    opacity: 0.7; 
    transform: scale(1.2); 
  }
  
}
.kaireai-link {
  color: var(--primary-blue);
  text-decoration: none;
  font-weight: 600;
  border-bottom: 1px solid transparent;
  transition: all var(--transition-base);
  position: relative;
}

.kaireai-link:hover {
  color: var(--healthcare-primary);
  border-bottom-color: var(--healthcare-primary);
  text-decoration: none;
}

.kaireai-link:focus {
  outline: 2px solid var(--primary-blue);
  outline-offset: 2px;
}
/* Enhanced loading states */
.message.sending .message-content {
  opacity: 0.7;
  position: relative;
}

.message.sending .message-content::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
  animation: messageShimmer 1.5s infinite;
}

@keyframes messageShimmer {
  0% { left: -100%; }
  100% { left: 100%; }
}

/* Enhanced typing indicator */
.enhanced-typing-indicator {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-5);
  background: var(--glass-bg);
  border-radius: var(--radius-xl);
  margin: var(--space-2) 0;
  box-shadow: var(--shadow-sm);
}

.typing-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: var(--gradient-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: typingBounce 1s infinite;
}

@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-4px); }
}

/* Connection quality indicator */
.connection-quality {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-xs);
  opacity: 0.8;
}

.connection-bars {
  display: flex;
  gap: 1px;
}

.connection-bar {
  width: 3px;
  height: 8px;
  background: var(--gray-400);
  border-radius: 1px;
}

.connection-bar.active {
  background: var(--status-online);
}

.connection-bar.weak {
  background: var(--healthcare-warm);
}

.connection-bar.poor {
  background: var(--accent-red);
}

/* Smart retry button */
.smart-retry-btn {
  background: linear-gradient(135deg, var(--healthcare-warm) 0%, var(--accent-orange) 100%);
  color: white;
  border: none;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-lg);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-spring);
  margin-top: var(--space-3);
}

.smart-retry-btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}
/* Specific styling for completion and navigation buttons */
.chat-button[class*="completion"],
.chat-button[class*="navigation"] {
  background: var(--glass-bg);
  backdrop-filter: var(--backdrop-blur);
  border: 2px solid var(--glass-border);
  color: var(--gray-700);
  font-weight: 600;
  min-height: 48px;
  padding: var(--space-3) var(--space-4);
}

.chat-button[class*="completion"]:hover {
  background: linear-gradient(135deg, var(--healthcare-accent) 0%, var(--accent-green) 100%);
  border-color: var(--healthcare-accent);
  color: white;
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.chat-button[class*="navigation"]:hover {
  background: linear-gradient(135deg, var(--secondary-purple) 0%, var(--primary-blue) 100%);
  border-color: var(--secondary-purple);
  color: white;
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}
/* App download button styling */
.chat-button[class*="app_download"] {
  background: linear-gradient(135deg, var(--healthcare-accent) 0%, var(--accent-green) 100%);
  border: 2px solid var(--healthcare-accent);
  color: white;
  font-weight: 700;
  min-height: 48px;
  padding: var(--space-3) var(--space-4);
  position: relative;
  overflow: hidden;
}

.chat-button[class*="app_download"]::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  animation: shimmer 2s infinite;
  z-index: 1;
}

.chat-button[class*="app_download"]:hover {
  background: linear-gradient(135deg, var(--accent-green) 0%, var(--healthcare-accent) 100%);
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 8px 25px rgba(16, 185, 129, 0.4);
}

.chat-button[class*="app_download"] .button-text {
  position: relative;
  z-index: 2;
}
/* ========================================
   TOUCH DEVICE OPTIMIZATIONS
   ======================================== */

/* Target devices without hover capability (mobile/tablets) */
@media (hover: none) and (pointer: coarse) {
  
  /* Buttons have visible color by default on touch devices */
  .chat-button {
    background: linear-gradient(135deg, 
      rgba(8, 145, 178, 0.12) 0%, 
      rgba(6, 182, 212, 0.12) 100%);
    border: 2px solid rgba(8, 145, 178, 0.35);
    color: var(--healthcare-primary);
    box-shadow: 0 2px 8px rgba(8, 145, 178, 0.15);
  }
  
  /* When button is tapped - full color feedback */
  .chat-button:active {
    background: var(--gradient-primary);
    border-color: var(--healthcare-primary);
    color: white;
    transform: scale(0.96);
    box-shadow: 0 4px 12px rgba(8, 145, 178, 0.3);
  }
  
  /* Welcome buttons on mobile */
  .welcome-button {
    background: linear-gradient(135deg, 
      rgba(8, 145, 178, 0.12) 0%, 
      rgba(6, 182, 212, 0.12) 100%);
    border: 2px solid rgba(8, 145, 178, 0.35);
    color: var(--healthcare-primary);
  }
  
  .welcome-button:active {
    background: var(--gradient-primary);
    border-color: var(--healthcare-primary);
    color: white;
    transform: scale(0.96);
  }
  
  /* Priority signup button - always full color on mobile */
  .chat-button.priority-signup {
    background: linear-gradient(135deg, #0066FF 0%, #3385FF 100%) !important;
    border: 2px solid #0066FF !important;
    color: white !important;
    box-shadow: 0 4px 20px rgba(0, 102, 255, 0.35) !important;
  }
  
  .chat-button.priority-signup:active {
    background: linear-gradient(135deg, #0052CC 0%, #0066FF 100%) !important;
    transform: scale(0.96) !important;
    box-shadow: 0 6px 25px rgba(0, 102, 255, 0.45) !important;
  }
  
  /* URL buttons on mobile */
  .chat-button.url {
    background: linear-gradient(135deg, 
      rgba(16, 185, 129, 0.12) 0%, 
      rgba(5, 150, 105, 0.12) 100%);
    border: 2px solid rgba(16, 185, 129, 0.4);
    color: var(--accent-green);
  }
  
  .chat-button.url:active {
    background: linear-gradient(135deg, 
      var(--accent-green) 0%, 
      var(--healthcare-accent) 100%);
    color: white;
  }
  
  /* App download buttons */
  .chat-button[class*="app_download"] {
    background: linear-gradient(135deg, 
      var(--healthcare-accent) 0%, 
      var(--accent-green) 100%) !important;
    border: 2px solid var(--healthcare-accent) !important;
    color: white !important;
  }
  
  .chat-button[class*="app_download"]:active {
    background: linear-gradient(135deg, 
      var(--accent-green) 0%, 
      var(--healthcare-accent) 100%) !important;
    transform: scale(0.96) !important;
  }
  
  /* Completion buttons */
  .chat-button[class*="completion"]:active {
    background: linear-gradient(135deg, 
      var(--healthcare-accent) 0%, 
      var(--accent-green) 100%);
    color: white;
  }
  
  /* Navigation buttons */
  .chat-button[class*="navigation"]:active {
    background: linear-gradient(135deg, 
      var(--secondary-purple) 0%, 
      var(--primary-blue) 100%);
    color: white;
  }
}

/* Ensure hover states still work on desktop */
@media (hover: hover) and (pointer: fine) {
  
  /* Desktop buttons have subtle color by default */
  .chat-button {
    background: linear-gradient(135deg, 
      rgba(8, 145, 178, 0.06) 0%, 
      rgba(6, 182, 212, 0.06) 100%);
    border: 2px solid rgba(8, 145, 178, 0.2);
    color: var(--gray-700);
  }
  
  /* Full color on hover */
  .chat-button:hover {
    background: var(--gradient-primary);
    border-color: var(--healthcare-primary);
    color: white;
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
  }
  
  /* Maintain pressed state */
  .chat-button:active {
    background: var(--gradient-primary);
    border-color: var(--healthcare-primary);
    color: white;
    transform: translateY(0) scale(0.98);
    box-shadow: var(--shadow-md);
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .chat-button {
    border-width: 3px !important;
    font-weight: 700 !important;
  }
  
  @media (hover: none) {
    .chat-button {
      background: linear-gradient(135deg, 
        rgba(8, 145, 178, 0.2) 0%, 
        rgba(6, 182, 212, 0.2) 100%) !important;
      border-color: rgba(8, 145, 178, 0.6) !important;
    }
  }
}
/* Enhanced Floating Chat Widget - Enterprise Level */

/* CSS Variables for consistency */
:root {
  /* Healthcare Theme Colors */
  --healthcare-primary: #0891b2;
  --healthcare-secondary: #06b6d4;
  --healthcare-accent: #10b981;
  --healthcare-warm: #f59e0b;
  
  /* Status Colors */
  --status-online: #10b981;
  --status-away: #f59e0b;
  --status-offline: #ef4444;
  --status-connecting: #6366f1;
  
  /* Enhanced Shadows */
  --shadow-widget: 0 25px 50px -12px rgba(0, 0, 0, 0.25), 0 10px 20px -10px rgba(0, 0, 0, 0.1);
  --shadow-button: 0 20px 40px -8px rgba(8, 145, 178, 0.4), 0 10px 20px -8px rgba(8, 145, 178, 0.2);
  --shadow-hover: 0 30px 60px -8px rgba(8, 145, 178, 0.5), 0 15px 30px -8px rgba(8, 145, 178, 0.3);
  
  /* Animation Curves */
  --ease-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);
  --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-spring: cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Advanced Keyframes */
@keyframes widgetSlideIn {
  0% {
    opacity: 0;
    transform: translateY(100%) scale(0.8);
    filter: blur(10px);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

@keyframes buttonBounceIn {
  0% {
    opacity: 0;
    transform: scale(0.3) rotate(-180deg);
  }
  50% {
    transform: scale(1.1) rotate(-10deg);
  }
  100% {
    opacity: 1;
    transform: scale(1) rotate(0deg);
  }
}

@keyframes pulseRing {
  0% {
    transform: scale(0.8);
    opacity: 1;
  }
  100% {
    transform: scale(2.5);
    opacity: 0;
  }
}

@keyframes notificationPulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
  }
  50% {
    transform: scale(1.05);
    box-shadow: 0 0 0 10px rgba(239, 68, 68, 0);
  }
}

@keyframes statusBlink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0.3; }
}

@keyframes tooltipSlideIn {
  0% {
    opacity: 0;
    transform: translateX(20px) scale(0.9);
  }
  100% {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

@keyframes quickActionSlide {
  0% {
    opacity: 0;
    transform: translateY(20px) scale(0.8);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Floating Chat Widget */
.floating-chat-widget {
  position: fixed;
  width: 420px;
  height: 650px;
  z-index: 9999;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 24px;
  overflow: hidden;
  animation: widgetSlideIn 0.6s var(--ease-spring);
  box-shadow: var(--shadow-widget);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

.floating-chat-widget::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0.05) 100%);
  pointer-events: none;
  z-index: 1;
}

/* Position Classes */
.floating-chat-widget.bottom-right {
  bottom: 90px;
  right: 20px;
  left: auto; /* Override any left positioning */
  top: auto; /* Override any top positioning */
}

.floating-chat-widget.bottom-left {
  bottom: 90px;
  left: 20px;
}

.floating-chat-widget.top-right {
  top: 20px;
  right: 20px;
}

.floating-chat-widget.top-left {
  top: 20px;
  left: 20px;
}

/* Minimized State */
.floating-chat-widget.minimized {
  height: 60px;
  transition: height 0.3s var(--ease-smooth);
}

/* Connection Status Classes */
.floating-chat-widget.connected {
  border-color: rgba(16, 185, 129, 0.3);
}

.floating-chat-widget.connecting {
  border-color: rgba(99, 102, 241, 0.3);
}

.floating-chat-widget.error {
  border-color: rgba(239, 68, 68, 0.3);
}

/* Widget Header */
.widget-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  background: linear-gradient(135deg, var(--healthcare-primary) 0%, var(--healthcare-secondary) 100%);
  color: white;
  position: relative;
  overflow: hidden;
  z-index: 2;
  min-height: 60px;
}

.widget-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0.05) 100%);
  pointer-events: none;
}

.widget-header::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(45deg, transparent 30%, rgba(255,255,255,0.15) 50%, transparent 70%);
  animation: headerShimmer 4s infinite;
}

@keyframes headerShimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(200%); }
}

.widget-title {
  display: flex;
  align-items: center;
  gap: 16px;
  z-index: 1;
  position: relative;
  flex: 1;
}

.widget-title .bot-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(255,255,255,0.25);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid rgba(255,255,255,0.3);
  transition: all 0.3s var(--ease-smooth);
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
  position: relative;
  overflow: hidden;
}

.widget-title .bot-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.widget-title .bot-avatar:hover {
  transform: rotate(5deg) scale(1.05);
  background: rgba(255,255,255,0.35);
  box-shadow: 0 12px 40px rgba(0,0,0,0.3);
}

.avatar-status-indicator {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 16px;
  height: 16px;
  background: var(--status-online);
  border: 3px solid white;
  border-radius: 50%;
  animation: statusBlink 2s infinite;
}

.title-info {
  flex: 1;
  min-width: 0;
}

.title-info h4 {
  margin: 0 0 4px 0;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.2;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.status-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.online-status {
  font-size: 12px;
  opacity: 0.95;
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--status-online);
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.5);
  animation: statusBlink 2s infinite;
}

.message-count {
  font-size: 11px;
  opacity: 0.8;
  font-weight: 400;
}

.header-actions {
  display: flex;
  gap: 8px;
  z-index: 1;
  position: relative;
}

.minimize-btn,
.close-btn {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  font-size: 18px;
  cursor: pointer;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s var(--ease-smooth);
  outline: none;
  font-weight: bold;
}

.minimize-btn:hover,
.close-btn:hover {
  background: rgba(255,255,255,0.3);
  transform: scale(1.1);
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

.close-btn:hover {
  background: rgba(239, 68, 68, 0.8);
  transform: scale(1.1) rotate(90deg);
}

.minimize-btn:focus-visible,
.close-btn:focus-visible {
  outline: 2px solid rgba(255,255,255,0.5);
  outline-offset: 2px;
}

/* Widget Content */
.widget-content {
  height: calc(100% - 60px);
  overflow: hidden;
  position: relative;
  z-index: 2;
}

/* Minimized Content */
.minimized-content {
  padding: 16px 24px;
  text-align: center;
  background: rgba(248, 250, 252, 0.8);
  backdrop-filter: blur(10px);
  height: calc(100% - 60px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  position: relative;
}

.minimized-info {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}

.minimized-info span {
  color: #64748b;
  font-size: 14px;
  font-weight: 500;
}

.restore-btn {
  background: var(--healthcare-primary);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s var(--ease-smooth);
}

.restore-btn:hover {
  background: var(--healthcare-secondary);
  transform: scale(1.05);
}

/* Chat Toggle Container */
.chat-toggle-container {
  position: fixed;
  z-index: 9998;
}

.chat-toggle-container .bottom-right {
  position: fixed;
  bottom: 20px;
  right: 20px;
  left: auto !important;
  top: auto !important;
}

.chat-toggle-container .bottom-left {
  bottom: 20px;
  left: 20px;
}

.chat-toggle-container .top-right {
  top: 20px;
  right: 20px;
}

.chat-toggle-container .top-left {
  top: 20px;
  left: 20px;
}

/* Main Toggle Button */
.chat-toggle-btn {
  position: fixed;
  width: 68px;
  height: 68px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, var(--healthcare-primary) 0%, var(--healthcare-secondary) 100%);
  color: white;
  cursor: pointer;
  box-shadow: var(--shadow-button);
  transition: all 0.4s var(--ease-spring);
  display: flex;
  align-items: center;
  justify-content: center;
  outline: none;
  overflow: visible;
  position: relative;
  animation: buttonBounceIn 0.6s var(--ease-bounce);
}

.chat-toggle-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0.05) 100%);
  border-radius: 50%;
  opacity: 0;
  transition: opacity 0.3s var(--ease-smooth);
}

.chat-toggle-btn:hover {
  transform: scale(1.15) rotate(5deg);
  box-shadow: var(--shadow-hover);
}

.chat-toggle-btn:hover::before {
  opacity: 1;
}

.chat-toggle-btn:active,
.chat-toggle-btn.pressed {
  transform: scale(1.1) rotate(2deg);
}

.chat-toggle-btn.hovered {
  transform: scale(1.1);
}

.chat-toggle-btn.hidden {
  transform: scale(0.8);
  opacity: 0.7;
}

.chat-toggle-btn:focus-visible {
  outline: 3px solid rgba(8, 145, 178, 0.5);
  outline-offset: 4px;
}

/* Toggle Button Content */
.toggle-btn-content {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

.toggle-avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.close-icon {
  font-size: 32px;
  font-weight: 300;
  line-height: 1;
}

/* Pulse Rings */
.pulse-ring {
  position: absolute;
  border: 3px solid rgba(8, 145, 178, 0.6);
  border-radius: 50%;
  width: 100%;
  height: 100%;
  animation: pulseRing 2s cubic-bezier(0.455, 0.03, 0.515, 0.955) infinite;
  z-index: 1;
}

.pulse-ring-delayed {
  animation-delay: 1s;
}

/* Notification Badge */
.notification-badge {
  position: absolute;
  top: -8px;
  right: -8px;
  min-width: 24px;
  height: 24px;
  background: linear-gradient(135deg, #ef4444 0%, #f87171 100%);
  border-radius: 50%;
  border: 3px solid white;
  color: white;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: notificationPulse 2s infinite;
  box-shadow: 0 4px 20px rgba(239, 68, 68, 0.4);
  z-index: 3;
}

/* Connection Indicator */
.connection-indicator {
  position: absolute;
  bottom: 4px;
  right: 4px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 3px solid white;
  z-index: 3;
}

.connection-indicator.connected {
  background: var(--status-online);
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.5);
}

.connection-indicator.connecting {
  background: var(--status-connecting);
  animation: statusBlink 1s infinite;
}

.connection-indicator.error {
  background: var(--status-offline);
  animation: statusBlink 0.5s infinite;
}

/* Welcome Tooltip */
.welcome-tooltip {
  position: absolute;
  right: 80px;
  top: 50%;
  transform: translateY(-50%);
  background: white;
  border-radius: 20px;
  padding: 20px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.15), 0 10px 20px rgba(0,0,0,0.1);
  max-width: 320px;
  animation: tooltipSlideIn 0.4s var(--ease-spring);
  z-index: 10000;
  border: 1px solid rgba(0,0,0,0.1);
}

.welcome-tooltip::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(8, 145, 178, 0.05) 0%, rgba(6, 182, 212, 0.05) 100%);
  border-radius: 20px;
  pointer-events: none;
}

.tooltip-content {
  position: relative;
  z-index: 1;
}

.tooltip-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
}

.tooltip-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.tooltip-header h4 {
  margin: 0 0 4px 0;
  font-size: 16px;
  font-weight: 700;
  color: #1e293b;
  line-height: 1.2;
}

.tooltip-header p {
  margin: 0;
  font-size: 13px;
  color: #64748b;
  line-height: 1.4;
}

.tooltip-features {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.tooltip-feature {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: #475569;
  font-weight: 500;
}

.feature-icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
}

.tooltip-cta {
  background: linear-gradient(135deg, var(--healthcare-primary) 0%, var(--healthcare-secondary) 100%);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  transition: all 0.3s var(--ease-smooth);
  box-shadow: 0 4px 20px rgba(8, 145, 178, 0.3);
}

.tooltip-cta:hover {
  background: linear-gradient(135deg, var(--healthcare-secondary) 0%, var(--healthcare-primary) 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(8, 145, 178, 0.4);
}

.tooltip-arrow {
  position: absolute;
  right: -8px;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border: 8px solid transparent;
  border-left-color: white;
  filter: drop-shadow(2px 0 4px rgba(0,0,0,0.1));
}

/* Quick Actions */
.quick-actions {
  position: absolute;
  right: 80px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 9999;
}

.quick-action-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  background: white;
  color: #64748b;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 25px rgba(0,0,0,0.15);
  transition: all 0.3s var(--ease-spring);
  animation: quickActionSlide 0.4s var(--ease-spring);
  position: relative;
  overflow: hidden;
}

.quick-action-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--healthcare-primary);
  opacity: 0;
  transition: opacity 0.3s var(--ease-smooth);
  border-radius: 50%;
}

.quick-action-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 12px 35px rgba(0,0,0,0.2);
  color: white;
}

.quick-action-btn:hover::before {
  opacity: 1;
}

.quick-action-btn span {
  position: relative;
  z-index: 1;
}

.quick-action-btn.emergency:hover::before {
  background: var(--status-offline);
}

.quick-action-btn.appointment:hover::before {
  background: var(--healthcare-accent);
}

.quick-action-btn:nth-child(2) {
  animation-delay: 0.1s;
}

/* Position-specific adjustments for tooltip and quick actions */
.chat-toggle-container .bottom-left .welcome-tooltip,
.chat-toggle-container .top-left .welcome-tooltip {
  right: auto;
  left: 80px;
}

.chat-toggle-container .bottom-left .tooltip-arrow,
.chat-toggle-container .top-left .tooltip-arrow {
  right: auto;
  left: -8px;
  border-left-color: transparent;
  border-right-color: white;
}

.chat-toggle-container .bottom-left .quick-actions,
.chat-toggle-container .top-left .quick-actions {
  right: auto;
  left: 80px;
}

.chat-toggle-container .top-right .welcome-tooltip,
.chat-toggle-container .top-left .welcome-tooltip {
  top: auto;
  bottom: 50%;
  transform: translateY(50%);
}

/* Theme Variations */
.floating-chat-widget.healthcare {
  border-color: rgba(8, 145, 178, 0.2);
}

.chat-toggle-btn.healthcare {
  background: linear-gradient(135deg, var(--healthcare-primary) 0%, var(--healthcare-secondary) 100%);
}

.floating-chat-widget.medical {
  border-color: rgba(16, 185, 129, 0.2);
}

.chat-toggle-btn.medical {
  background: linear-gradient(135deg, var(--healthcare-accent) 0%, var(--status-online) 100%);
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
  .floating-chat-widget {
    width: calc(100vw - 20px);
    height: calc(100vh - 100px);
    bottom: 10px;
    right: 10px;
    left: 10px;
    top: auto;
    border-radius: 20px;
    max-width: none;
  }
  
  .floating-chat-widget.bottom-left {
    left: 10px;
    right: 10px;
    bottom: 10px;
  }
  
  .floating-chat-widget.top-right,
  .floating-chat-widget.top-left {
    top: 10px;
    bottom: auto;
    height: calc(100vh - 100px);
  }
  
  .chat-toggle-btn {
    width: 60px;
    height: 60px;
    bottom: 15px;
    right: 15px;
  }

.chat-toggle-btn.bottom-right {
    bottom: 20px;
    right: 20px;
    left: auto !important;
  }

  
 .chat-toggle-btn.bottom-left {
  bottom: 20px;
  left: 20px;
  right: auto; /* Override any conflicting right positioning */
}
  
  .chat-toggle-btn.top-right {
  top: 20px;
  right: 20px;
  bottom: auto; /* Override any conflicting bottom positioning */
  left: auto;

}
  
.chat-toggle-btn.top-left {
  top: 20px;
  left: 20px;
  right: auto; /* Override any conflicting positioning */
  bottom: auto; /* Override any conflicting positioning */
}
  
  .widget-header {
    padding: 16px 20px;
  }
  
  .widget-title .bot-avatar {
    width: 40px;
    height: 40px;
  }
  
  .widget-title h4 {
    font-size: 16px;
  }
  
  .welcome-tooltip {
    max-width: 280px;
    right: 70px;
  }
  
  .welcome-tooltip.bottom-left,
  .welcome-tooltip.top-left {
    left: 70px;
    right: auto;
  }
  
  .quick-actions {
    right: 70px;
  }
  
  .quick-actions.bottom-left,
  .quick-actions.top-left {
    left: 70px;
    right: auto;
  }
  
  .quick-action-btn {
    width: 44px;
    height: 44px;
    font-size: 18px;
  }
}

/* Tablet Responsiveness */
@media (max-width: 1024px) and (min-width: 769px) {
  .floating-chat-widget {
    width: 380px;
    height: 600px;
  }
  
  .chat-toggle-btn {
    width: 64px;
    height: 64px;
  }
}

/* Large Screen Adaptations */
@media (min-width: 1440px) {
  .floating-chat-widget {
    width: 440px;
    height: 680px;
  }
  
  .chat-toggle-btn {
    width: 72px;
    height: 72px;
  }
  
  .welcome-tooltip {
    max-width: 350px;
    right: 85px;
  }
  
  .quick-actions {
    right: 85px;
  }
}

/* Ultra-wide Screen Support */
@media (min-width: 1920px) {
  .floating-chat-widget {
    width: 460px;
    height: 720px;
  }
  
  .chat-toggle-btn {
    width: 76px;
    height: 76px;
  }
}

/* High DPI Display Support */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .chat-toggle-btn {
    box-shadow: var(--shadow-button), 0 0 1px rgba(0,0,0,0.1);
  }
  
  .floating-chat-widget {
    box-shadow: var(--shadow-widget), 0 0 1px rgba(0,0,0,0.1);
  }
  
  .welcome-tooltip {
    box-shadow: 0 20px 40px rgba(0,0,0,0.15), 0 10px 20px rgba(0,0,0,0.1), 0 0 1px rgba(0,0,0,0.1);
  }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
  .floating-chat-widget {
    animation: fadeIn 0.3s ease;
  }
  
  @keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
  }
  
  .chat-toggle-btn {
    animation: fadeIn 0.3s ease;
  }
  
  .chat-toggle-btn:hover {
    transform: scale(1.05);
  }
  
  .widget-title .bot-avatar:hover {
    transform: scale(1.05);
  }
  
  .close-btn:hover {
    transform: scale(1.05);
  }
  
  .pulse-ring {
    animation: none;
  }
  
  .notification-badge {
    animation: none;
  }
  
  .avatar-status-indicator {
    animation: none;
  }
  
  .status-dot {
    animation: none;
  }
  
  .widget-header::after {
    animation: none;
  }
}

/* Focus Management for Accessibility */
.floating-chat-widget:focus-within {
  outline: 3px solid rgba(8, 145, 178, 0.3);
  outline-offset: 2px;
}

/* Print Styles */
@media print {
  .floating-chat-widget,
  .chat-toggle-btn,
  .welcome-tooltip,
  .quick-actions {
    display: none !important;
  }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
  .floating-chat-widget {
    background: rgba(15, 23, 42, 0.95);
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.6);
  }
  
  .widget-header {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
  }
  
  .chat-toggle-btn {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
  }
  
  .welcome-tooltip {
    background: #1e293b;
    color: #f1f5f9;
    border-color: rgba(255, 255, 255, 0.1);
  }
  
  .tooltip-header h4 {
    color: #f1f5f9;
  }
  
  .tooltip-header p {
    color: #94a3b8;
  }
  
  .tooltip-feature {
    color: #cbd5e1;
  }
  
  .tooltip-arrow {
    border-left-color: #1e293b;
  }
  
  .quick-action-btn {
    background: #1e293b;
    color: #cbd5e1;
    border: 1px solid rgba(255, 255, 255, 0.1);
  }
  
  .minimized-content {
    background: rgba(30, 41, 59, 0.8);
  }
  
  .minimized-info span {
    color: #94a3b8;
  }
}

/* Custom Scrollbar for Widget */
.floating-chat-widget .messages-container::-webkit-scrollbar {
  width: 8px;
}

.floating-chat-widget .messages-container::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

.floating-chat-widget .messages-container::-webkit-scrollbar-thumb {
  background: linear-gradient(135deg, rgba(8, 145, 178, 0.4), rgba(6, 182, 212, 0.4));
  border-radius: 4px;
}

.floating-chat-widget .messages-container::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(135deg, rgba(8, 145, 178, 0.6), rgba(6, 182, 212, 0.6));
}

/* Loading State */
.floating-chat-widget.loading {
  pointer-events: none;
}

.floating-chat-widget.loading::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255,255,255,0.9);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

/* Enhanced Shadow Layers for Premium Feel */
.floating-chat-widget {
  box-shadow: 
    0 32px 64px -12px rgba(0, 0, 0, 0.25),
    0 25px 50px -12px rgba(8, 145, 178, 0.15),
    0 0 0 1px rgba(255, 255, 255, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.chat-toggle-btn {
  box-shadow: 
    0 20px 40px -8px rgba(8, 145, 178, 0.4),
    0 15px 25px -8px rgba(8, 145, 178, 0.3),
    0 0 0 1px rgba(255, 255, 255, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

/* Hover Effects for Premium Interactivity */
.floating-chat-widget:hover {
  box-shadow: 
    0 40px 80px -12px rgba(0, 0, 0, 0.3),
    0 30px 60px -12px rgba(8, 145, 178, 0.2),
    0 0 0 1px rgba(255, 255, 255, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.chat-toggle-btn:hover {
  box-shadow: 
    0 25px 50px -8px rgba(8, 145, 178, 0.5),
    0 20px 35px -8px rgba(8, 145, 178, 0.4),
    0 0 0 1px rgba(255, 255, 255, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

/* Advanced Container Queries Support */
@supports (container-type: inline-size) {
  .floating-chat-widget {
    container-type: inline-size;
  }
  
  @container (max-width: 380px) {
    .widget-header {
      padding: 14px 18px;
    }
    
    .widget-title h4 {
      font-size: 16px;
    }
  }
}
