/* public_html/chatbot/chatbot.css */
:root {
  --chat-primary: var(--blue-500, #2563eb);
  --chat-primary-hover: var(--blue-600, #1d4ed8);
  --chat-bg: #ffffff;
  --chat-surface: #f8fafc;
  --chat-border: #e2e8f0;
  --chat-text: #1e293b;
  --chat-text-muted: #64748b;
  --chat-user-msg: var(--chat-primary);
  --chat-bot-msg: #f1f5f9;
  --chat-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
  --chat-radius: 16px;
  --chat-z: 99999;
}

/* Chatbot FAB */
.ast-chatbot-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 60px;
  height: 60px;
  background: var(--chat-primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--chat-shadow);
  z-index: var(--chat-z);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), background 0.3s ease;
  border: none;
  outline: none;
  color: white;
}

.ast-chatbot-fab:hover {
  transform: scale(1.05) translateY(-2px);
  background: var(--chat-primary-hover);
}

.ast-chatbot-fab svg {
  width: 28px;
  height: 28px;
  fill: currentColor;
}

.ast-chatbot-fab-pulse {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  border-radius: 50%;
  background: var(--chat-primary);
  opacity: 0.6;
  z-index: -1;
  animation: ast-chat-pulse 2s infinite;
}

@keyframes ast-chat-pulse {
  0% { transform: scale(1); opacity: 0.6; }
  100% { transform: scale(1.5); opacity: 0; }
}

/* Chatbot Panel */
.ast-chatbot-panel {
  position: fixed;
  bottom: 100px;
  right: 24px;
  width: 380px;
  height: 600px;
  max-height: calc(100vh - 120px);
  background: var(--chat-bg);
  border-radius: var(--chat-radius);
  box-shadow: var(--chat-shadow);
  z-index: var(--chat-z);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateY(20px) scale(0.95);
  transform-origin: bottom right;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: var(--font-sans, system-ui, -apple-system, sans-serif);
}

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

/* Header */
.ast-chat-header {
  background: var(--chat-primary);
  color: white;
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.ast-chat-header-info {
  display: flex;
  flex-direction: column;
}

.ast-chat-title {
  font-weight: 600;
  font-size: 1.1rem;
  line-height: 1.2;
}

.ast-chat-status {
  font-size: 0.8rem;
  opacity: 0.9;
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 2px;
}
.ast-chat-status::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  background: #4ade80;
  border-radius: 50%;
}

.ast-chat-actions {
  display: flex;
  gap: 8px;
}
.ast-chat-btn-icon {
  background: transparent;
  border: none;
  color: white;
  opacity: 0.8;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: opacity 0.2s, background 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ast-chat-btn-icon:hover {
  opacity: 1;
  background: rgba(255,255,255,0.1);
}
.ast-chat-btn-icon svg {
  width: 20px;
  height: 20px;
}

/* Messages Area */
.ast-chat-messages {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: var(--chat-surface);
  scroll-behavior: smooth;
}

/* Scrollbar */
.ast-chat-messages::-webkit-scrollbar { width: 6px; }
.ast-chat-messages::-webkit-scrollbar-track { background: transparent; }
.ast-chat-messages::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.1); border-radius: 3px; }

/* Message Bubbles */
.ast-msg-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 85%;
}
.ast-msg-bot { align-self: flex-start; }
.ast-msg-user { align-self: flex-end; }

.ast-msg-bubble {
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 0.95rem;
  line-height: 1.5;
  position: relative;
  word-wrap: break-word;
}
.ast-msg-bot .ast-msg-bubble {
  background: var(--chat-bot-msg);
  color: var(--chat-text);
  border-bottom-left-radius: 4px;
}
.ast-msg-user .ast-msg-bubble {
  background: var(--chat-user-msg);
  color: white;
  border-bottom-right-radius: 4px;
}

/* Quick Actions */
.ast-chat-quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}
.ast-quick-btn {
  background: white;
  border: 1px solid var(--chat-primary);
  color: var(--chat-primary);
  padding: 8px 14px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}
.ast-quick-btn:hover {
  background: var(--chat-primary);
  color: white;
}

/* Input Area */
.ast-chat-input-area {
  padding: 16px;
  background: var(--chat-bg);
  border-top: 1px solid var(--chat-border);
  display: flex;
  gap: 12px;
  align-items: flex-end;
}
.ast-chat-input-wrapper {
  flex: 1;
  background: var(--chat-surface);
  border: 1px solid var(--chat-border);
  border-radius: 20px;
  padding: 0 16px;
  display: flex;
  align-items: center;
}
.ast-chat-input {
  width: 100%;
  border: none;
  background: transparent;
  padding: 12px 0;
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--chat-text);
  outline: none;
  resize: none;
  max-height: 100px;
}
.ast-chat-input::placeholder { color: var(--chat-text-muted); }

.ast-chat-send {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--chat-primary);
  color: white;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  flex-shrink: 0;
}
.ast-chat-send:disabled {
  background: var(--chat-border);
  cursor: not-allowed;
  color: var(--chat-text-muted);
}
.ast-chat-send:not(:disabled):hover { background: var(--chat-primary-hover); transform: scale(1.05); }
.ast-chat-send svg { width: 20px; height: 20px; fill: currentColor; }

/* Typing Indicator */
.ast-typing {
  display: flex;
  gap: 4px;
  padding: 16px 20px;
  align-items: center;
  background: var(--chat-bot-msg);
  border-radius: 12px;
  border-bottom-left-radius: 4px;
  width: fit-content;
}
.ast-dot {
  width: 6px;
  height: 6px;
  background: var(--chat-text-muted);
  border-radius: 50%;
  animation: ast-bounce 1.4s infinite ease-in-out both;
}
.ast-dot:nth-child(1) { animation-delay: -0.32s; }
.ast-dot:nth-child(2) { animation-delay: -0.16s; }
@keyframes ast-bounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
  .ast-chatbot-panel {
    bottom: 0;
    right: 0;
    width: 100%;
    height: 100dvh;
    max-height: none;
    border-radius: 0;
    transform: translateY(100%);
  }
  .ast-chatbot-fab {
    bottom: 16px;
    right: 16px;
  }
}
