/* ===== AI Assistant Chatbot ===== */
:root {
  --chatbot-primary: #6C63FF;
  --chatbot-primary-light: #8B85FF;
  --chatbot-bubble-size: 60px;
  --chatbot-panel-width: 380px;
  --chatbot-panel-height: 520px;
}

/* Floating Bubble */
.ai-chatbot-bubble {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: var(--chatbot-bubble-size);
  height: var(--chatbot-bubble-size);
  border-radius: 50%;
  background: linear-gradient(135deg, var(--chatbot-primary), #00D4AA);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(108, 99, 255, 0.4);
  z-index: 500;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
  animation: chatbotBounceIn 0.5s ease;
}

.ai-chatbot-bubble:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 28px rgba(108, 99, 255, 0.5);
}

.ai-chatbot-bubble .material-symbols-rounded {
  font-size: 28px;
  color: white;
  transition: transform 0.3s ease;
}

.ai-chatbot-bubble-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.ai-chatbot-bubble.active .ai-chatbot-bubble-icon,
.ai-chatbot-bubble.active .material-symbols-rounded {
  transform: rotate(90deg);
}

@keyframes chatbotBounceIn {
  0% { transform: scale(0); opacity: 0; }
  50% { transform: scale(1.15); }
  100% { transform: scale(1); opacity: 1; }
}

/* Chat Panel */
.ai-chatbot-panel {
  position: fixed;
  bottom: 100px;
  right: 24px;
  width: var(--chatbot-panel-width);
  height: var(--chatbot-panel-height);
  max-height: calc(100vh - 140px);
  background: var(--bg-card, #fff);
  border: 1px solid var(--border-color, rgba(0,0,0,0.08));
  border-radius: 16px;
  box-shadow: 0 12px 48px rgba(0,0,0,0.15);
  display: flex;
  flex-direction: column;
  z-index: 499;
  overflow: hidden;
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.ai-chatbot-panel.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* Header */
.ai-chatbot-header {
  padding: 16px 18px;
  background: linear-gradient(135deg, var(--chatbot-primary), #00D4AA);
  color: white;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.ai-chatbot-header-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  overflow: hidden;
}

.ai-chatbot-header-avatar .ai-chatbot-avatar-img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
}

.ai-chatbot-header-info {
  flex: 1;
}

.ai-chatbot-header-info h4 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}

.ai-chatbot-header-info span {
  font-size: 11px;
  opacity: 0.85;
}

.ai-chatbot-close {
  background: rgba(255,255,255,0.2);
  border: none;
  border-radius: 8px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: white;
  transition: background 0.15s;
}

.ai-chatbot-close:hover {
  background: rgba(255,255,255,0.35);
}

/* Messages Area */
.ai-chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}

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

.ai-chatbot-messages::-webkit-scrollbar-thumb {
  background: var(--border-color, rgba(0,0,0,0.1));
  border-radius: 4px;
}

/* Message Bubbles */
.ai-chatbot-msg {
  display: flex;
  gap: 8px;
  max-width: 88%;
  animation: chatbotFadeIn 0.3s ease;
}

.ai-chatbot-msg.bot {
  align-self: flex-start;
}

.ai-chatbot-msg.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.ai-chatbot-msg-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  margin-top: 2px;
  overflow: hidden;
}

.ai-chatbot-msg-avatar .ai-chatbot-avatar-img {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
}

.ai-chatbot-msg.bot .ai-chatbot-msg-avatar {
  background: linear-gradient(135deg, var(--chatbot-primary), #00D4AA);
  color: white;
}

.ai-chatbot-msg.user .ai-chatbot-msg-avatar {
  background: var(--bg-elevated, #f0f0f0);
  color: var(--text-secondary, #666);
}

.ai-chatbot-msg-bubble {
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.5;
  word-break: break-word;
}

.ai-chatbot-msg.bot .ai-chatbot-msg-bubble {
  background: var(--bg-elevated, #f0f0f0);
  color: var(--text-primary, #1a1a2e);
  border-bottom-left-radius: 4px;
}

.ai-chatbot-msg.user .ai-chatbot-msg-bubble {
  background: var(--chatbot-primary);
  color: white;
  border-bottom-right-radius: 4px;
}

.ai-chatbot-msg-bubble a {
  color: var(--chatbot-primary-light, #8B85FF);
  text-decoration: underline;
}

.ai-chatbot-msg.user .ai-chatbot-msg-bubble a {
  color: white;
}

/* Typing Indicator */
.ai-chatbot-typing {
  display: flex;
  gap: 4px;
  padding: 10px 14px;
  background: var(--bg-elevated, #f0f0f0);
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  width: fit-content;
}

.ai-chatbot-typing span {
  width: 7px;
  height: 7px;
  background: var(--text-tertiary, #999);
  border-radius: 50%;
  animation: chatbotTyping 1.2s infinite;
}

.ai-chatbot-typing span:nth-child(2) { animation-delay: 0.15s; }
.ai-chatbot-typing span:nth-child(3) { animation-delay: 0.3s; }

@keyframes chatbotTyping {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-5px); opacity: 1; }
}

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

/* Quick Replies */
.ai-chatbot-quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 16px 12px;
  flex-shrink: 0;
}

.ai-chatbot-quick-reply {
  padding: 7px 14px;
  border: 1px solid var(--chatbot-primary);
  border-radius: 20px;
  background: transparent;
  color: var(--chatbot-primary);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  font-family: inherit;
}

.ai-chatbot-quick-reply:hover {
  background: var(--chatbot-primary);
  color: white;
}

/* Input Area */
.ai-chatbot-input-area {
  padding: 12px 16px;
  border-top: 1px solid var(--border-color, rgba(0,0,0,0.08));
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}

.ai-chatbot-input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--border-color, rgba(0,0,0,0.08));
  border-radius: 12px;
  background: var(--bg-input, rgba(0,0,0,0.04));
  color: var(--text-primary, #1a1a2e);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}

.ai-chatbot-input:focus {
  border-color: var(--chatbot-primary);
}

.ai-chatbot-input::placeholder {
  color: var(--text-tertiary, #999);
}

.ai-chatbot-send {
  width: 38px;
  height: 38px;
  border: none;
  border-radius: 50%;
  background: var(--chatbot-primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s, transform 0.15s;
  flex-shrink: 0;
}

.ai-chatbot-send:hover {
  background: var(--chatbot-primary-light);
  transform: scale(1.05);
}

.ai-chatbot-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.ai-chatbot-send .material-symbols-rounded {
  font-size: 18px;
}

/* Mobile */
@media (max-width: 480px) {
  .ai-chatbot-panel {
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
  }

  .ai-chatbot-bubble {
    bottom: 16px;
    right: 16px;
    width: 52px;
    height: 52px;
  }

  .ai-chatbot-bubble .material-symbols-rounded {
    font-size: 24px;
  }

  .ai-chatbot-bubble-icon {
    width: 30px;
    height: 30px;
  }
}
