/* AI Agent Chat Widget Styles */
:root {
  --ai-primary-color: #3898ec;
  --ai-secondary-color: #2c7abf;
  --ai-bg-color: #ffffff;
  --ai-text-color: #333333;
  --ai-light-gray: #f4f6f8;
  --ai-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  --ai-font-family: 'Roboto', sans-serif;
  --ai-border-radius: 16px;
  --ai-transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.ai-widget-container {
  position: fixed;
  bottom: 30px;
  right: 30px;
  z-index: 9999;
  font-family: var(--ai-font-family);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  pointer-events: none; /* Allows clicking through empty space */
}

.ai-widget-container * {
  pointer-events: auto; /* Re-enable clicks for children */
  box-sizing: border-box;
}

/* Toggle Button */
.ai-toggle-btn {
  width: 60px;
  height: 60px;
  background-color: var(--ai-primary-color);
  color: white;
  border-radius: 50%;
  border: none;
  box-shadow: 0 4px 14px rgba(56, 152, 236, 0.4);
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: var(--ai-transition);
  position: relative;
  overflow: hidden;
}

.ai-toggle-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 20px rgba(56, 152, 236, 0.6);
  background-color: var(--ai-secondary-color);
}

.ai-toggle-btn svg {
  width: 32px;
  height: 32px;
  fill: currentColor;
  transition: var(--ai-transition);
}

.ai-toggle-btn.open .ai-icon-chat {
  opacity: 0;
  transform: scale(0.5) rotate(90deg);
  position: absolute;
}

.ai-toggle-btn .ai-icon-close {
  opacity: 0;
  transform: scale(0.5) rotate(-90deg);
  position: absolute;
}

.ai-toggle-btn.open .ai-icon-close {
  opacity: 1;
  transform: scale(1) rotate(0);
}

/* Chat Window */
.ai-chat-window {
  width: 380px;
  height: 550px;
  background-color: var(--ai-bg-color);
  border-radius: var(--ai-border-radius);
  box-shadow: var(--ai-shadow);
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  transform-origin: bottom right;
  transition: var(--ai-transition);
  visibility: hidden;
}

.ai-chat-window.active {
  opacity: 1;
  transform: translateY(0) scale(1);
  visibility: visible;
}

/* Header */
.ai-header {
  background: linear-gradient(135deg, var(--ai-primary-color), var(--ai-secondary-color));
  padding: 20px;
  color: white;
  display: flex;
  align-items: center;
  gap: 12px;
}

.ai-avatar {
  width: 40px;
  height: 40px;
  background-color: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 20px;
}

.ai-header-info h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.ai-header-info p {
  margin: 2px 0 0;
  font-size: 12px;
  opacity: 0.9;
}

.ai-status-dot {
  width: 8px;
  height: 8px;
  background-color: #4cd964;
  border-radius: 50%;
  display: inline-block;
  margin-right: 4px;
}

/* Messages Area */
.ai-messages {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background-color: #f9fbff;
}

.ai-message {
  max-width: 80%;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.5;
  animation: message-appear 0.3s ease-out forwards;
  opacity: 0;
  transform: translateY(10px);
}

@keyframes message-appear {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.ai-message.bot {
  background-color: white;
  color: var(--ai-text-color);
  border-bottom-left-radius: 2px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.ai-message.user {
  background-color: var(--ai-primary-color);
  color: white;
  align-self: flex-end;
  border-bottom-right-radius: 2px;
}

/* Typing Indicator */
.ai-typing {
  display: flex;
  gap: 4px;
  padding: 12px 16px;
  background-color: white;
  border-radius: 12px;
  border-bottom-left-radius: 2px;
  width: fit-content;
  align-items: center;
  margin-bottom: 10px;
}

.ai-typing-dot {
  width: 6px;
  height: 6px;
  background-color: #ccc;
  border-radius: 50%;
  animation: typing 1.4s infinite ease-in-out both;
}

.ai-typing-dot:nth-child(1) { animation-delay: -0.32s; }
.ai-typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes typing {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

/* Input Area */
.ai-input-area {
  padding: 15px;
  background-color: white;
  border-top: 1px solid #eee;
  display: flex;
  gap: 10px;
  align-items: center;
}

.ai-input {
  flex: 1;
  border: 1px solid #e0e0e0;
  border-radius: 24px;
  padding: 10px 15px;
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.ai-input:focus {
  border-color: var(--ai-primary-color);
}

.ai-send-btn {
  background: none;
  border: none;
  color: var(--ai-primary-color);
  cursor: pointer;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background-color 0.2s;
}

.ai-send-btn:hover {
  background-color: #f0f7ff;
}

.ai-send-btn svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
}

.ai-send-btn:disabled {
  color: #ccc;
  cursor: not-allowed;
}

/* Mobile Responsive */
@media (max-width: 480px) {
  .ai-chat-window {
    width: calc(100vw - 40px);
    right: 20px;
    bottom: 90px;
    height: 500px;
  }
}
