/* ==========================================================================
   Pura Vida Distribution — chatbot.css
   AI Sales Agent widget (FAB + chat window). Uses the brand tokens from
   style.css with safe fallbacks.
   ========================================================================== */

/* Stack the plain WhatsApp FAB above the sales agent FAB */
.whatsapp-fab { bottom: 94px; }
@media (max-width: 760px) { .whatsapp-fab { bottom: 86px; } }

/* ── FAB ────────────────────────────────────────────────── */
.pv-bot-fab {
  position: fixed;
  right: 22px;
  bottom: 22px;
  /* Below the cart drawer/overlay (z-index 200/201 in style.css) and any
     modal, so opening the cart or a modal covers the chat bubble instead
     of it floating on top of them. */
  z-index: 95;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  color: #fff;
  background: linear-gradient(135deg, var(--green-700, #1f6f54), var(--green-900, #0e3e2e));
  box-shadow: 0 8px 26px rgba(8, 41, 33, 0.45);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.pv-bot-fab:hover { transform: scale(1.08); box-shadow: 0 12px 34px rgba(8, 41, 33, 0.55); }
.pv-bot-fab .pv-bot-mascot { width: 38px; height: 48px; flex-shrink: 0; }

/* The mascot SVG itself — sizing is set per context by the parent below */
.pv-bot-mascot { display: block; }

.pv-bot-fab-dot {
  position: absolute;
  top: 3px; right: 3px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--gold-500, #e8a33d);
  border: 2.5px solid #fff;
  animation: pvDotPulse 2s infinite;
}
@keyframes pvDotPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.3); }
}

/* Teaser bubble next to the FAB */
.pv-bot-teaser {
  position: fixed;
  right: 92px;
  bottom: 32px;
  z-index: 95;
  max-width: 230px;
  background: #fff;
  color: var(--ink-900, #1b2521);
  font-family: var(--font-body, "Inter", sans-serif);
  font-size: 0.85rem;
  line-height: 1.45;
  padding: 12px 16px;
  border-radius: 14px 14px 4px 14px;
  box-shadow: 0 8px 26px rgba(8, 41, 33, 0.25);
  cursor: pointer;
  animation: pvMsgIn 0.35s ease;
}
.pv-bot-teaser strong { color: var(--green-900, #0e3e2e); }

/* ── Window ─────────────────────────────────────────────── */
.pv-bot-window {
  position: fixed;
  right: 22px;
  bottom: 94px;
  /* Still below the cart drawer/overlay and modals (z-index 200+), so
     opening the cart while chatting covers the chat window too. */
  z-index: 190;
  width: 372px;
  height: min(600px, calc(100vh - 120px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--cream-50, #faf6ef);
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(8, 41, 33, 0.35);
  font-family: var(--font-body, "Inter", sans-serif);
  opacity: 0;
  pointer-events: none;
  transform: translateY(18px) scale(0.96);
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.pv-bot-window.open { opacity: 1; pointer-events: all; transform: translateY(0) scale(1); }

/* ── Header ─────────────────────────────────────────────── */
.pv-bot-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  color: #fff;
  background: linear-gradient(135deg, var(--green-900, #0e3e2e) 0%, var(--green-700, #1f6f54) 100%);
}
.pv-bot-avatar {
  width: 44px; height: 44px;
  flex-shrink: 0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.16);
  border: 2px solid var(--gold-500, #e8a33d);
}
.pv-bot-avatar .pv-bot-mascot { width: 27px; height: 34px; flex-shrink: 0; }
.pv-bot-header-info { flex: 1; line-height: 1.3; min-width: 0; }
.pv-bot-header-info strong { display: block; font-size: 0.93rem; }
.pv-bot-header-info span { font-size: 0.73rem; opacity: 0.85; }
.pv-bot-online {
  display: inline-block;
  width: 7px; height: 7px;
  margin-right: 4px;
  border-radius: 50%;
  background: #4ade80;
}
.pv-bot-cart-pill {
  flex-shrink: 0;
  background: var(--gold-500, #e8a33d);
  color: var(--green-950, #082921);
  border: none;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.76rem;
  padding: 6px 11px;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.2s;
}
.pv-bot-cart-pill:hover { background: var(--gold-300, #f3c977); }
.pv-bot-close {
  flex-shrink: 0;
  background: none;
  border: none;
  color: #fff;
  font-size: 1.05rem;
  line-height: 1;
  padding: 6px 8px;
  border-radius: 8px;
  cursor: pointer;
  opacity: 0.8;
  transition: opacity 0.2s, background 0.2s;
}
.pv-bot-close:hover { opacity: 1; background: rgba(255, 255, 255, 0.15); }

/* ── Messages ───────────────────────────────────────────── */
.pv-bot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}
.pv-bot-messages::-webkit-scrollbar { width: 4px; }
.pv-bot-messages::-webkit-scrollbar-thumb { background: #c9c2b4; border-radius: 4px; }

.pv-msg {
  max-width: 90%;
  padding: 10px 14px;
  border-radius: 15px;
  font-size: 0.85rem;
  line-height: 1.55;
  animation: pvMsgIn 0.22s ease;
  overflow-wrap: break-word;
}
@keyframes pvMsgIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.pv-msg.bot {
  align-self: flex-start;
  background: #fff;
  color: var(--ink-900, #1b2521);
  border-bottom-left-radius: 5px;
  box-shadow: 0 1px 6px rgba(8, 41, 33, 0.09);
}
.pv-msg.user {
  align-self: flex-end;
  background: var(--green-900, #0e3e2e);
  color: #fff;
  border-bottom-right-radius: 5px;
}
.pv-msg strong { font-weight: 700; }
.pv-msg em { color: var(--chili-500, #e4572e); font-style: normal; font-weight: 600; }

/* Product card inside chat */
.pv-chat-product {
  margin-top: 10px;
  padding: 10px 12px;
  border: 1.5px solid var(--cream-100, #f3ecdf);
  border-left: 4px solid var(--gold-500, #e8a33d);
  border-radius: 10px;
  background: var(--cream-50, #faf6ef);
}
.pv-chat-product .name { font-weight: 700; font-size: 0.83rem; color: var(--green-900, #0e3e2e); }
.pv-chat-product .meta { font-size: 0.78rem; color: var(--ink-600, #4b5a53); margin: 2px 0 8px; }
.pv-chat-product .row { display: flex; gap: 7px; flex-wrap: wrap; }

/* Buttons inside bot messages */
.pv-chat-btn {
  border: 1.5px solid var(--green-700, #1f6f54);
  background: #fff;
  color: var(--green-900, #0e3e2e);
  border-radius: 999px;
  padding: 6px 13px;
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, color 0.15s;
}
.pv-chat-btn:hover { background: var(--green-900, #0e3e2e); color: #fff; }
.pv-chat-btn.buy { background: var(--gold-500, #e8a33d); border-color: var(--gold-500, #e8a33d); color: var(--green-950, #082921); }
.pv-chat-btn.buy:hover { background: var(--gold-300, #f3c977); border-color: var(--gold-300, #f3c977); }
.pv-chat-btn.wa { background: #e8faf0; border-color: #25d366; color: #147c43; }
.pv-chat-btn.wa:hover { background: #25d366; color: #fff; }

/* Typing indicator */
.pv-typing {
  align-self: flex-start;
  display: flex;
  gap: 5px;
  align-items: center;
  padding: 11px 15px;
  background: #fff;
  border-radius: 15px;
  border-bottom-left-radius: 5px;
  box-shadow: 0 1px 6px rgba(8, 41, 33, 0.09);
  animation: pvMsgIn 0.2s ease;
}
.pv-typing span {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--gold-500, #e8a33d);
  animation: pvTypeDot 1.2s ease-in-out infinite;
}
.pv-typing span:nth-child(2) { animation-delay: 0.18s; }
.pv-typing span:nth-child(3) { animation-delay: 0.36s; }
@keyframes pvTypeDot {
  0%, 80%, 100% { transform: scale(0.7); opacity: 0.5; }
  40% { transform: scale(1.15); opacity: 1; }
}

/* ── Quick-reply chips ──────────────────────────────────── */
.pv-bot-chips {
  flex-shrink: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 10px 12px;
  max-height: 180px;
  overflow-y: auto;
  background: var(--cream-50, #faf6ef);
  border-top: 1px solid var(--cream-100, #f3ecdf);
}
.pv-bot-chips::-webkit-scrollbar { width: 4px; }
.pv-bot-chips::-webkit-scrollbar-thumb { background: #c9c2b4; border-radius: 4px; }
.pv-chip {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  border: 1.5px solid rgba(14, 62, 46, 0.25);
  background: #fff;
  color: var(--green-900, #0e3e2e);
  border-radius: 14px;
  padding: 9px 10px;
  min-height: 38px;
  font-size: 0.76rem;
  font-weight: 600;
  line-height: 1.25;
  cursor: pointer;
  font-family: inherit;
  white-space: normal;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.pv-chip:hover { background: var(--green-900, #0e3e2e); border-color: var(--green-900, #0e3e2e); color: #fff; }

/* ── Input ──────────────────────────────────────────────── */
.pv-bot-inputbar {
  flex-shrink: 0;
  display: flex;
  gap: 8px;
  padding: 10px 12px 12px;
  background: #fff;
  border-top: 1px solid var(--cream-100, #f3ecdf);
}
.pv-bot-input {
  flex: 1;
  border: 1.5px solid rgba(14, 62, 46, 0.2);
  border-radius: 999px;
  padding: 10px 16px;
  font-family: inherit;
  font-size: 0.86rem;
  color: var(--ink-900, #1b2521);
  background: var(--cream-50, #faf6ef);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.pv-bot-input:focus { border-color: var(--green-700, #1f6f54); box-shadow: 0 0 0 3px rgba(31, 111, 84, 0.15); }
.pv-bot-send {
  width: 42px; height: 42px;
  flex-shrink: 0;
  border: none;
  border-radius: 50%;
  background: var(--green-900, #0e3e2e);
  color: #fff;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.15s;
}
.pv-bot-send:hover { background: var(--green-700, #1f6f54); transform: scale(1.06); }

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 440px) {
  .pv-bot-window {
    right: 10px;
    left: 10px;
    width: auto;
    bottom: 86px;
    height: min(560px, calc(100vh - 100px));
  }
  .pv-bot-fab { right: 16px; bottom: 16px; }
  .pv-bot-teaser { right: 84px; bottom: 24px; max-width: 190px; }
}
