/* Business AI Assistant — Floating Chat Widget */

#ai-assistant {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 380px;
  max-height: 600px;
  background: white;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  display: none;
  flex-direction: column;
  z-index: 10000;
  overflow: hidden;
  animation: aiSlideUp 0.3s ease-out;
}

@keyframes aiSlideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.ai-assistant-header {
  background: linear-gradient(135deg, #0ea5e9 0%, #6366f1 100%);
  color: white;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ai-assistant-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  font-weight: 600;
}

.ai-assistant-title .ai-icon { font-size: 24px; }

.ai-assistant-controls { display: flex; gap: 8px; }

.ai-control-btn {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: all 0.2s;
}

.ai-control-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.1);
}

.ai-chat-container {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: #f8f9fa;
  min-height: 300px;
  max-height: 450px;
}

.ai-message {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  animation: aiMsgSlide 0.3s ease-out;
}

@keyframes aiMsgSlide {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.ai-message-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.ai-user .ai-message-icon { background: linear-gradient(135deg, #0ea5e9 0%, #6366f1 100%); }
.ai-assistant .ai-message-icon { background: linear-gradient(135deg, #f0abfc 0%, #818cf8 100%); }

.ai-message-content {
  flex: 1;
  background: white;
  padding: 12px 16px;
  border-radius: 12px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  font-size: 14px;
  line-height: 1.5;
}

.ai-user .ai-message-content {
  background: linear-gradient(135deg, #0ea5e9 0%, #6366f1 100%);
  color: white;
  margin-left: auto;
}

.ai-assistant .ai-message-content { background: white; color: #1f2937; }

.ai-system { justify-content: center; opacity: 0.7; }
.ai-system .ai-message-content {
  background: transparent;
  box-shadow: none;
  text-align: center;
  font-size: 13px;
  color: #6b7280;
}

.ai-input-container {
  padding: 16px;
  background: white;
  border-top: 1px solid #e5e7eb;
  display: flex;
  gap: 8px;
}

.ai-input-wrapper { flex: 1; }

#ai-input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  font-size: 14px;
  font-family: inherit;
  resize: none;
  transition: all 0.2s;
  box-sizing: border-box;
}

#ai-input:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.ai-input-btn {
  width: 48px;
  height: 48px;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

#ai-send-btn {
  background: linear-gradient(135deg, #0ea5e9 0%, #6366f1 100%);
  color: white;
}

#ai-send-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

#ai-mic-btn { background: #f3f4f6; color: #6b7280; }
#ai-mic-btn:hover { background: #e5e7eb; transform: scale(1.05); }

#ai-mic-btn.listening {
  background: #ef4444;
  color: white;
  animation: aiPulse 1.5s infinite;
}

@keyframes aiPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

#ai-toggle-btn {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0ea5e9 0%, #6366f1 100%);
  color: white;
  border: none;
  cursor: pointer;
  font-size: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.4);
  z-index: 9999;
  transition: all 0.3s;
}

#ai-toggle-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 12px 32px rgba(99, 102, 241, 0.5);
}

#ai-toggle-btn.hidden { display: none; }

.typing-indicator { display: flex; gap: 4px; padding: 8px 0; }

.typing-dot {
  width: 8px;
  height: 8px;
  background: #9ca3af;
  border-radius: 50%;
  animation: aiTyping 1.4s infinite;
}

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

@keyframes aiTyping {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.7; }
  30% { transform: translateY(-10px); opacity: 1; }
}

.ai-message-content ul { margin: 8px 0; padding-left: 20px; }
.ai-message-content li { margin: 4px 0; }
.ai-message-content strong { font-weight: 600; }

.ai-chat-container::-webkit-scrollbar { width: 6px; }
.ai-chat-container::-webkit-scrollbar-track { background: transparent; }
.ai-chat-container::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 3px; }

@media (max-width: 768px) {
  #ai-assistant { width: calc(100vw - 24px); max-width: 380px; bottom: 10px; right: 12px; }
  #ai-toggle-btn { bottom: 10px; right: 10px; width: 56px; height: 56px; font-size: 28px; }
}
