/* ===== CHAT WIDGET STYLES ===== */
.chat-widget {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 1000;
  font-family: var(--font-primary);
}

.chat-toggle {
  width: 60px;
  height: 60px;
  background-color: var(--primary-color);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(248, 116, 102, 0.3);
  transition: var(--transition);
  animation: pulse 2s infinite;
}

.chat-toggle:hover {
  background-color: var(--primary-dark);
  transform: scale(1.1);
}

.chat-icon {
  font-size: 24px;
  color: var(--white);
}

@keyframes pulse {
  0% {
    box-shadow: 0 4px 12px rgba(248, 116, 102, 0.3);
  }
  50% {
    box-shadow: 0 4px 20px rgba(248, 116, 102, 0.5);
  }
  100% {
    box-shadow: 0 4px 12px rgba(248, 116, 102, 0.3);
  }
}

.chat-container {
  position: absolute;
  bottom: 80px;
  right: 0;
  width: 350px;
  max-height: 500px;
  background-color: var(--white);
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.95);
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chat-container.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.chat-header {
  background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
  color: var(--white);
  padding: 1rem;
  position: relative;
}

.chat-header h3 {
  margin: 0;
  font-size: 1.1rem;
  color: var(--white);
}

.chat-disclaimer {
  font-size: 0.75rem;
  background-color: rgba(255, 255, 255, 0.15);
  padding: 0.75rem;
  border-radius: 6px;
  margin: 0.75rem 0 0 0;
  border: 1px solid rgba(255, 255, 255, 0.2);
  line-height: 1.4;
}

.chat-disclaimer strong {
  color: #ffe066;
  display: block;
  margin-bottom: 0.25rem;
}

.chat-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  color: var(--white);
  font-size: 24px;
  cursor: pointer;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.chat-close:hover {
  background-color: rgba(255, 255, 255, 0.2);
}

.chat-messages {
  flex: 1;
  padding: 1rem;
  overflow-y: auto;
  max-height: 300px;
  scroll-behavior: smooth;
}

.chat-messages::-webkit-scrollbar {
  width: 4px;
}

.chat-messages::-webkit-scrollbar-track {
  background: var(--light-gray);
}

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

.message {
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
}

.message p {
  margin: 0.25rem 0;
  padding: 0.75rem 1rem;
  border-radius: 18px;
  font-size: 0.9rem;
  line-height: 1.4;
  max-width: 80%;
}

.message em {
  font-size: 0.8rem;
  color: var(--dark-gray);
  margin-top: 0.25rem;
}

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

.bot-message p {
  background-color: var(--light-gray);
  color: var(--dark-gray);
  border-bottom-left-radius: 4px;
}

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

.user-message p {
  background-color: var(--primary-color);
  color: var(--white);
  border-bottom-right-radius: 4px;
}

.chat-input-container {
  display: flex;
  padding: 1rem;
  border-top: 1px solid var(--medium-gray);
  gap: 0.5rem;
  align-items: center;
}

#chat-input {
  flex: 1;
  padding: 0.75rem;
  border: 1px solid var(--medium-gray);
  border-radius: 20px;
  font-size: 0.9rem;
  font-family: var(--font-primary);
  outline: none;
  transition: var(--transition);
}

#chat-input:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(248, 116, 102, 0.2);
}

#chat-send {
  background-color: var(--primary-color);
  color: var(--white);
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  font-size: 14px;
}

#chat-send:hover {
  background-color: var(--primary-dark);
  transform: scale(1.1);
}

#chat-send:disabled {
  background-color: var(--medium-gray);
  cursor: not-allowed;
  transform: none;
}

/* Typing indicator */
.typing-indicator {
  display: flex;
  align-items: center;
  padding: 0.75rem 1rem;
  background-color: var(--light-gray);
  border-radius: 18px;
  border-bottom-left-radius: 4px;
  max-width: 80px;
  margin-bottom: 1rem;
}

.typing-dots {
  display: flex;
  gap: 3px;
}

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

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

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

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

/* Quick action buttons */
.quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1rem 0;
}

.quick-action {
  background-color: var(--white);
  border: 1px solid var(--primary-color);
  color: var(--primary-color);
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: var(--transition);
}

.quick-action:hover {
  background-color: var(--primary-color);
  color: var(--white);
}

/* Error states */
.error-message {
  background-color: #fee;
  color: #c33;
  border: 1px solid #fcc;
  padding: 0.75rem;
  border-radius: 6px;
  margin: 0.5rem 0;
  font-size: 0.8rem;
}

.connection-status {
  font-size: 0.7rem;
  text-align: center;
  padding: 0.5rem;
  background-color: var(--light-gray);
  color: var(--dark-gray);
}

.connection-status.connected {
  background-color: #d4edda;
  color: #155724;
}

.connection-status.disconnected {
  background-color: #f8d7da;
  color: #721c24;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
  .chat-widget {
    right: 10px;
    bottom: 10px;
  }

  .chat-container {
    width: calc(100vw - 20px);
    max-width: 350px;
    right: -10px;
  }

  .chat-toggle {
    width: 50px;
    height: 50px;
  }

  .chat-icon {
    font-size: 20px;
  }

  .chat-header {
    padding: 0.75rem;
  }

  .chat-disclaimer {
    font-size: 0.7rem;
    padding: 0.5rem;
  }

  .message p {
    font-size: 0.85rem;
    padding: 0.6rem 0.8rem;
  }
}

@media (max-width: 480px) {
  .chat-container {
    bottom: 70px;
    right: -15px;
    width: calc(100vw - 10px);
  }

  .message p {
    max-width: 85%;
  }
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
  .chat-toggle {
    animation: none;
  }

  .typing-dot {
    animation: none;
  }

  .chat-container {
    transition: opacity 0.2s ease;
  }
}

/* High contrast mode */
@media (prefers-contrast: high) {
  .chat-container {
    border: 2px solid var(--black);
  }

  .bot-message p {
    background-color: var(--white);
    border: 1px solid var(--black);
    color: var(--black);
  }

  .user-message p {
    background-color: var(--black);
    color: var(--white);
  }

  #chat-input {
    border: 2px solid var(--black);
  }
}