/* ============================================
   YUGM AI — Chatbot (UMAI) & Floating Actions
   ============================================ */

/* --- Chatbot Button --- */
.chatbot-trigger {
  position: fixed;
  bottom: var(--space-6);
  left: var(--space-6);
  z-index: var(--z-chatbot);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 0.9rem 1.15rem;
  background: linear-gradient(135deg, var(--color-accent), var(--color-accent-strong));
  color: white;
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  cursor: pointer;
  box-shadow: 0 18px 34px rgba(32, 131, 255, 0.22);
  transition: all var(--transition-base);
  border: none;
}

.chatbot-trigger:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 30px rgba(26, 115, 232, 0.5);
}

.chatbot-trigger svg {
  width: 20px;
  height: 20px;
}

.chatbot-trigger.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(20px);
}

/* --- Chat Window --- */
.chatbot-window {
  position: fixed;
  bottom: var(--space-6);
  left: var(--space-6);
  z-index: var(--z-chatbot);
  width: 380px;
  height: 520px;
  background: linear-gradient(180deg, rgba(16, 27, 44, 0.94), rgba(8, 15, 26, 0.98));
  border: 1px solid rgba(178, 191, 212, 0.12);
  border-radius: var(--radius-2xl);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.95);
  transition: all var(--transition-base);
}

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

/* Chat Header */
.chatbot-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  background: rgba(4, 9, 16, 0.65);
  border-bottom: 1px solid rgba(178, 191, 212, 0.1);
}

.chatbot-header-info {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.chatbot-avatar {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--color-accent), var(--color-accent-light));
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
}

.chatbot-avatar svg {
  width: 18px;
  height: 18px;
  color: white;
}

.chatbot-header-title {
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: var(--font-bold);
  color: var(--color-text-white);
}

.chatbot-header-status {
  font-size: var(--text-xs);
  color: var(--color-success);
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.chatbot-header-status .dot {
  width: 6px;
  height: 6px;
  background: var(--color-success);
  border-radius: var(--radius-full);
}

.chatbot-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  color: var(--color-text-white-secondary);
  cursor: pointer;
  background: none;
  border: none;
  transition: all var(--transition-fast);
}

.chatbot-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--color-text-white);
}

.chatbot-close svg {
  width: 18px;
  height: 18px;
}

/* Chat Messages Area */
.chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

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

.chatbot-messages::-webkit-scrollbar-track {
  background: transparent;
}

.chatbot-messages::-webkit-scrollbar-thumb {
  background: var(--color-border-dark);
  border-radius: 2px;
}

/* Chat Bubbles */
.chat-message {
  max-width: 80%;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.chat-message.user {
  align-self: flex-end;
}

.chat-message.assistant {
  align-self: flex-start;
}

.chat-bubble {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-lg);
  font-size: var(--text-sm);
  line-height: 1.6;
  word-wrap: break-word;
}

.chat-message.user .chat-bubble {
  background: var(--color-chat-user);
  color: #000;
  border-bottom-right-radius: var(--radius-sm);
}

.chat-message.assistant .chat-bubble {
  background: rgba(255, 255, 255, 0.08);
  color: var(--color-text-white);
  border-bottom-left-radius: var(--radius-sm);
}

.chat-time {
  font-size: calc(var(--text-xs) - 1px);
  color: var(--color-text-muted);
}

.chat-message.user .chat-time {
  text-align: right;
}

/* Typing indicator */
.typing-indicator {
  display: none;
  align-self: flex-start;
}

.typing-indicator.active {
  display: flex;
}

.typing-dots {
  display: flex;
  gap: 4px;
  padding: var(--space-3) var(--space-4);
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-lg);
  border-bottom-left-radius: var(--radius-sm);
}

.typing-dots span {
  width: 6px;
  height: 6px;
  background: #888;
  border-radius: var(--radius-full);
  animation: typing 1.4s infinite;
}

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

@keyframes typing {
  0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-4px); }
}

/* Chat Input */
.chatbot-input {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid rgba(178, 191, 212, 0.1);
  background: rgba(4, 9, 16, 0.72);
}

.chatbot-input input {
  flex: 1;
  padding: var(--space-3) var(--space-4);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(178, 191, 212, 0.12);
  border-radius: var(--radius-full);
  color: var(--color-text-white);
  font-size: var(--text-sm);
}

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

.chatbot-input input::placeholder {
  color: var(--color-text-muted);
}

.chatbot-send {
  width: 40px;
  height: 40px;
  background: var(--color-accent);
  border: none;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background var(--transition-fast);
}

.chatbot-send:hover {
  background: var(--color-accent-hover);
}

.chatbot-send svg {
  width: 18px;
  height: 18px;
  color: white;
}

/* --- Floating Action Shortcuts --- */
.floating-actions {
  position: fixed;
  bottom: var(--space-8);
  right: var(--space-8);
  z-index: var(--z-fab);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.fab-btn {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  background: var(--color-accent);
  color: white;
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  cursor: pointer;
  border: none;
  box-shadow: 0 16px 30px rgba(32, 131, 255, 0.18);
  transition: all var(--transition-base);
  white-space: nowrap;
}

.fab-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 30px rgba(26, 115, 232, 0.5);
}

.fab-btn svg {
  width: 18px;
  height: 18px;
}

.fab-btn.secondary {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border-dark);
  color: var(--color-text-white);
  box-shadow: var(--shadow-lg);
}

.fab-btn.secondary:hover {
  border-color: var(--color-accent);
  box-shadow: var(--shadow-glow);
}

/* Mobile FAB */
.fab-mobile-trigger {
  display: none;
  width: 56px;
  height: 56px;
  background: var(--color-accent);
  border: none;
  border-radius: var(--radius-full);
  color: white;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(26, 115, 232, 0.4);
  transition: all var(--transition-base);
}

.fab-mobile-trigger svg {
  width: 24px;
  height: 24px;
  transition: transform var(--transition-base);
}

.fab-mobile-trigger.active svg {
  transform: rotate(45deg);
}

.fab-expanded {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .chatbot-trigger {
    bottom: var(--space-4);
    left: var(--space-4);
  }
  
  .chatbot-window {
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 0;
  }
  
  .floating-actions {
    bottom: var(--space-4);
    right: var(--space-4);
  }
  
  .fab-expanded {
    display: none;
  }
  
  .fab-mobile-trigger {
    display: flex;
  }
  
  .floating-actions.expanded .fab-expanded {
    display: flex;
  }
}
