/* ============================================
   CHATBOT VENDEDOR — 365 Joyas y Accesorios
   Ultra-Luxury Design & Precision Alignment
   ============================================ */

/* ─── Chatbot Floating Bubble ─── */
.chatbot-bubble {
  position: fixed;
  bottom: 100px;
  right: 28px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--gold-gradient, linear-gradient(135deg, #c9a96e 0%, #e8c87a 35%, #d4af78 65%, #a78b4e 100%));
  border: 1.5px solid #fff4d0;
  cursor: pointer;
  z-index: 9005;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 30px rgba(201, 169, 110, 0.45), 0 0 20px rgba(201, 169, 110, 0.35);
  animation: chatbotPulse 2.8s ease-in-out infinite;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), 
              box-shadow 0.35s ease,
              border-color 0.3s ease;
}

.chatbot-bubble:hover {
  transform: scale(1.1) translateY(-3px);
  box-shadow: 0 12px 40px rgba(201, 169, 110, 0.6), 0 0 30px rgba(201, 169, 110, 0.5);
}

.chatbot-bubble svg {
  width: 30px;
  height: 30px;
  fill: #1a1a1a;
  stroke: none;
  transition: transform 0.3s ease;
}

.chatbot-bubble .chatbot-close-icon {
  display: none;
  stroke: #1a1a1a;
  stroke-width: 2.2;
  fill: none;
}

.chatbot-bubble.active .chatbot-chat-icon {
  display: none;
}

.chatbot-bubble.active .chatbot-close-icon {
  display: block;
}

.chatbot-bubble.active {
  animation: none;
  transform: scale(1);
}

/* Notification dot */
.chatbot-bubble::after {
  content: '';
  position: absolute;
  top: 0px;
  right: 0px;
  width: 14px;
  height: 14px;
  background: #22c55e;
  border-radius: 50%;
  border: 2px solid var(--bg-primary, #0a0a0a);
  animation: chatNotifBounce 1.8s ease-in-out infinite;
  box-shadow: 0 0 10px rgba(34, 197, 94, 0.8);
}

.chatbot-bubble.active::after {
  display: none;
}

@keyframes chatbotPulse {
  0%, 100% { 
    box-shadow: 0 8px 30px rgba(201, 169, 110, 0.45), 0 0 0 0 rgba(201, 169, 110, 0.5); 
  }
  50% { 
    box-shadow: 0 8px 30px rgba(201, 169, 110, 0.45), 0 0 0 12px rgba(201, 169, 110, 0); 
  }
}

@keyframes chatNotifBounce {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.25); }
}

/* ─── Chatbot Panel ─── */
.chatbot-panel {
  position: fixed;
  bottom: 172px;
  right: 28px;
  width: 390px;
  max-height: 540px;
  background: var(--bg-glass-strong, rgba(18, 18, 18, 0.94));
  backdrop-filter: blur(28px) saturate(1.8);
  -webkit-backdrop-filter: blur(28px) saturate(1.8);
  border: 1px solid var(--bg-glass-border, rgba(201, 169, 110, 0.2));
  border-radius: var(--radius-lg, 24px);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45), 0 0 60px rgba(201, 169, 110, 0.12);
  display: flex;
  flex-direction: column;
  z-index: 9006;
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  pointer-events: none;
  transition: opacity 0.35s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  overflow: hidden;
}

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

/* ─── Chat Header ─── */
.chatbot-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  background: linear-gradient(135deg, rgba(201, 169, 110, 0.16) 0%, rgba(201, 169, 110, 0.05) 100%);
  border-bottom: 1px solid var(--bg-glass-border, rgba(201, 169, 110, 0.15));
  flex-shrink: 0;
}

.chatbot-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--gold-gradient, linear-gradient(135deg, #c9a96e, #e8c87a));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
  box-shadow: 0 4px 16px rgba(201, 169, 110, 0.35);
  border: 1px solid #fff4d0;
}

.chatbot-header-info {
  flex: 1;
  min-width: 0;
}

.chatbot-header-name {
  font-family: var(--font-display, 'Cinzel', serif);
  font-size: 14.5px;
  font-weight: 700;
  color: var(--text-primary, #f5f3ef);
  letter-spacing: 0.5px;
}

.chatbot-header-status {
  font-family: var(--font-body, 'Outfit', sans-serif);
  font-size: 11.5px;
  color: var(--gold-primary, #c9a96e);
  display: flex;
  align-items: center;
  gap: 5px;
}

.chatbot-header-status::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
  flex-shrink: 0;
  animation: statusPulse 2s ease-in-out infinite;
  box-shadow: 0 0 6px #22c55e;
}

@keyframes statusPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.chatbot-header-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.chatbot-header-close:hover {
  background: rgba(255, 255, 255, 0.18);
  transform: scale(1.08);
}

.chatbot-header-close svg {
  width: 15px;
  height: 15px;
  stroke: var(--text-secondary, #8a8a8a);
  stroke-width: 2.2;
  fill: none;
}

/* ─── Chat Messages Area ─── */
.chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 220px;
  max-height: 340px;
  scroll-behavior: smooth;
}

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

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

.chatbot-messages::-webkit-scrollbar-thumb {
  background: rgba(201, 169, 110, 0.25);
  border-radius: 10px;
}

/* ─── Message Bubbles ─── */
.chatbot-msg {
  max-width: 88%;
  padding: 11px 15px;
  border-radius: 18px;
  font-family: var(--font-body, 'Outfit', sans-serif);
  font-size: 13.5px;
  line-height: 1.5;
  animation: msgSlideIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  opacity: 0;
  transform: translateY(10px);
  word-wrap: break-word;
}

@keyframes msgSlideIn {
  to { opacity: 1; transform: translateY(0); }
}

.chatbot-msg.bot {
  align-self: flex-start;
  background: rgba(201, 169, 110, 0.09);
  border: 1px solid rgba(201, 169, 110, 0.15);
  color: var(--text-primary, #f5f3ef);
  border-bottom-left-radius: 6px;
}

.chatbot-msg.user {
  align-self: flex-end;
  background: var(--gold-gradient, linear-gradient(135deg, #c9a96e, #e8c87a));
  color: #1a1a1a;
  border-bottom-right-radius: 6px;
  font-weight: 600;
  box-shadow: 0 4px 14px rgba(201, 169, 110, 0.25);
}

/* ─── Typing Indicator ─── */
.chatbot-typing {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 12px 16px;
  align-self: flex-start;
  background: rgba(201, 169, 110, 0.09);
  border: 1px solid rgba(201, 169, 110, 0.15);
  border-radius: 18px;
  border-bottom-left-radius: 6px;
  animation: msgSlideIn 0.3s ease forwards;
  opacity: 0;
}

.chatbot-typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--gold-primary, #c9a96e);
  animation: typingDot 1.4s ease-in-out infinite;
}

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

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

/* ─── Product Cards in Chat ─── */
.chatbot-products-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  max-width: 94%;
  align-self: flex-start;
  animation: msgSlideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  opacity: 0;
  transform: translateY(10px);
}

.chatbot-product-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: rgba(201, 169, 110, 0.08);
  border: 1px solid rgba(201, 169, 110, 0.16);
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.25s ease;
  text-decoration: none;
  color: inherit;
}

.chatbot-product-card:hover {
  background: rgba(201, 169, 110, 0.16);
  border-color: rgba(201, 169, 110, 0.35);
  transform: translateX(4px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.chatbot-product-card img {
  width: 58px;
  height: 58px;
  border-radius: 12px;
  object-fit: cover;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(201, 169, 110, 0.15);
}

.chatbot-product-info {
  flex: 1;
  min-width: 0;
}

.chatbot-product-name {
  font-family: var(--font-body, 'Outfit', sans-serif);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary, #f5f3ef);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.chatbot-product-price {
  font-family: var(--font-display, 'Cinzel', serif);
  font-size: 14px;
  font-weight: 700;
  background: var(--gold-gradient-text, linear-gradient(135deg, #c9a96e, #e8c87a));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-top: 3px;
}

.chatbot-product-badge {
  font-size: 10px;
  color: var(--text-muted, #8a8a8a);
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 2px;
}

.chatbot-product-badge::before {
  content: '\2728';
  font-size: 9px;
}

.chatbot-product-arrow {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(201, 169, 110, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.chatbot-product-card:hover .chatbot-product-arrow {
  background: rgba(201, 169, 110, 0.28);
  transform: translateX(2px);
}

.chatbot-product-arrow svg {
  width: 14px;
  height: 14px;
  stroke: var(--gold-primary, #c9a96e);
  stroke-width: 2.2;
  fill: none;
}

/* ─── Quick Action Chips ─── */
.chatbot-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-width: 94%;
  align-self: flex-start;
  animation: msgSlideIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  opacity: 0;
  transform: translateY(10px);
}

.chatbot-chip {
  padding: 7px 14px;
  border-radius: 20px;
  background: rgba(201, 169, 110, 0.09);
  border: 1px solid rgba(201, 169, 110, 0.22);
  color: var(--gold-primary, #c9a96e);
  font-family: var(--font-body, 'Outfit', sans-serif);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.chatbot-chip:hover {
  background: rgba(201, 169, 110, 0.18);
  border-color: rgba(201, 169, 110, 0.4);
  transform: translateY(-2px);
}

.chatbot-chip.whatsapp {
  background: rgba(37, 211, 102, 0.12);
  border-color: rgba(37, 211, 102, 0.25);
  color: #25d366;
}

.chatbot-chip.whatsapp:hover {
  background: rgba(37, 211, 102, 0.22);
  border-color: rgba(37, 211, 102, 0.45);
}

/* ─── WhatsApp Derivation Button ─── */
.chatbot-whatsapp-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 14px;
  background: linear-gradient(135deg, #25d366, #128c7e);
  color: #fff;
  font-family: var(--font-body, 'Outfit', sans-serif);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: all 0.25s ease;
  margin-top: 6px;
  box-shadow: 0 4px 20px rgba(37, 211, 102, 0.35);
}

.chatbot-whatsapp-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 28px rgba(37, 211, 102, 0.5);
}

.chatbot-whatsapp-btn svg {
  width: 17px;
  height: 17px;
  fill: #fff;
}

/* ─── Chat Input Area ─── */
.chatbot-input-area {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid var(--bg-glass-border, rgba(201, 169, 110, 0.12));
  background: rgba(0, 0, 0, 0.2);
  flex-shrink: 0;
}

.chatbot-input {
  flex: 1;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(201, 169, 110, 0.18);
  border-radius: 22px;
  padding: 10px 16px;
  font-family: var(--font-body, 'Outfit', sans-serif);
  font-size: 13.5px;
  color: var(--text-primary, #f5f3ef);
  outline: none;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.chatbot-input::placeholder {
  color: var(--text-muted, #8a8a8a);
}

.chatbot-input:focus {
  border-color: rgba(201, 169, 110, 0.45);
  background: rgba(255, 255, 255, 0.09);
}

.chatbot-send-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--gold-gradient, linear-gradient(135deg, #c9a96e, #e8c87a));
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.chatbot-send-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 4px 16px rgba(201, 169, 110, 0.45);
}

.chatbot-send-btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: #1a1a1a;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ─── "See More" link ─── */
.chatbot-see-more {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--gold-primary, #c9a96e);
  font-family: var(--font-body, 'Outfit', sans-serif);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 0;
  border: none;
  background: none;
  transition: opacity 0.2s ease;
  align-self: flex-start;
  margin-left: 4px;
  animation: msgSlideIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  opacity: 0;
}

.chatbot-see-more:hover {
  opacity: 0.7;
}

/* ─── Responsive Mobile Layout & Alignment ─── */
@media (max-width: 768px) {
  .chatbot-bubble {
    bottom: calc(var(--bottom-nav-height, 72px) + 84px);
    right: 16px;
    width: 52px;
    height: 52px;
  }

  .chatbot-bubble svg {
    width: 26px;
    height: 26px;
  }

  .chatbot-panel {
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    max-height: 85vh;
    border-radius: 24px 24px 0 0;
    border-bottom: none;
    z-index: 10000;
  }

  .chatbot-messages {
    max-height: calc(85vh - 145px);
  }

  .chatbot-product-card img {
    width: 50px;
    height: 50px;
  }
}

/* ─── Light Mode Adjustments ─── */
[data-theme="light"] .chatbot-panel {
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.15), 0 0 60px rgba(201, 169, 110, 0.08);
}

[data-theme="light"] .chatbot-msg.bot {
  background: rgba(201, 169, 110, 0.08);
  border-color: rgba(201, 169, 110, 0.14);
  color: var(--text-primary);
}

[data-theme="light"] .chatbot-input {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(201, 169, 110, 0.2);
  color: var(--text-primary);
}

[data-theme="light"] .chatbot-input-area {
  background: rgba(0, 0, 0, 0.03);
}

[data-theme="light"] .chatbot-product-card {
  background: rgba(201, 169, 110, 0.06);
}

[data-theme="light"] .chatbot-product-card:hover {
  background: rgba(201, 169, 110, 0.12);
}

[data-theme="light"] .chatbot-typing {
  background: rgba(201, 169, 110, 0.08);
}

[data-theme="light"] .chatbot-header-close {
  background: rgba(0, 0, 0, 0.05);
  border-color: rgba(0, 0, 0, 0.08);
}
