/* 
 * Modern Omniyat-Style Chat Interface - Green & White Theme
 * 
 * Enhanced Features:
 * - Smooth typing animations with character-by-character display
 * - Staggered button animations with micro-interactions
 * - Advanced hover effects with scale and transform
 * - Ripple effects on button clicks
 * - Smooth scrolling with requestAnimationFrame
 * - Enhanced typing indicator with gradient background
 * - Message fade-in and slide animations
 * - Input focus states with smooth transitions
 * - Notification badge with pulse animation
 * - Professional color gradients and shadows
 * - Mobile-responsive design
 * - Optimized performance with CSS transforms
 */

/* Chat Container */
.chat-container {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 420px;
  max-height: 650px;
  background: white;
  border-radius: 24px;
  box-shadow: 0 25px 80px rgba(12, 67, 38, 0.2), 0 12px 32px rgba(0, 0, 0, 0.12);
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 1001;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  border: 2px solid rgba(12, 67, 38, 0.1);
  backdrop-filter: blur(20px);
  transform: translateY(100px) scale(0.8);
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.chat-container.active {
  display: flex;
  animation: slideUpBounce 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  transform: translateY(0) scale(1);
}

@keyframes slideUpBounce {
  0% {
    opacity: 0;
    transform: translateY(100px) scale(0.8) rotateY(-15deg);
  }
  60% {
    opacity: 0.8;
    transform: translateY(-10px) scale(1.02) rotateY(5deg);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1) rotateY(0deg);
  }
}

@keyframes messageSlideIn {
  0% {
    opacity: 0;
    transform: translateY(20px) translateX(-10px) scale(0.95);
  }
  100% {
    opacity: 1;
    transform: translateY(0) translateX(0) scale(1);
  }
}

@keyframes typing {
  0%, 60%, 100% {
    transform: translateY(0);
  }
  30% {
    transform: translateY(-10px);
  }
}

/* Chat Header Styling */
.chat-header {
  background: linear-gradient(145deg, #0c4326 0%, #1b5434 35%, #2d6b4a 70%, #0c4326 100%);
  color: white;
  padding: 24px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  position: relative;
  box-shadow: 0 6px 20px rgba(12, 67, 38, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.chat-header::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
  animation: shimmer 3s linear infinite;
  pointer-events: none;
}

@keyframes shimmer {
  0% { transform: translateX(-100%) translateY(-100%) rotate(45deg); }
  100% { transform: translateX(100%) translateY(100%) rotate(45deg); }
}

.chat-header-content {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
}

.chat-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
  padding: 8px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25), 0 0 0 4px rgba(255, 255, 255, 0.15);
  border: 3px solid rgba(255, 255, 255, 0.2);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
}

.chat-avatar::before {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  border-radius: 50%;
  background: linear-gradient(45deg, rgba(255, 255, 255, 0.3), transparent, rgba(255, 255, 255, 0.3));
  animation: rotate 2s linear infinite;
}

@keyframes rotate {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.chat-avatar img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.chat-header-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.chat-company-name {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.3px;
  line-height: 1.2;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.chat-status {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.9);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 7px;
}

.chat-status::before {
  content: '';
  width: 7px;
  height: 7px;
  background: #4ade80;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 0 2px rgba(74, 222, 128, 0.2);
  animation: statusPulse 2s infinite;
}

@keyframes statusPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.chat-header #closeChat {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.12);
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  color: white;
  flex-shrink: 0;
}

.chat-header #closeChat:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.05);
}

/* Chat Messages Area */
.chat-messages {
  flex: 1;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
  background: linear-gradient(to bottom, #f8fafb 0%, #ffffff 100%);
  min-height: 0;
}

.chat-messages::-webkit-scrollbar {
  width: 5px;
}

.chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: rgba(12, 67, 38, 0.15);
  border-radius: 10px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
  background: rgba(12, 67, 38, 0.25);
}

/* Welcome Message */
.chat-welcome {
  background: linear-gradient(135deg, rgba(255, 255, 255, 1) 0%, rgba(248, 250, 251, 1) 100%);
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 10px;
  box-shadow: 0 4px 12px rgba(12, 67, 38, 0.08), 0 1px 3px rgba(0, 0, 0, 0.05);
  border: 1.5px solid rgba(12, 67, 38, 0.08);
  position: relative;
  overflow: hidden;
}

.chat-welcome::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: linear-gradient(to bottom, #0c4326, #1b5434);
}

.chat-welcome-title {
  font-size: 15px;
  font-weight: 600;
  color: #0c4326;
  margin-bottom: 10px;
  line-height: 1.4;
}

.chat-welcome-text {
  font-size: 14px;
  color: #475569;
  line-height: 1.6;
  margin-bottom: 4px;
}

.chat-welcome-text:last-child {
  margin-bottom: 0;
  margin-top: 12px;
  font-weight: 500;
  color: #334155;
}

/* Option Buttons */
.chat-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
}

.chat-option-btn {
  background: white;
  border: 1.5px solid rgba(12, 67, 38, 0.12);
  border-radius: 12px;
  padding: 16px 20px;
  font-size: 14px;
  font-weight: 600;
  color: #1e293b;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  text-align: left;
  display: flex;
  align-items: center;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  box-shadow: 0 2px 6px rgba(12, 67, 38, 0.06);
  position: relative;
  overflow: hidden;
}

.chat-option-btn::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 0;
  background: linear-gradient(135deg, rgba(12, 67, 38, 0.08) 0%, rgba(27, 84, 52, 0.06) 100%);
  transition: width 0.3s ease;
}

.chat-option-btn:hover {
  border-color: rgba(12, 67, 38, 0.4);
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 8px 25px rgba(12, 67, 38, 0.15), 0 4px 12px rgba(0, 0, 0, 0.08);
  background: linear-gradient(135deg, #ffffff 0%, #f0fdf4 100%);
}

.chat-option-btn:hover::before {
  width: 100%;
}

.chat-option-btn:active {
  transform: translateY(-1px) scale(0.98);
  box-shadow: 0 3px 8px rgba(12, 67, 38, 0.2);
  background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
  border-color: rgba(12, 67, 38, 0.5);
}

/* Typing Indicator */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px 20px;
  background: linear-gradient(135deg, #ffffff 0%, #f8fafb 100%);
  border-radius: 18px;
  border-bottom-left-radius: 6px;
  box-shadow: 0 4px 12px rgba(12, 67, 38, 0.1), 0 1px 3px rgba(0, 0, 0, 0.06);
  border: 1.5px solid rgba(12, 67, 38, 0.08);
  align-self: flex-start;
  max-width: 80%;
}

.typing-dots {
  display: flex;
  gap: 4px;
}

.typing-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0c4326 0%, #166534 50%, #0c4326 100%);
  animation: typing 1.4s infinite ease-in-out;
  box-shadow: 0 2px 4px rgba(12, 67, 38, 0.2);
}

.typing-dot:nth-child(1) { animation-delay: 0s; }
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

/* Message Bubbles */
.chat-messages .bot,
.chat-messages .user {
  padding: 16px 20px;
  border-radius: 20px;
  max-width: 82%;
  font-size: 14px;
  line-height: 1.65;
  animation: messageSlideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  word-wrap: break-word;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-weight: 400;
  position: relative;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

@keyframes messageSlide {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.chat-messages .bot {
  background: linear-gradient(135deg, #ffffff 0%, #f8fafb 100%);
  color: #1e293b;
  align-self: flex-start;
  border-bottom-left-radius: 6px;
  box-shadow: 0 3px 10px rgba(12, 67, 38, 0.1), 0 1px 3px rgba(0, 0, 0, 0.06);
  border: 1.5px solid rgba(12, 67, 38, 0.08);
}

.chat-messages .user {
  background: linear-gradient(135deg, #0c4326 0%, #1b5434 50%, #0c4326 100%);
  color: white;
  align-self: flex-end;
  border-bottom-right-radius: 6px;
  box-shadow: 0 4px 12px rgba(12, 67, 38, 0.3), 0 2px 6px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Typing Indicator */
.typing-indicator {
  background: white;
  padding: 14px 18px;
  border-radius: 12px;
  border-bottom-left-radius: 4px;
  align-self: flex-start;
  display: flex;
  gap: 4px;
  align-items: center;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  border: 1px solid rgba(12, 67, 38, 0.06);
}

.typing-dots {
  display: flex;
  gap: 5px;
}

.typing-dots span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(12, 67, 38, 0.4);
  animation: typingBounce 1.4s infinite ease-in-out;
}

.typing-dots span:nth-child(1) {
  animation-delay: -0.32s;
}

.typing-dots span:nth-child(2) {
  animation-delay: -0.16s;
}

@keyframes typingBounce {
  0%, 80%, 100% {
    transform: scale(0.8);
    opacity: 0.5;
  }
  40% {
    transform: scale(1.1);
    opacity: 1;
  }
}

/* Chat Input Container */
.chat-input-container {
  display: flex;
  padding: 18px 20px;
  gap: 12px;
  background: linear-gradient(to top, #ffffff 0%, #fafbfc 100%);
  border-top: 1.5px solid rgba(12, 67, 38, 0.1);
  align-items: center;
  box-shadow: 0 -2px 10px rgba(12, 67, 38, 0.04);
}

.chat-input-container input {
  flex: 1;
  min-width: 0;
  padding: 14px 20px;
  border: 2px solid rgba(12, 67, 38, 0.12);
  border-radius: 28px;
  font-size: 14px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  outline: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  background: #ffffff;
  color: #1e293b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 0 2px 6px rgba(12, 67, 38, 0.04);
}

.chat-input-container input:focus {
  border-color: rgba(12, 67, 38, 0.35);
  background: white;
  box-shadow: 0 0 0 4px rgba(12, 67, 38, 0.08), 0 4px 12px rgba(12, 67, 38, 0.08);
  transform: translateY(-1px);
}

.chat-input-container input::placeholder {
  color: #94a3b8;
  font-weight: 400;
  transition: all 0.3s ease;
}

.chat-input-container input:focus::placeholder {
  color: #cbd5e1;
  transform: translateX(5px);
}

.chat-input-container #sendChat {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0c4326 0%, #1b5434 50%, #0c4326 100%);
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(12, 67, 38, 0.3), 0 2px 4px rgba(0, 0, 0, 0.1);
  padding: 0;
  position: relative;
  overflow: hidden;
}

.chat-input-container #sendChat::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transform: translate(-50%, -50%);
  transition: width 0.4s, height 0.4s;
}

.chat-input-container #sendChat:hover::before {
  width: 100%;
  height: 100%;
}

.chat-input-container #sendChat:hover {
  transform: scale(1.1) rotate(15deg);
  box-shadow: 0 6px 20px rgba(12, 67, 38, 0.4), 0 4px 8px rgba(0, 0, 0, 0.15);
}

.chat-input-container #sendChat:active {
  transform: scale(0.95);
}

.chat-input-container #sendChat svg {
  width: 20px;
  height: 20px;
  fill: white;
  stroke: white;
  display: block;
  margin: auto;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.1));
}

/* Chat Button Styling */
.chat-button {
  position: fixed;
  bottom: 30px;
  right: 30px;
  background: linear-gradient(145deg, #0c4326 0%, #1b5434 35%, #2d6b4a 100%);
  color: white;
  padding: 8px 26px 8px 8px;
  border-radius: 32px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  box-shadow: 
    0 8px 24px rgba(12, 67, 38, 0.4),
    0 4px 12px rgba(0, 0, 0, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  z-index: 1000;
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  border: none;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.01em;
  width: auto;
  min-width: fit-content;
  white-space: nowrap;
  backdrop-filter: blur(20px);
  position: relative;
  overflow: hidden;
}

.chat-button::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 32px;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.chat-button::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
  animation: shimmer 4s linear infinite;
  pointer-events: none;
}

.chat-button-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
  padding: 5px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
  transition: all 0.3s ease;
}

.chat-button-avatar img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.chat-icon {
  width: 22px;
  height: 22px;
  transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  flex-shrink: 0;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.15));
}

.chat-button-text {
  font-size: 15px;
  font-weight: 500;
  white-space: nowrap;
  letter-spacing: 0.01em;
  color: white;
  display: inline-block;
}

.chat-button:hover {
  transform: translateY(-3px);
  box-shadow: 
    0 10px 28px rgba(12, 67, 38, 0.45),
    0 4px 14px rgba(0, 0, 0, 0.2);
  background: linear-gradient(135deg, #0d4a2a 0%, #1e5c38 100%);
}

.chat-button:hover::before {
  opacity: 1;
}

.chat-button:hover .chat-button-avatar {
  transform: scale(1.08);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.18);
}

.chat-button:active {
  transform: translateY(-1px);
  transition: all 0.15s ease;
  box-shadow: 
    0 5px 18px rgba(12, 67, 38, 0.4),
    0 2px 8px rgba(0, 0, 0, 0.15);
}

/* Chat FAB Button - Premium Edition */
.chat-fab {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 68px;
  height: 68px;
  background: linear-gradient(135deg, #0c4326 0%, #166534 50%, #0c4326 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 
    0 10px 40px rgba(12, 67, 38, 0.45),
    0 6px 20px rgba(0, 0, 0, 0.25),
    0 0 0 0 rgba(12, 67, 38, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
  z-index: 10000;
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  border: 3px solid rgba(255, 255, 255, 0.2);
  pointer-events: auto;
  overflow: visible;
  animation: fabPulse 3s ease-in-out infinite;
}

/* Floating animation */
@keyframes fabPulse {
  0%, 100% {
    box-shadow: 
      0 10px 40px rgba(12, 67, 38, 0.45),
      0 6px 20px rgba(0, 0, 0, 0.25),
      0 0 0 0 rgba(12, 67, 38, 0.4),
      inset 0 1px 0 rgba(255, 255, 255, 0.15);
  }
  50% {
    box-shadow: 
      0 15px 50px rgba(12, 67, 38, 0.55),
      0 8px 25px rgba(0, 0, 0, 0.3),
      0 0 0 10px rgba(12, 67, 38, 0.15),
      inset 0 1px 0 rgba(255, 255, 255, 0.15);
    transform: translateY(-3px);
  }
}

/* Glow effect */
.chat-fab::before {
  content: '';
  position: absolute;
  top: -3px;
  left: -3px;
  right: -3px;
  bottom: -3px;
  background: linear-gradient(135deg, #22c55e, #16a34a, #0c4326);
  border-radius: 50%;
  z-index: -1;
  opacity: 0;
  transition: opacity 0.4s ease;
  filter: blur(10px);
}

/* Shimmer effect */
.chat-fab::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  transition: left 0.5s ease;
  border-radius: 50%;
}

.chat-fab:hover {
  transform: translateY(-8px) scale(1.1) rotate(10deg);
  box-shadow: 
    0 20px 60px rgba(12, 67, 38, 0.6),
    0 10px 30px rgba(0, 0, 0, 0.35),
    0 0 0 15px rgba(34, 197, 94, 0.2),
    inset 0 2px 0 rgba(255, 255, 255, 0.25);
  background: linear-gradient(135deg, #0d4a2a 0%, #16a34a 50%, #0d4a2a 100%);
  border-color: rgba(255, 255, 255, 0.4);
  animation: none; /* Stop pulse on hover */
}

.chat-fab:hover::before {
  opacity: 1;
}

.chat-fab:hover::after {
  left: 100%;
}

.chat-fab:active {
  transform: translateY(-2px) scale(1.05) rotate(5deg);
  box-shadow: 
    0 8px 30px rgba(12, 67, 38, 0.5),
    0 4px 15px rgba(0, 0, 0, 0.3),
    inset 0 2px 4px rgba(0, 0, 0, 0.2);
  transition: all 0.1s ease;
}

.chat-fab .chat-icon {
  color: white;
  width: 32px;
  height: 32px;
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
  position: relative;
  z-index: 1;
}

.chat-fab:hover .chat-icon {
  transform: scale(1.2) rotate(-10deg);
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.4));
}

/* Tooltip label on hover */
.chat-fab[title]::before {
  content: attr(title);
  position: absolute;
  right: 80px;
  top: 50%;
  transform: translateY(-50%) translateX(10px);
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  color: white;
  padding: 10px 18px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  z-index: -1;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.chat-fab[title]::after {
  content: '';
  position: absolute;
  right: 70px;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-left: 8px solid #1e293b;
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease 0.1s;
}

.chat-fab:hover[title]::before {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
  z-index: 1000;
}

.chat-fab:hover[title]::after {
  opacity: 1;
}

/* Notification Badge */
.chat-notification-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: white;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.5), 0 0 0 3px white;
  animation: badgePulse 2s ease-in-out infinite;
}

@keyframes badgePulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.5), 0 0 0 3px white;
  }
  50% {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.7), 0 0 0 3px white;
  }
}

/* Loading dots animation */
@keyframes loadingDots {
  0%, 20% {
    opacity: 0.3;
    transform: scale(0.8);
  }
  50% {
    opacity: 1;
    transform: scale(1.2);
  }
  100% {
    opacity: 0.3;
    transform: scale(0.8);
  }
}

/* Message hover effect enhancement */
.chat-messages .bot,
.chat-messages .user {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: default;
}

.chat-messages .bot:hover {
  background: linear-gradient(135deg, #ffffff 0%, #f0fdf4 100%);
}

.chat-messages .user:hover {
  background: linear-gradient(135deg, #0d4a2a 0%, #1e5c38 100%);
}

/* Responsive Design */
@media (max-width: 768px) {
  .chat-container {
    width: 95% !important;
    max-width: 420px !important;
    height: 550px !important;
    max-height: 65vh !important;
    right: 2.5% !important;
    bottom: 80px !important;
    border-radius: 16px !important;
    box-shadow: 0 10px 40px rgba(12, 67, 38, 0.25), 0 4px 16px rgba(0, 0, 0, 0.15) !important;
  }
  
  .chat-button {
    bottom: 20px !important;
    right: 20px !important;
    padding: 10px 16px !important;
    font-size: 13px !important;
  }

  .chat-fab {
    width: 60px;
    height: 60px;
    bottom: 20px;
    right: 15px;
    box-shadow: 
      0 8px 30px rgba(12, 67, 38, 0.4),
      0 4px 15px rgba(0, 0, 0, 0.2),
      0 0 0 0 rgba(12, 67, 38, 0.3);
  }
  
  .chat-fab .chat-icon {
    width: 28px;
    height: 28px;
  }
  
  /* Hide tooltip on mobile */
  .chat-fab[title]::before,
  .chat-fab[title]::after {
    display: none;
  }
  
  .chat-header {
    padding: 12px 16px;
  }
  
  .chat-avatar {
    width: 34px;
    height: 34px;
  }

  .chat-company-name {
    font-size: 14px;
  }

  .chat-status {
    font-size: 11px;
  }
  
  .chat-messages {
    padding: 12px 10px;
    gap: 10px;
  }
  
  .chat-welcome {
    padding: 12px;
  }

  .chat-welcome-title {
    font-size: 13px;
  }

  .chat-welcome-text {
    font-size: 12px;
  }
  
  .chat-option-btn {
    padding: 10px 12px;
    font-size: 12px;
  }

  .chat-messages .bot,
  .chat-messages .user {
    padding: 10px 13px;
    font-size: 12.5px;
    max-width: 85%;
  }

  .chat-input-container {
    padding: 10px 12px;
  }

  .chat-input-container input {
    padding: 10px 14px;
    font-size: 13px;
  }

  .chat-input-container #sendChat {
    width: 40px;
    height: 40px;
  }
}

/* Enhanced Animations for Better UX */
@keyframes messageSlideIn {
  0% {
    opacity: 0;
    transform: translateY(15px) scale(0.95);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes messagePulse {
  0%, 100% {
    box-shadow: 0 4px 12px rgba(12, 67, 38, 0.1), 0 1px 3px rgba(0, 0, 0, 0.06);
  }
  50% {
    box-shadow: 0 6px 20px rgba(12, 67, 38, 0.15), 0 2px 5px rgba(0, 0, 0, 0.08);
  }
}

@keyframes buttonPopIn {
  0% {
    opacity: 0;
    transform: scale(0.8) translateY(10px);
  }
  60% {
    transform: scale(1.05) translateY(-2px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes rippleEffect {
  0% {
    box-shadow: 0 0 0 0 rgba(12, 67, 38, 0.4);
  }
  50% {
    box-shadow: 0 0 0 10px rgba(12, 67, 38, 0.1);
  }
  100% {
    box-shadow: 0 0 0 20px rgba(12, 67, 38, 0);
  }
}

@keyframes textShimmer {
  0% {
    background-position: -200% center;
  }
  100% {
    background-position: 200% center;
  }
}

/* Add smooth animations to bot and user messages */
.chat-messages .bot,
.chat-messages .user {
  animation: messageSlideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* Enhance option buttons with staggered animations */
.chat-option-btn {
  animation: buttonPopIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  opacity: 0;
}

.chat-option-btn:nth-child(1) { animation-delay: 0.1s; }
.chat-option-btn:nth-child(2) { animation-delay: 0.2s; }
.chat-option-btn:nth-child(3) { animation-delay: 0.3s; }
.chat-option-btn:nth-child(4) { animation-delay: 0.4s; }

/* Add ripple effect to send button */
.chat-input-container #sendChat:active::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  animation: rippleEffect 0.6s ease-out;
}

/* Add smooth focus states */
.chat-input-container input:focus {
  border-color: #0c4326;
  box-shadow: 0 0 0 3px rgba(12, 67, 38, 0.1), 0 4px 12px rgba(12, 67, 38, 0.15);
  transform: translateY(-1px);
}

/* Enhanced welcome message animation */
.chat-welcome {
  animation: messageSlideIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards, 
             messagePulse 3s ease-in-out infinite 2s;
}

/* Add subtle hover effect to messages */
.chat-messages .bot:hover,
.chat-messages .user:hover {
  transform: translateX(2px);
  box-shadow: 0 6px 20px rgba(12, 67, 38, 0.12), 0 2px 5px rgba(0, 0, 0, 0.08);
}

/* Smooth container transitions */
#chatContainer {
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#chatContainer.active {
  animation: messageSlideIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

