/* ═══════════════════════════════════════════════════
   STUDIO 511 — Chatbot FAQ Widget
   ═══════════════════════════════════════════════════ */

/* ── Botón flotante ──────────────────────────────── */
.chat-fab {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--copper, #b07252);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(176,114,82,0.45);
  z-index: 400;
  transition: transform 0.3s var(--ease-out), background 0.2s;
}
.chat-fab:hover { background: #C4956A; transform: scale(1.08); }
.chat-fab.open  { transform: scale(0.9); }
.chat-fab svg   { width: 26px; height: 26px; color: #fff; transition: opacity 0.2s; }
.chat-fab .icon-close { display: none; }
.chat-fab.open .icon-open  { display: none; }
.chat-fab.open .icon-close { display: block; }

.chat-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #E05A5A;
  color: #fff;
  font-size: 0.6rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--white, #FAFAF8);
  transition: opacity 0.2s;
}
.chat-badge.hidden { opacity: 0; pointer-events: none; }

/* ── Ventana del chat ────────────────────────────── */
.chat-window {
  position: fixed;
  bottom: 6rem;
  right: 2rem;
  width: 360px;
  max-height: 540px;
  background: var(--ink-soft, #2D2520);
  border: 1px solid rgba(176,114,82,0.2);
  box-shadow: 0 16px 48px rgba(0,0,0,0.5);
  display: flex;
  flex-direction: column;
  z-index: 399;
  transform: scale(0.92) translateY(16px);
  transform-origin: bottom right;
  opacity: 0;
  pointer-events: none;
  transition: transform 0.35s var(--ease-out), opacity 0.3s ease;
}
.chat-window.open {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: all;
}

/* ── Header ──────────────────────────────────────── */
.chat-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  background: var(--ink, #1C1916);
  border-bottom: 1px solid rgba(176,114,82,0.15);
  flex-shrink: 0;
}
.chat-header-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(176,114,82,0.15);
  border: 1px solid rgba(176,114,82,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.chat-header-avatar svg { width: 22px; height: 15px; color: var(--copper, #b07252); }
.chat-header-info { flex: 1; }
.chat-header-name {
  font-family: var(--font-serif, 'Cormorant Garamond', serif);
  font-size: 1rem;
  font-weight: 400;
  color: var(--cream, #F2EBD9);
  line-height: 1.2;
}
.chat-header-status {
  font-size: 0.58rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  color: #6BC984;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  margin-top: 0.1rem;
}
.chat-header-status::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #6BC984;
  flex-shrink: 0;
}
.chat-header-close {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: transparent;
  border: 1px solid rgba(176,114,82,0.2);
  color: var(--warm-grey, #8A7968);
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}
.chat-header-close:hover { color: var(--cream, #F2EBD9); border-color: rgba(176,114,82,0.5); }

/* ── Mensajes ────────────────────────────────────── */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(176,114,82,0.2) transparent;
}

/* Burbuja del bot */
.msg-bot {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  max-width: 88%;
}
.msg-bot-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(176,114,82,0.12);
  border: 1px solid rgba(176,114,82,0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.msg-bot-avatar svg { width: 14px; height: 10px; color: var(--copper, #b07252); }
.msg-bot-bubble {
  background: rgba(176,114,82,0.1);
  border: 1px solid rgba(176,114,82,0.18);
  padding: 0.75rem 1rem;
  font-size: 0.78rem;
  font-weight: 300;
  color: var(--cream, #F2EBD9);
  line-height: 1.65;
  border-radius: 0 12px 12px 12px;
}
.msg-bot-bubble strong { color: var(--copper, #b07252); font-weight: 600; }

/* Burbuja del usuario */
.msg-user {
  align-self: flex-end;
  max-width: 80%;
}
.msg-user-bubble {
  background: var(--copper, #b07252);
  color: var(--ink, #1C1916);
  padding: 0.65rem 1rem;
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.5;
  border-radius: 12px 12px 0 12px;
}

/* Typing indicator */
.msg-typing .msg-bot-bubble {
  padding: 0.85rem 1rem;
}
.typing-dots {
  display: flex;
  gap: 4px;
  align-items: center;
  height: 12px;
}
.typing-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--copper, #b07252);
  opacity: 0.4;
  animation: typingPulse 1.2s infinite;
}
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingPulse {
  0%, 80%, 100% { opacity: 0.4; transform: scale(1); }
  40% { opacity: 1; transform: scale(1.2); }
}

/* ── Quick replies ───────────────────────────────── */
.chat-quick-replies {
  padding: 0.75rem 1rem 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  border-top: 1px solid rgba(176,114,82,0.08);
  flex-shrink: 0;
}
.chat-qr-btn {
  padding: 0.45rem 0.85rem;
  border: 1px solid rgba(176,114,82,0.3);
  background: transparent;
  color: var(--cream, #F2EBD9);
  font-family: var(--font-sans, 'Montserrat', sans-serif);
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  cursor: pointer;
  border-radius: 20px;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}
.chat-qr-btn:hover {
  background: rgba(176,114,82,0.12);
  border-color: var(--copper, #b07252);
  color: var(--copper, #b07252);
}
.chat-qr-btn--wa {
  border-color: rgba(107,201,132,0.4);
  color: #6BC984;
}
.chat-qr-btn--wa:hover { background: rgba(107,201,132,0.1); border-color: #6BC984; color: #6BC984; }
.chat-qr-btn--ver {
  border-color: rgba(176,114,82,0.5);
  background: rgba(176,114,82,0.08);
}

/* ── Responsive ──────────────────────────────────── */
@media (max-width: 480px) {
  .chat-window {
    right: 1rem;
    left: 1rem;
    width: auto;
    bottom: 5.5rem;
    max-height: 70vh;
  }
  .chat-fab { bottom: 1.5rem; right: 1.5rem; }
}
