/* ============================================
   Chatbot Widget Styles
   ============================================ */

#chatbot-widget {
  position: fixed;
  bottom: var(--space-xl);
  right: var(--space-xl);
  z-index: var(--z-chatbot);
  font-family: var(--font-body);
}

/* === Toggle Button === */
.chatbot-toggle {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-circle);
  background: linear-gradient(135deg, var(--color-champagne-gold) 0%, #C49B30 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  cursor: pointer;
  border: none;
  box-shadow: 0 4px 15px rgba(212, 175, 55, 0.4);
  transition: all var(--transition-base);
  position: relative;
  z-index: 2;
}

.chatbot-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 25px rgba(212, 175, 55, 0.5);
}

/* Tooltip */
.chatbot-toggle__tooltip {
  position: absolute;
  right: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%);
  white-space: nowrap;
  background-color: var(--color-surface-card);
  color: var(--color-text-primary);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-sm);
  font-size: var(--fs-small);
  font-weight: var(--fw-medium);
  box-shadow: var(--shadow-md);
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-fast);
  pointer-events: none;
}

.chatbot-toggle__tooltip::after {
  content: '';
  position: absolute;
  left: 100%;
  top: 50%;
  transform: translateY(-50%);
  border: 5px solid transparent;
  border-left-color: var(--color-surface-card);
}

.chatbot-toggle:hover .chatbot-toggle__tooltip {
  opacity: 1;
  visibility: visible;
}

.chatbot-toggle--open .chatbot-toggle__tooltip {
  display: none;
}

.chatbot-toggle__icon-close {
  display: none;
}

.chatbot-toggle--open .chatbot-toggle__icon-open {
  display: none;
}

.chatbot-toggle--open .chatbot-toggle__icon-close {
  display: inline;
}

/* Move WhatsApp button up when chatbot is present */
.whatsapp-float {
  bottom: calc(var(--space-xl) + 70px);
}

/* === Chat Panel === */
.chatbot-panel {
  position: absolute;
  bottom: 70px;
  right: 0;
  width: 420px;
  max-width: calc(100vw - 40px);
  height: 600px;
  max-height: calc(100vh - 120px);
  background-color: var(--color-surface-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.95);
  transition: all var(--transition-base);
  border: 1px solid var(--color-border-light);
}

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

/* === Header === */
.chatbot-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-lg);
  background: linear-gradient(135deg, var(--color-pudra-pink) 0%, var(--color-pudra-pink-dark) 100%);
  color: #fff;
  flex-shrink: 0;
}

.chatbot-header__info {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.chatbot-header__avatar {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-circle);
  background: rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.chatbot-header__name {
  font-weight: var(--fw-semibold);
  font-size: var(--fs-small);
}

.chatbot-header__status {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: var(--fs-tiny);
  opacity: 0.9;
}

.chatbot-header__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: #4ADE80;
  display: inline-block;
}

.chatbot-header__close {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-circle);
  background: rgba(255,255,255,0.15);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: none;
  font-size: 0.8rem;
  transition: background var(--transition-fast);
}

.chatbot-header__close:hover {
  background: rgba(255,255,255,0.3);
}

/* === Messages Area === */
.chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-md);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  scroll-behavior: smooth;
}

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

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

/* === Message Bubbles === */
.chatbot-message {
  display: flex;
  gap: var(--space-sm);
  max-width: 95%;
  animation: fadeInUp 0.3s ease;
}

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

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

.chatbot-message__avatar {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-circle);
  background: linear-gradient(135deg, var(--color-pudra-pink-light), var(--color-pudra-pink));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  color: #fff;
  flex-shrink: 0;
  margin-top: 2px;
}

.chatbot-message__bubble {
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 0.92rem;
  line-height: 1.55;
  word-break: break-word;
}

.chatbot-message--bot .chatbot-message__bubble {
  background-color: var(--color-bg-section-alt);
  color: var(--color-text-primary);
  border-bottom-left-radius: 4px;
}

.chatbot-message--bot .chatbot-message__bubble a {
  color: var(--color-champagne-gold-dark);
  text-decoration: underline;
  font-weight: var(--fw-medium);
}

.chatbot-message--bot .chatbot-message__bubble a:hover {
  color: var(--color-champagne-gold);
}

.chatbot-message--user .chatbot-message__bubble {
  background: linear-gradient(135deg, var(--color-pudra-pink) 0%, var(--color-pudra-pink-dark) 100%);
  color: #fff;
  border-bottom-right-radius: 4px;
}

/* === Typing Indicator === */
.chatbot-typing-dots {
  display: flex;
  gap: 4px;
  padding: 4px 0;
}

.chatbot-typing-dots span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--color-text-muted);
  animation: typingBounce 1.4s ease-in-out infinite;
}

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

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

/* === Suggested Topics === */
.chatbot-topics {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px var(--space-md) var(--space-sm);
  flex-shrink: 0;
  max-height: 90px;
  overflow-y: auto;
}

.chatbot-topic-btn {
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  font-size: 0.78rem;
  font-weight: var(--fw-medium);
  color: var(--color-champagne-gold-dark);
  background: transparent;
  border: 1px solid var(--color-border-gold);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.chatbot-topic-btn:hover {
  background-color: var(--color-champagne-gold);
  color: #fff;
  border-color: var(--color-champagne-gold);
}

/* CTA chip — visually distinct lead-capture button */
.chatbot-topic-btn--cta {
  background: linear-gradient(135deg, var(--color-champagne-gold) 0%, #C49B30 100%);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 2px 6px rgba(212, 175, 55, 0.3);
}

.chatbot-topic-btn--cta:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(212, 175, 55, 0.4);
}

/* === Input Area === */
.chatbot-input-area {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  border-top: 1px solid var(--color-border-light);
  flex-shrink: 0;
  background: var(--color-surface-card);
}

.chatbot-input {
  flex: 1;
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-pill);
  padding: 8px 16px;
  font-size: var(--fs-small);
  background: var(--color-bg-primary);
  color: var(--color-text-primary);
  outline: none;
  transition: border-color var(--transition-fast);
}

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

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

.chatbot-send {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-circle);
  background: linear-gradient(135deg, var(--color-pudra-pink) 0%, var(--color-pudra-pink-dark) 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  cursor: pointer;
  border: none;
  flex-shrink: 0;
  transition: all var(--transition-fast);
}

.chatbot-send:hover {
  transform: scale(1.1);
}

/* === Attention Bubble (first-visit nudge) === */
.chatbot-bubble {
  position: absolute;
  bottom: 70px;
  right: 0;
  background: var(--color-surface-card);
  color: var(--color-text-primary);
  padding: 12px 36px 12px 16px;
  border-radius: 18px 18px 4px 18px;
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1.4;
  white-space: nowrap;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  border: 1px solid var(--color-border-light);
  cursor: pointer;
  animation: chatbotBubbleIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 1;
}

.chatbot-bubble::after {
  content: '';
  position: absolute;
  bottom: -7px;
  right: 18px;
  width: 14px;
  height: 14px;
  background: var(--color-surface-card);
  border-right: 1px solid var(--color-border-light);
  border-bottom: 1px solid var(--color-border-light);
  transform: rotate(45deg);
}

.chatbot-bubble__close {
  position: absolute;
  top: 4px;
  right: 6px;
  background: transparent;
  border: none;
  color: var(--color-text-muted);
  font-size: 1.1rem;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  padding: 0;
  transition: background var(--transition-fast);
}

.chatbot-bubble__close:hover {
  background: var(--color-bg-secondary);
}

.chatbot-bubble--fade {
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.5s, transform 0.5s;
}

@keyframes chatbotBubbleIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (max-width: 767px) {
  .chatbot-bubble {
    font-size: 0.82rem;
    padding: 10px 32px 10px 14px;
    max-width: calc(100vw - 90px);
    white-space: normal;
  }
}

/* === Lead Capture Card === */
.chatbot-lead-card {
  background: var(--color-surface-card);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  max-width: 240px;
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  box-shadow: var(--shadow-sm);
}

.chatbot-lead-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.85rem;
  color: var(--color-text-primary);
  background: var(--color-bg-primary);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.chatbot-lead-input:focus {
  outline: none;
  border-color: var(--color-champagne-gold);
  box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.15);
}

.chatbot-lead-error {
  color: #c62828;
  font-size: 0.75rem;
  min-height: 16px;
  font-weight: 500;
}

.chatbot-lead-btns {
  display: flex;
  gap: var(--space-xs);
  margin-top: 4px;
}

.chatbot-lead-btn {
  flex: 1;
  padding: 9px 12px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.chatbot-lead-btn--primary {
  background: linear-gradient(135deg, var(--color-champagne-gold) 0%, #C49B30 100%);
  color: #fff;
}

.chatbot-lead-btn--primary:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
}

.chatbot-lead-btn--primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.chatbot-lead-btn--ghost {
  background: transparent;
  color: var(--color-text-muted);
  border: 1px solid var(--color-border-light);
}

.chatbot-lead-btn--ghost:hover {
  background: var(--color-bg-secondary);
  color: var(--color-text-primary);
}

.chatbot-lead-privacy {
  font-size: 0.7rem;
  color: var(--color-text-muted);
  text-align: center;
  margin-top: 2px;
  line-height: 1.4;
}

/* === Mobile Responsive === */
@media (max-width: 767px) {
  #chatbot-widget {
    bottom: var(--space-lg);
    right: var(--space-md);
  }

  .chatbot-toggle {
    width: 50px;
    height: 50px;
    font-size: 1.2rem;
  }

  .chatbot-panel {
    width: calc(100vw - 32px);
    height: calc(100vh - 140px);
    bottom: 60px;
    right: -8px;
  }

  .whatsapp-float {
    bottom: calc(var(--space-lg) + 70px);
  }
}
