/* Arosoft Chat Styles */

/* Variables for Chat Styling */
:root {
  --chat-bg: rgba(255, 255, 255, 0.95);
  --chat-header-bg: var(--primary-blue, #0066CC);
  --chat-header-color: #fff;
  --chat-border-color: rgba(221, 221, 221, 0.5);
  --chat-shadow: 0 8px 24px rgba(0, 0, 0, 0.15), 0 2px 8px rgba(0, 0, 0, 0.1);
  --chat-button-bg: var(--primary-blue, #0066CC);
  --chat-button-hover-bg: #004C99;
  --chat-icon-size: 56px;
  --chat-widget-width: 340px;
  --chat-widget-max-height: 500px;
  --chat-input-bg: rgba(249, 249, 249, 0.8);
  --chat-input-text: #333;
  --chat-user-bubble: linear-gradient(135deg, var(--brand-blue) 0%, var(--brand-blue-dark) 100%);
  --chat-bot-bubble: linear-gradient(135deg, rgba(255,255,255,0.08) 0%, rgba(255,255,255,0.12) 100%);
  --chat-user-text: #fff;
  --chat-bot-text: var(--text-primary);
}

/* Light Mode Defaults */
.chat-widget {
  background-color: var(--chat-bg);
  border: 1px solid var(--chat-border-color);
}

.chat-header {
  background-color: var(--chat-header-bg);
  color: var(--chat-header-color);
}

.chat-message.user .message-content {
  background: var(--chat-user-bubble);
  color: var(--chat-user-text);
}

.chat-message.bot .message-content {
  background: var(--chat-bot-bubble);
  color: var(--chat-bot-text);
}

.chat-messages {
  background-color: transparent;
}

/* Dark Mode Overrides */
[data-theme="dark"] {
  --chat-bg: rgba(30, 30, 30, 0.9);
  --chat-border-color: rgba(68, 68, 68, 0.5);
  --chat-header-bg: #333;
  --chat-header-color: #fff;
  --chat-button-bg: #333;
  --chat-button-hover-bg: #222;
  --chat-input-bg: rgba(43, 43, 43, 0.8); /* Dark background for input in dark mode */
  --chat-input-text: #fff; /* Light text for input in dark mode */
  --chat-shadow: 0 8px 24px rgba(0, 0, 0, 0.3), 0 2px 8px rgba(0, 0, 0, 0.2);
  --chat-user-bubble: linear-gradient(135deg, rgba(74,144,226,0.35) 0%, rgba(46,90,135,0.55) 100%);
  --chat-bot-bubble: linear-gradient(135deg, rgba(255,255,255,0.06) 0%, rgba(255,255,255,0.10) 100%);
  --chat-user-text: #fff;
  --chat-bot-text: #e5e7eb;
}

[data-theme="dark"] .chat-widget {
  background-color: var(--chat-bg);
  border-color: var(--chat-border-color);
}

[data-theme="dark"] .chat-header {
  background-color: var(--chat-header-bg);
  color: var(--chat-header-color);
}

[data-theme="dark"] .chat-messages {
  background-color: transparent;
}

[data-theme="dark"] .chat-message.user .message-content {
  background: var(--chat-user-bubble);
  color: var(--chat-user-text);
}

[data-theme="dark"] .chat-message.bot .message-content {
  background: var(--chat-bot-bubble);
  color: var(--chat-bot-text);
}

[data-theme="dark"] #chat-input {
  background-color: var(--chat-input-bg);
  color: var(--chat-input-text);
}

/* Chat Widget Layout & Positioning */
/* Direct chat widget styling to ensure it displays properly */
#chat-widget {
  position: fixed !important;
  bottom: 90px !important;
  right: 20px !important;
  width: var(--chat-widget-width) !important;
  max-height: var(--chat-widget-max-height) !important;
  border-radius: 16px !important;
  display: none; /* Initially hidden */
  flex-direction: column !important;
  box-shadow: var(--chat-shadow) !important;
  /* Very high z-index so it stays above everything, including chat button */
  z-index: 9999 !important;
  overflow: hidden !important;
  animation: slideIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards !important;
  backdrop-filter: blur(10px) !important;
  -webkit-backdrop-filter: blur(10px) !important;
  border: 1px solid var(--chat-border-color) !important;
  opacity: 1 !important; /* Ensure full opacity */
  visibility: visible !important; /* Ensure visibility */
  transform: none !important; /* Prevent transform issues */
  left: auto !important; /* Prevent left positioning */
}

/* Force display when open with !important to override any conflicting styles */
#chat-widget.open,
.chat-widget.open {
  display: flex !important; /* Force display when open */
  opacity: 1 !important;
  visibility: visible !important;
  transform: none !important;
  pointer-events: auto !important;
}

/* Magical particle background for chat widget */
.chat-widget::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.8) 0%, rgba(255, 255, 255, 0.95) 100%);
  z-index: -1;
  pointer-events: none;
}

[data-theme="dark"] .chat-widget::before {
  background: linear-gradient(135deg, rgba(30, 30, 30, 0.8) 0%, rgba(30, 30, 30, 0.95) 100%);
}

/* Magical particles in chat background */
.chat-widget::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image:
    radial-gradient(circle at 10% 20%, rgba(77, 151, 209, 0.05) 0%, transparent 50%),
    radial-gradient(circle at 90% 80%, rgba(224, 92, 147, 0.05) 0%, transparent 50%),
    radial-gradient(circle at 50% 50%, rgba(255, 214, 51, 0.03) 0%, transparent 50%);
  opacity: 0.7;
  z-index: -1;
  pointer-events: none;
  animation: subtle-magic-bg 15s ease-in-out infinite alternate;
}

[data-theme="dark"] .chat-widget::after {
  background-image:
    radial-gradient(circle at 10% 20%, rgba(77, 151, 209, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 90% 80%, rgba(224, 92, 147, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 50% 50%, rgba(255, 214, 51, 0.05) 0%, transparent 50%);
  opacity: 0.9;
  animation: subtle-magic-bg-dark 15s ease-in-out infinite alternate;
}

@keyframes subtle-magic-bg {
  0% {
    background-position: 0% 0%;
    opacity: 0.5;
  }
  50% {
    opacity: 0.7;
  }
  100% {
    background-position: 100% 100%;
    opacity: 0.5;
  }
}

@keyframes subtle-magic-bg-dark {
  0% {
    background-position: 0% 0%;
    opacity: 0.7;
  }
  50% {
    opacity: 0.9;
  }
  100% {
    background-position: 100% 100%;
    opacity: 0.7;
  }
}

/* Chat Widget Slide-In Animation */
@keyframes slideIn {
  0% {
    opacity: 0;
    transform: translateY(30px) scale(0.95);
  }
  70% {
    opacity: 1;
    transform: translateY(-5px) scale(1.01);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Chat Header */
.chat-header {
  padding: 14px 16px;
  border-top-left-radius: 16px;
  border-top-right-radius: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: bold;
  position: relative;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Add subtle crystal ball background to header with animation */
.chat-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: url('../images/icons/magic-crystal-ball.svg');
  background-size: 70px;
  background-position: right -15px center;
  background-repeat: no-repeat;
  opacity: 0.15;
  z-index: 0;
  pointer-events: none;
  animation: subtle-header-float 8s ease-in-out infinite;
}

@keyframes subtle-header-float {
  0% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-5px) rotate(5deg); }
  100% { transform: translateY(0) rotate(0deg); }
}

/* Ensure header content stays above the background */
.chat-header > * {
  position: relative;
  z-index: 1;
}

/* Category-specific chat header styles */
.chat-header.solutions-context {
  background-color: var(--primary-blue);
}

.chat-header.consulting-context {
  background-color: var(--secondary-yellow);
  color: var(--text-dark);
}

.chat-header.products-context {
  background-color: var(--secondary-pink);
}

.chat-header span {
  font-size: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.chat-header-icon {
  width: 24px;
  height: 24px;
  vertical-align: middle;
  animation: crystal-pulse 4s ease-in-out infinite;
  filter: drop-shadow(0 0 3px rgba(255, 255, 255, 0.7));
}

@keyframes crystal-pulse {
  0% {
    transform: scale(1);
    filter: drop-shadow(0 0 3px rgba(255, 255, 255, 0.7));
  }
  50% {
    transform: scale(1.1);
    filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.9));
  }
  100% {
    transform: scale(1);
    filter: drop-shadow(0 0 3px rgba(255, 255, 255, 0.7));
  }
}

.chat-close-btn {
  cursor: pointer;
  font-size: 20px;
  line-height: 20px;
  transition: transform 0.2s ease;
}

.chat-close-btn:hover {
  transform: scale(1.1);
}

/* Chat Messages Area */
.chat-messages {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  scroll-behavior: smooth;
  background-image: linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 100% 20px;
}

/* Chat Message Styles */
.chat-message {
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
  animation: message-appear 0.3s ease-out forwards;
  opacity: 0;
  transform: translateY(10px);
}

@keyframes message-appear {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* User messages aligned to right */
.chat-message.user {
  justify-content: flex-end;
}

/* Bot messages aligned to left */
.chat-message.bot {
  justify-content: flex-start;
}

.message-content {
  padding: 12px 16px;
  border-radius: 18px;
  max-width: 85%;
  word-wrap: break-word;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  position: relative;
  line-height: 1.5;
  font-size: 14px;
}

/* User message styling */
.chat-message.user .message-content {
  background: var(--chat-user-bubble);
  color: var(--chat-user-text);
  border-bottom-right-radius: 4px;
  margin-left: 20px;
}

/* Bot message styling */
.chat-message.bot .message-content {
  background: var(--chat-bot-bubble);
  color: var(--chat-bot-text);
  border-bottom-left-radius: 4px;
  margin-right: 20px;
}

/* Chat Input Area */
.chat-input-area {
  display: flex;
  border-top: 1px solid var(--chat-border-color);
  padding: 12px;
  background-color: var(--chat-bg);
  position: relative;
}

/* Add subtle glow effect to input area */
.chat-input-area::before {
  content: '';
  position: absolute;
  top: -10px;
  left: 0;
  right: 0;
  height: 10px;
  background: linear-gradient(to top, rgba(0,0,0,0.05), transparent);
  pointer-events: none;
}

#chat-input {
  flex: 1;
  border: 1px solid var(--chat-border-color);
  padding: 12px 16px;
  border-radius: 24px;
  margin-right: 8px;
  background-color: var(--chat-input-bg); /* Use variable for background */
  color: var(--chat-input-text); /* Use variable for text color */
  font-size: 14px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

#chat-input:focus {
  outline: none;
  border-color: var(--chat-button-bg);
  box-shadow: 0 0 0 2px rgba(0, 102, 179, 0.2);
}

#chat-send-btn {
  background-color: var(--chat-button-bg);
  border: none;
  color: #fff;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  position: relative;
  padding: 0;
  overflow: visible; /* Allow stars to overflow */
}

#chat-send-btn img {
  width: 22px;
  height: 22px;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.2));
}

#chat-send-btn:hover {
  background-color: var(--chat-button-hover-bg);
  transform: scale(1.05);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
}

/* Flying stars around send button */
#chat-send-btn::before,
#chat-send-btn::after {
  content: '';
  position: absolute;
  width: 4px;
  height: 4px;
  background: transparent;
  border-radius: 50%;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.1),
    0 0 3px 1px rgba(77, 151, 209, 0.3),
    0 0 5px 2px rgba(224, 92, 147, 0.2);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

#chat-send-btn::before {
  top: -5px;
  right: -5px;
  animation: flying-star-1 3s ease-in-out infinite;
}

#chat-send-btn::after {
  bottom: -5px;
  left: -5px;
  animation: flying-star-2 4s ease-in-out infinite;
}

/* Additional stars using pseudo-elements of child elements */
#chat-send-btn img::before,
#chat-send-btn img::after {
  content: '';
  position: absolute;
  width: 3px;
  height: 3px;
  background: transparent;
  border-radius: 50%;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.1),
    0 0 3px 1px rgba(77, 151, 209, 0.3),
    0 0 5px 2px rgba(224, 92, 147, 0.2);
  opacity: 0;
  pointer-events: none;
}

/* Show stars on hover */
#chat-send-btn:hover::before,
#chat-send-btn:hover::after {
  opacity: 1;
}

/* Star animations */
@keyframes flying-star-1 {
  0% {
    opacity: 0;
    transform: translate(0, 0) scale(0.5);
  }
  20% {
    opacity: 1;
  }
  80% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(10px, -10px) scale(1.2);
  }
}

@keyframes flying-star-2 {
  0% {
    opacity: 0;
    transform: translate(0, 0) scale(0.5);
  }
  30% {
    opacity: 1;
  }
  70% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(-10px, 10px) scale(1.2);
  }
}

/* Additional stars using actual elements */
.send-btn-star {
  position: absolute;
  width: 3px;
  height: 3px;
  background: white;
  border-radius: 50%;
  box-shadow:
    0 0 3px 1px rgba(77, 151, 209, 0.5),
    0 0 5px 2px rgba(224, 92, 147, 0.3);
  opacity: 0;
  pointer-events: none;
}

.send-btn-star:nth-child(1) {
  top: -8px;
  left: 50%;
  animation: flying-star-3 5s ease-in-out infinite;
}

.send-btn-star:nth-child(2) {
  bottom: -8px;
  right: 50%;
  animation: flying-star-4 4.5s ease-in-out infinite 1s;
}

.send-btn-star:nth-child(3) {
  top: 50%;
  right: -8px;
  animation: flying-star-5 3.5s ease-in-out infinite 0.5s;
}

@keyframes flying-star-3 {
  0% {
    opacity: 0;
    transform: translate(0, 0) scale(0.5);
  }
  20% {
    opacity: 1;
  }
  80% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(0, -15px) scale(1.2);
  }
}

@keyframes flying-star-4 {
  0% {
    opacity: 0;
    transform: translate(0, 0) scale(0.5);
  }
  20% {
    opacity: 1;
  }
  80% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(0, 15px) scale(1.2);
  }
}

@keyframes flying-star-5 {
  0% {
    opacity: 0;
    transform: translate(0, 0) scale(0.5);
  }
  20% {
    opacity: 1;
  }
  80% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(15px, 0) scale(1.2);
  }
}

/* Dark mode adjustments for stars */
[data-theme="dark"] #chat-send-btn::before,
[data-theme="dark"] #chat-send-btn::after,
[data-theme="dark"] .send-btn-star {
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.2),
    0 0 5px 2px rgba(77, 151, 209, 0.5),
    0 0 8px 3px rgba(224, 92, 147, 0.4);
}

#chat-send-btn.sending {
  transform: scale(0.95);
  background-color: var(--chat-button-hover-bg);
  transition: transform 0.15s ease, background-color 0.15s ease;
}

/* Magic particles for send button animation */
.magic-particle {
  position: absolute;
  border-radius: 50%;
  opacity: 1;
  pointer-events: none;
  transition: transform 1s cubic-bezier(0.16, 1, 0.3, 1), opacity 1s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 10;
  box-shadow: 0 0 10px 2px rgba(255, 255, 255, 0.3);
}

[data-theme="dark"] .magic-particle {
  box-shadow: 0 0 15px 3px rgba(255, 255, 255, 0.5);
}

/* Global Floating Chat Button */
.chat-button {
  position: fixed;
  bottom: 80px; /* Higher than the contact button's 20px */
  right: 20px;
  background-color: transparent; /* Removed background */
  width: var(--chat-icon-size);
  height: var(--chat-icon-size);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  /* Slightly lower z-index than chat widget, so the widget is on top */
  z-index: 9998;
  transition: transform 0.3s ease;
  overflow: visible;
  /* Ensure no background is visible */
  background: none;
  border: none;
  padding: 0;
  outline: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}

/* Crystal ball icon specific styling */
.chat-button img, .chat-button object {
  width: 100%;
  height: 100%;
  transition: transform 0.3s ease, filter 0.3s ease;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.2)) drop-shadow(0 0 10px rgba(0, 128, 255, 0.4));
  animation: subtle-float 5s ease-in-out infinite;
  background: none;
  background-color: transparent;
}

/* Subtle floating animation for the crystal ball */
@keyframes subtle-float {
  0% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-5px);
  }
  100% {
    transform: translateY(0);
  }
}

/* Add hover effect for the crystal ball */
.chat-button:hover img, .chat-button:hover object {
  transform: scale(1.1);
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.3)) drop-shadow(0 0 15px rgba(0, 128, 255, 0.6)) drop-shadow(0 0 10px rgba(255, 51, 133, 0.4));
  animation-play-state: paused;
}

[data-theme="dark"] .chat-button:hover img, [data-theme="dark"] .chat-button:hover object {
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.5)) drop-shadow(0 0 20px rgba(77, 151, 209, 0.8)) drop-shadow(0 0 15px rgba(255, 51, 133, 0.6));
}

/* Glowing animation for the crystal ball when chat opens */
@keyframes crystal-glow {
  0% {
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.2));
  }
  50% {
    filter: drop-shadow(0 0 15px rgba(77, 151, 209, 0.7)) drop-shadow(0 0 25px rgba(224, 92, 147, 0.5));
  }
  100% {
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.2));
  }
}

/* "Hide behind chat window" animation */
.chat-button {
  transition: transform 0.4s ease, opacity 0.4s ease;
}

.chat-button.agent-hidden {
  /* Move it slightly down/right and reduce size + fade out */
  transform: translate(60px, 30px) scale(0.5);
  opacity: 0;
}

/* Card with Robot Icon Overlay */
.card {
  position: relative;
}

.card .chat-icon-overlay {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 40px;
  height: 40px;
  background-color: var(--chat-button-bg);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
  transform: translateY(-10px);
  z-index: 1100;
}

.card:hover .chat-icon-overlay {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.chat-icon-overlay img {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

/* Placeholder styling for empty input */
#chat-input::placeholder {
  color: #999; /* Medium gray color for placeholder text */
}

[data-theme="dark"] #chat-input::placeholder {
  color: #aaa; /* Lighter gray for dark mode placeholder */
}

/* Input disabled state */
#chat-input:disabled {
  background-color: rgba(0, 0, 0, 0.05);
  color: #999;
  cursor: not-allowed;
}

[data-theme="dark"] #chat-input:disabled {
  background-color: rgba(0, 0, 0, 0.3);
  color: #777;
}

/* Contact Chat Button */
.contact-chat-btn {
  background: rgba(74, 144, 226, 0.08) !important;
  border: 1px solid rgba(74, 144, 226, 0.15) !important;
  color: var(--brand-blue) !important;
  padding: 8px 16px !important;
  border-radius: 20px !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
  white-space: nowrap !important;
  backdrop-filter: blur(10px) !important;
  margin-left: 0 !important;
}

.contact-chat-btn:hover {
  background: rgba(22, 119, 255, 0.15) !important;
  border-color: rgba(22, 119, 255, 0.4) !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 4px 12px rgba(22, 119, 255, 0.2) !important;
}

.contact-chat-btn:active {
  transform: translateY(0) !important;
  box-shadow: 0 2px 6px rgba(22, 119, 255, 0.2) !important;
}

/* Dark mode adjustments for contact button */
[data-theme="dark"] .contact-chat-btn {
  background: rgba(74, 144, 226, 0.12) !important;
  border-color: rgba(74, 144, 226, 0.25) !important;
  color: #4D97D1 !important;
}

[data-theme="dark"] .contact-chat-btn:hover {
  background: rgba(22, 119, 255, 0.25) !important;
  border-color: rgba(22, 119, 255, 0.5) !important;
  box-shadow: 0 4px 12px rgba(22, 119, 255, 0.3) !important;
}

/* Typing indicator */
.typing-indicator {
  padding: 0;
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  animation: message-appear 0.3s ease-out forwards;
  opacity: 0;
  transform: translateY(10px);
}

.typing-indicator .dots {
  display: inline-flex;
  align-items: center;
  height: 36px;
  padding: 0 16px;
  background: var(--chat-bot-bubble);
  border-radius: 18px;
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  position: relative;
  margin-right: 20px;
}

.typing-indicator .dots::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0.1) 50%, rgba(255,255,255,0) 100%);
  background-size: 200% 100%;
  animation: shimmer 2s infinite;
  border-radius: inherit;
  pointer-events: none;
}

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

.typing-indicator .dots span {
  height: 8px;
  width: 8px;
  float: left;
  margin: 0 3px;
  background-color: var(--chat-button-bg);
  display: block;
  border-radius: 50%;
  opacity: 0.6;
  transform-origin: center center;
}

.typing-indicator .dots span:nth-of-type(1) {
  animation: typing 1s infinite cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

.typing-indicator .dots span:nth-of-type(2) {
  animation: typing 1s infinite 0.2s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

.typing-indicator .dots span:nth-of-type(3) {
  animation: typing 1s infinite 0.4s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

@keyframes typing {
  0% {
    transform: translateY(0px) scale(1);
    opacity: 0.6;
  }
  50% {
    transform: translateY(-6px) scale(1.2);
    opacity: 0.9;
  }
  100% {
    transform: translateY(0px) scale(1);
    opacity: 0.6;
  }
}

/* Context-specific styling */
.chat-message.bot.solutions-context .message-content {
  border-left: 4px solid var(--primary-blue);
  background: linear-gradient(135deg, rgba(77, 151, 209, 0.1) 0%, rgba(77, 151, 209, 0.2) 100%);
  position: relative;
  overflow: hidden;
}

.chat-message.bot.solutions-context .message-content::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: url('../images/icons/chip.svg') no-repeat right bottom;
  background-size: 40px;
  opacity: 0.07;
  pointer-events: none;
}

.chat-message.bot.consulting-context .message-content {
  border-left: 4px solid var(--secondary-yellow);
  background: linear-gradient(135deg, rgba(255, 214, 51, 0.1) 0%, rgba(255, 214, 51, 0.2) 100%);
  position: relative;
  overflow: hidden;
}

.chat-message.bot.consulting-context .message-content::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: url('../images/icons/chart.svg') no-repeat right bottom;
  background-size: 40px;
  opacity: 0.07;
  pointer-events: none;
}

.chat-message.bot.products-context .message-content {
  border-left: 4px solid var(--secondary-pink);
  background: linear-gradient(135deg, rgba(224, 92, 147, 0.1) 0%, rgba(224, 92, 147, 0.2) 100%);
  position: relative;
  overflow: hidden;
}

.chat-message.bot.products-context .message-content::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: url('../images/icons/device.svg') no-repeat right bottom;
  background-size: 40px;
  opacity: 0.07;
  pointer-events: none;
}

/* Dark mode context-specific styling */
[data-theme="dark"] .chat-message.bot.solutions-context .message-content {
  border-left: 4px solid rgba(77, 151, 209, 0.8);
  background: linear-gradient(135deg, rgba(77, 151, 209, 0.15) 0%, rgba(77, 151, 209, 0.25) 100%);
}

[data-theme="dark"] .chat-message.bot.consulting-context .message-content {
  border-left: 4px solid rgba(255, 214, 51, 0.8);
  background: linear-gradient(135deg, rgba(255, 214, 51, 0.15) 0%, rgba(255, 214, 51, 0.25) 100%);
}

[data-theme="dark"] .chat-message.bot.products-context .message-content {
  border-left: 4px solid rgba(224, 92, 147, 0.8);
  background: linear-gradient(135deg, rgba(224, 92, 147, 0.15) 0%, rgba(224, 92, 147, 0.25) 100%);
}

/* Dark mode adjustments for typing indicator */
[data-theme="dark"] .typing-indicator .dots {
  background: var(--chat-bot-bubble);
}

[data-theme="dark"] .typing-indicator .dots span {
  background-color: rgba(255, 255, 255, 0.7);
}

/* Turnstile styling */
.chat-turnstile-wrapper {
  padding: 16px;
  border-top: 1px solid var(--chat-border-color);
  background-color: var(--chat-bg);
  display: flex;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

/* Add subtle glow effect to Turnstile area */
.chat-turnstile-wrapper::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(0,102,179,0.05) 0%, rgba(0,102,179,0) 50%, rgba(0,102,179,0.05) 100%);
  pointer-events: none;
  animation: turnstile-bg-shift 8s ease-in-out infinite alternate;
}

@keyframes turnstile-bg-shift {
  0% { background-position: 0% 0%; }
  100% { background-position: 100% 100%; }
}

/* Center the Turnstile widget in the chat */
.chat-turnstile-wrapper iframe {
  margin: 0 auto;
  max-width: 100%;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* Add a subtle animation to draw attention to the verification */
.chat-turnstile-wrapper > div {
  animation: turnstile-pulse 2s infinite;
  position: relative;
  z-index: 1;
}

/* Pulse animation for Turnstile widget */
@keyframes turnstile-pulse {
  0% {
    transform: scale(1);
    opacity: 1;
    box-shadow: 0 0 0 rgba(0, 102, 179, 0);
  }
  50% {
    transform: scale(1.02);
    opacity: 0.95;
    box-shadow: 0 0 10px rgba(0, 102, 179, 0.2);
  }
  100% {
    transform: scale(1);
    opacity: 1;
    box-shadow: 0 0 0 rgba(0, 102, 179, 0);
  }
}

/* Document Links Styling */
.document-links {
  margin-top: 16px;
  font-size: 0.9em;
  padding-top: 12px;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] .document-links {
  border-top-color: rgba(255, 255, 255, 0.1);
}

.document-links strong {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
}

.document-links ul {
  margin: 0;
  padding-left: 20px;
  list-style-type: disc;
}

.document-links li {
  margin-bottom: 6px;
  line-height: 1.4;
}

.document-links a {
  color: var(--primary-blue, #0066B3);
  text-decoration: none;
  word-break: break-all;
  transition: color 0.2s ease;
}

.document-links a:hover {
  text-decoration: underline;
  color: var(--chat-button-hover-bg, #00509e);
}

[data-theme="dark"] .document-links a {
  color: #4d9eff;
}

[data-theme="dark"] .document-links a:hover {
  color: #7cb8ff;
}

/* Message content formatting */
.message-content p {
  margin: 0 0 12px 0;
  padding: 0;
}

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

.message-content ul,
.message-content ol {
  margin: 8px 0 12px 0;
  padding-left: 20px;
}

.message-content li {
  margin-bottom: 6px;
}

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

.message-content strong {
  font-weight: 600;
}

.message-content em {
  font-style: italic;
}

/* Message content links */
.message-content a {
  color: var(--primary-blue, #0066B3);
  text-decoration: none;
  word-break: break-all;
  transition: color 0.2s ease;
}

.message-content a:hover {
  text-decoration: underline;
  color: var(--chat-button-hover-bg, #00509e);
}

[data-theme="dark"] .message-content a {
  color: #4d9eff;
}

[data-theme="dark"] .message-content a:hover {
  color: #7cb8ff;
}

/* Responsive Adjustments */
@media (max-width: 600px) {
  .chat-widget {
    width: 90%;
    right: 5%;
    max-height: 80vh;
    bottom: 70px;
  }

  .chat-header {
    padding: 12px;
  }

  .chat-messages {
    padding: 12px;
  }

  .message-content {
    max-width: 90%;
  }

  .chat-input-area {
    padding: 10px;
  }

  #chat-input {
    padding: 10px 12px;
    font-size: 14px;
  }

  .chat-turnstile-wrapper {
    transform: scale(0.9);
    transform-origin: center top;
    padding: 10px;
  }
}

/* Reduced Motion Preferences */
@media (prefers-reduced-motion: reduce) {
  .chat-widget,
  .chat-button,
  .chat-icon-overlay,
  .typing-indicator .dots span,
  .chat-turnstile-wrapper > div,
  .chat-header::before,
  .chat-turnstile-wrapper::before,
  .chat-message,
  .chat-header-icon,
  .typing-indicator .dots::before {
    animation: none !important;
    transition: none !important;
  }

  /* Ensure elements are still visible and functional without animations */
  .chat-message {
    opacity: 1;
    transform: none;
  }

  .typing-indicator {
    opacity: 1;
    transform: none;
  }
}