/* ========== CHATBOT ========== */
.chatbot {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: var(--z-overlay);
  font-family: var(--font-family);
}

/* Trigger */
.chatbot__trigger {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(230, 57, 70, 0.4);
  cursor: pointer;
  transition: all var(--duration-base) var(--ease-out);
  position: relative;
}

.chatbot__trigger:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 28px rgba(230, 57, 70, 0.5);
}

.chatbot__trigger-icon--close {
  display: none;
}

.chatbot--open .chatbot__trigger-icon--chat {
  display: none;
}

.chatbot--open .chatbot__trigger-icon--close {
  display: block;
}

.chatbot__badge {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 22px;
  height: 22px;
  background: #FF3B30;
  color: white;
  font-size: 11px;
  font-weight: 700;
  border-radius: 50%;
  display: none;
  align-items: center;
  justify-content: center;
  border: 2px solid white;
  animation: pulse 2s ease-in-out infinite;
}

.chatbot__badge--visible {
  display: flex;
}

/* Window */
.chatbot__window {
  position: absolute;
  bottom: 72px;
  right: 0;
  width: 380px;
  height: 520px;
  background: var(--color-white);
  border-radius: var(--radius-xl);
  box-shadow: 0 12px 48px rgba(0,0,0,0.15);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(0.8) translateY(20px);
  transform-origin: bottom right;
  opacity: 0;
  pointer-events: none;
  transition: all var(--duration-base) var(--ease-out);
}

.chatbot--open .chatbot__window {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: all;
}

/* Header */
.chatbot__header {
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
  color: white;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.chatbot__header-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chatbot__avatar {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
}

.chatbot__header-name {
  display: block;
  font-weight: var(--fw-semibold);
  font-size: var(--fs-sm);
}

.chatbot__header-status {
  display: block;
  font-size: var(--fs-xs);
  opacity: 0.8;
}

.chatbot__header-status::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  background: #34C759;
  border-radius: 50%;
  margin-right: 4px;
  vertical-align: middle;
}

.chatbot__close {
  color: rgba(255,255,255,0.8);
  transition: color var(--duration-fast) var(--ease-in-out);
  padding: 4px;
}

.chatbot__close:hover {
  color: white;
}

/* Messages */
.chatbot__messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chatbot__message {
  display: flex;
  gap: 8px;
  animation: fadeInUp 0.3s var(--ease-out);
}

.chatbot__message--bot {
  align-self: flex-start;
  max-width: 85%;
}

.chatbot__message--user {
  align-self: flex-end;
  max-width: 85%;
  flex-direction: row-reverse;
}

.chatbot__bubble {
  padding: 10px 14px;
  border-radius: 16px;
  font-size: var(--fs-sm);
  line-height: 1.5;
  word-break: break-word;
}

.chatbot__message--bot .chatbot__bubble {
  background: var(--color-gray-100);
  color: var(--color-black);
  border-bottom-left-radius: 4px;
}

.chatbot__message--user .chatbot__bubble {
  background: var(--color-primary);
  color: white;
  border-bottom-right-radius: 4px;
}

/* Typing indicator */
.chatbot__typing {
  display: flex;
  gap: 4px;
  padding: 12px 16px;
  align-self: flex-start;
}

.chatbot__typing-dot {
  width: 8px;
  height: 8px;
  background: var(--color-gray-300);
  border-radius: 50%;
  animation: typing-bounce 1.4s ease-in-out infinite;
}

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

@keyframes typing-bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-6px); }
}

/* Quick Replies */
.chatbot__quick-replies {
  padding: 0 16px 12px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.chatbot__quick-btn {
  padding: 8px 16px;
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  color: var(--color-primary);
  background: var(--color-primary-light);
  border: 1px solid rgba(230, 57, 70, 0.2);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-in-out);
  white-space: nowrap;
  animation: fadeInUp 0.3s var(--ease-out);
}

.chatbot__quick-btn:hover {
  background: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
}

/* WhatsApp Button in Chat */
.chatbot__wa-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px;
  background: #25D366;
  color: white;
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-in-out);
  border: none;
  margin-top: 8px;
}

.chatbot__wa-btn:hover {
  background: #1DA851;
  transform: translateY(-1px);
}

/* Input Area */
.chatbot__input-area {
  padding: 12px 16px;
  border-top: 1px solid var(--color-gray-200);
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.chatbot__input {
  flex: 1;
  padding: 10px 14px;
  font-size: var(--fs-sm);
  border: 1.5px solid var(--color-gray-200);
  border-radius: var(--radius-full);
  outline: none;
  transition: border-color var(--duration-fast) var(--ease-in-out);
  font-family: var(--font-family);
}

.chatbot__input:focus {
  border-color: var(--color-primary);
}

.chatbot__send {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-primary);
  color: white;
  border-radius: 50%;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-in-out);
  flex-shrink: 0;
}

.chatbot__send:hover {
  background: var(--color-primary-dark);
  transform: scale(1.05);
}
