/* ===== Chatbot Widget ===== */
.chatbot {
  position: fixed;
  right: var(--space-lg);
  bottom: var(--space-lg);
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--space-sm);
}

.chatbot-trigger {
  padding: 10px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: all var(--transition-base);
  display: flex;
  align-items: center;
  gap: 8px;
}

.chatbot-trigger:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
  border-color: var(--accent);
}

.chatbot-trigger svg {
  opacity: 0.7;
}

.chatbot-panel {
  width: 360px;
  max-height: 500px;
  background: var(--chatbot-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: chatSlideUp 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.chatbot-panel[hidden] {
  display: none;
}

.chatbot-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--border);
}

.chatbot-avatar-icon {
  width: 36px;
  height: 36px;
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  flex-shrink: 0;
}

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

.chatbot-header-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}

.chatbot-status {
  font-size: 0.7rem;
  color: #22c55e;
  display: flex;
  align-items: center;
  gap: 4px;
}

.chatbot-status::before {
  content: '';
  width: 6px;
  height: 6px;
  background: #22c55e;
  border-radius: 50%;
}

.chatbot-header-actions button {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  transition: all var(--transition-fast);
  cursor: pointer;
}

.chatbot-header-actions button:hover {
  background: var(--accent-soft);
  color: var(--text-primary);
}

.chatbot-messages {
  flex: 1;
  padding: var(--space-md) var(--space-lg);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  max-height: 320px;
  min-height: 200px;
}

.chat-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 0.8rem;
  line-height: 1.6;
  animation: chatSlideUp 0.3s ease;
}

.chat-msg.bot {
  align-self: flex-start;
  background: var(--chatbot-msg-bot);
  color: var(--chatbot-msg-bot-text);
}

.chat-msg.user {
  align-self: flex-end;
  background: var(--chatbot-msg-user);
  color: var(--chatbot-msg-user-text);
}

.chat-msg-time {
  font-size: 0.65rem;
  color: var(--text-faint);
  margin-top: 4px;
}

.chatbot-input-area {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-lg);
  border-top: 1px solid var(--border);
}

.chatbot-input-area input {
  flex: 1;
  padding: 8px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  color: var(--text-primary);
  transition: border-color var(--transition-fast);
}

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

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

.chatbot-send {
  width: 34px;
  height: 34px;
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.chatbot-send:hover {
  opacity: 0.85;
  transform: scale(1.05);
}

.chatbot-send svg {
  width: 16px;
  height: 16px;
}

.chatbot-hint {
  font-size: 0.68rem;
  color: var(--text-faint);
  text-align: center;
  padding: 0 var(--space-lg) var(--space-sm);
}

/* Mobile chatbot */
@media (max-width: 480px) {
  .chatbot {
    right: var(--space-md);
    bottom: var(--space-md);
  }
  .chatbot-panel {
    width: calc(100vw - 2 * var(--space-md));
  }
  .chatbot-trigger {
    font-size: 0.75rem;
    padding: 8px 16px;
  }
}
