:root{
  --pcm-primary:#800BC3;
  --pcm-primary-hover:#9a3fe0;
  --pcm-secondary:#8AC440;
  --pcm-bg:#ffffff;
  --pcm-text:#1e1b4b;
  --pcm-muted:#6b7280;
  --pcm-border:#e5e7eb;
  --pcm-shadow: 0 18px 45px rgba(0,0,0,.18);
  --pcm-radius: 18px;
  --pcm-radius-sm: 12px;
  --pcm-font: system-ui, -apple-system, Segoe UI, Roboto, Inter, Arial, sans-serif;
}

#pcm-ai-launcher{
  position:fixed; right:18px; bottom:18px; z-index:99999;
  width:56px; height:56px; border-radius:50%;
  background:var(--pcm-primary);
  color:#fff; display:flex; align-items:center; justify-content:center;
  box-shadow: var(--pcm-shadow);
  cursor:pointer;
}
#pcm-ai-launcher:hover{ background:var(--pcm-primary-hover); }

#pcm-ai-widget{
  position:fixed; right:18px; bottom:86px; z-index:99999;
  width:360px; max-width: calc(100vw - 24px);
  height:560px; max-height: calc(100vh - 120px);
  background:var(--pcm-bg); border:1px solid var(--pcm-border);
  border-radius: var(--pcm-radius);
  box-shadow: var(--pcm-shadow);
  font-family: var(--pcm-font);
  overflow:hidden;
  display:flex; flex-direction:column;
}
#pcm-ai-widget.is-hidden{ display:none; }

.pcm-ai-header{
  display:flex; align-items:center; justify-content:space-between;
  padding:12px 12px;
  background: linear-gradient(135deg, rgba(128,11,195,.10), rgba(138,196,64,.10));
  border-bottom:1px solid var(--pcm-border);
}
.pcm-ai-brand{ display:flex; gap:10px; align-items:center; }
.pcm-ai-logo{
  width:34px; height:34px; border-radius:10px; object-fit:contain;
  background:#fff; border:1px solid var(--pcm-border); display:flex; align-items:center; justify-content:center;
  font-weight:800; color:var(--pcm-primary);
}
.pcm-ai-title{ font-weight:800; font-size:14px; color:var(--pcm-text); }
.pcm-ai-subtitle{ font-size:12px; color:var(--pcm-muted); }
.pcm-ai-close{
  border:1px solid var(--pcm-border);
  width:34px; height:34px; border-radius:10px; background:#fff;
  cursor:pointer;
}

.pcm-ai-body{ flex:1; overflow:auto; padding:12px; background:#fff; }

.pcm-msg{ margin:10px 0; display:flex; gap:8px; }
.pcm-msg.is-user{ justify-content:flex-end; }
.pcm-bubble{
  max-width: 86%;
  padding:10px 12px;
  border-radius: 14px;
  border:1px solid var(--pcm-border);
  font-size:13px; line-height:1.35;
  white-space:pre-wrap;
}
.pcm-msg.is-user .pcm-bubble{
  background: rgba(128,11,195,.10);
  border-color: rgba(128,11,195,.25);
}
.pcm-ai-quick{
  padding:10px 12px;
  border-top:1px solid var(--pcm-border);
  display:flex; flex-wrap:wrap; gap:8px;
  background:#fff;
}
.pcm-chip{
  border:1px solid var(--pcm-border);
  background:#fff;
  border-radius:999px;
  padding:8px 10px;
  font-size:12px;
  cursor:pointer;
}
.pcm-chip:hover{
  border-color: rgba(128,11,195,.35);
  background: rgba(128,11,195,.06);
}

.pcm-ai-footer{
  border-top:1px solid var(--pcm-border);
  padding:10px 12px;
  background:#fff;
}
.pcm-ai-inputrow{ display:flex; gap:8px; }
#pcm-ai-input{
  flex:1; border:1px solid var(--pcm-border);
  border-radius: 12px;
  padding:10px 10px; font-size:13px;
  outline:none;
}
#pcm-ai-send{
  border:none; border-radius: 12px;
  padding:10px 12px;
  background: var(--pcm-primary);
  color:#fff; cursor:pointer; font-weight:700;
}
#pcm-ai-send:hover{ background: var(--pcm-primary-hover); }

.pcm-ai-links{
  margin-top:8px; display:flex; justify-content:space-between; align-items:center;
  font-size:12px;
}
.pcm-ai-links a, .pcm-ai-links .linklike{
  color:var(--pcm-muted);
  text-decoration:none;
  background:none; border:none; padding:0; cursor:pointer;
}
.pcm-ai-links a:hover, .pcm-ai-links .linklike:hover{ color:var(--pcm-primary); }

@media (max-width: 480px){
  #pcm-ai-widget{ right:12px; left:12px; bottom:84px; width:auto; height: 70vh; }
  #pcm-ai-launcher{ right:12px; bottom:12px; }
}


.pcm-ai-launcher-img{ width:34px; height:34px; border-radius:50%; object-fit:cover; display:block; }

.pcm-handoff{
  margin:12px 0;
  border:1px solid var(--pcm-border);
  border-radius: var(--pcm-radius-sm);
  padding:10px;
  background: linear-gradient(135deg, rgba(128,11,195,.06), rgba(138,196,64,.06));
}
.pcm-handoff__title{
  font-size:12px;
  color: var(--pcm-text);
  font-weight:800;
  margin-bottom:8px;
}
.pcm-handoff__btns{ display:flex; flex-wrap:wrap; gap:8px; }
.pcm-handoff__btn{
  border:none;
  background: var(--pcm-primary);
  color:#fff;
  padding:9px 10px;
  border-radius: 999px;
  font-size:12px;
  cursor:pointer;
  font-weight:700;
}
.pcm-handoff__btn:hover{ background: var(--pcm-primary-hover); }

.pcm-debug{
  margin:10px 0;
  font-size:11px;
  color:#991b1b;
  border:1px dashed #ef4444;
  border-radius: 12px;
  padding:8px;
  background:#fff;
  white-space: pre-wrap;
}


/* ===== UI Premium (PCM) ===== */
:root{
  --pcm-shadow: 0 18px 55px rgba(0,0,0,.22);
  --pcm-glow: 0 0 0 6px rgba(128,11,195,.16);
  --pcm-grad: linear-gradient(135deg, rgba(128,11,195,.92), rgba(154,63,224,.92));
}
#pcm-ai-launcher{
  box-shadow: var(--pcm-shadow), var(--pcm-glow);
  transition: transform .14s ease, box-shadow .14s ease, filter .14s ease;
}
#pcm-ai-launcher:hover{
  transform: translateY(-2px);
  filter: brightness(1.03);
  box-shadow: 0 22px 70px rgba(0,0,0,.26), 0 0 0 7px rgba(128,11,195,.18);
}
#pcm-ai-widget{
  box-shadow: var(--pcm-shadow);
  border: 1px solid rgba(0,0,0,.08);
  overflow: hidden;
}
.pcm-ai__header{
  background: var(--pcm-grad);
  color: #fff;
  border-bottom: 1px solid rgba(255,255,255,.18);
}
.pcm-ai__brand{
  display:flex; align-items:center; gap:10px;
}
.pcm-ai__brand img{
  width:34px; height:34px; border-radius:12px; object-fit:cover;
  background: rgba(255,255,255,.15);
  box-shadow: 0 10px 25px rgba(0,0,0,.18);
}
.pcm-ai__title{
  font-weight:900;
  letter-spacing:.2px;
}
.pcm-ai__subtitle{
  font-size:12px;
  opacity:.9;
  margin-top:2px;
}
.pcm-ai__close{
  border-radius: 12px !important;
  background: rgba(255,255,255,.16) !important;
  color: #fff !important;
}
.pcm-ai__close:hover{
  background: rgba(255,255,255,.24) !important;
}
.pcm-ai__messages{
  background: radial-gradient(1200px 400px at 50% 0%, rgba(128,11,195,.06), transparent 65%),
              radial-gradient(1200px 400px at 50% 100%, rgba(138,196,64,.06), transparent 60%),
              #fff;
}
.pcm-ai__bubble{
  border-radius: 18px;
  box-shadow: 0 10px 28px rgba(0,0,0,.06);
}
.pcm-ai__bubble--assistant{
  border: 1px solid rgba(0,0,0,.06);
}
.pcm-ai__bubble--user{
  background: linear-gradient(135deg, rgba(128,11,195,.94), rgba(154,63,224,.94));
  color:#fff;
}
.pcm-ai__composer{
  border-top: 1px solid rgba(0,0,0,.08);
  background: #fff;
}
.pcm-ai__input{
  border: 1px solid rgba(0,0,0,.12);
  border-radius: 999px;
  padding: 12px 14px;
}
.pcm-ai__send{
  border-radius: 999px;
  box-shadow: 0 16px 35px rgba(128,11,195,.22);
}
.pcm-ai__send:hover{
  box-shadow: 0 18px 44px rgba(128,11,195,.28);
}

/* Quick replies */
.pcm-ai__quick{
  display:flex; flex-wrap:wrap; gap:8px; padding:10px 12px 2px;
}
.pcm-ai__qr{
  border: 1px solid rgba(0,0,0,.10);
  background:#fff;
  border-radius:999px;
  padding:8px 10px;
  font-size:12px;
  cursor:pointer;
  font-weight:700;
}
.pcm-ai__qr:hover{
  border-color: rgba(128,11,195,.35);
  box-shadow: 0 10px 24px rgba(0,0,0,.06);
}

/* Product cards */
#pcm-ai-widget .pcm-cards{
  display:grid;
  grid-template-columns: 1fr;
  gap:10px;
  margin:10px 0 6px;
}
#pcm-ai-widget .pcm-card{
  display:flex;
  gap:10px;
  border:1px solid rgba(0,0,0,.08);
  border-radius:16px;
  padding:10px;
  background:#fff;
  box-shadow: 0 14px 30px rgba(0,0,0,.06);
}
#pcm-ai-widget .pcm-card__img{
  width:58px; height:58px; border-radius:14px; object-fit:cover;
  background: #f7f7fb;
  border:1px solid rgba(0,0,0,.06);
}
#pcm-ai-widget .pcm-card__body{ flex:1; min-width:0; }
#pcm-ai-widget .pcm-card__title{
  font-weight:900; font-size:13px; margin:0 0 4px;
  line-height:1.2;
}
#pcm-ai-widget .pcm-card__meta{
  display:flex; gap:10px; flex-wrap:wrap;
  font-size:12px; opacity:.9;
}
#pcm-ai-widget .pcm-card__price{
  font-weight:900;
  color: var(--pcm-primary);
}
#pcm-ai-widget .pcm-card__actions{
  display:flex; gap:8px; margin-top:8px; flex-wrap:wrap;
}
#pcm-ai-widget .pcm-card__btn{
  border:none;
  background: var(--pcm-primary);
  color:#fff;
  padding:8px 10px;
  border-radius:999px;
  font-size:12px;
  font-weight:800;
  cursor:pointer;
}
#pcm-ai-widget .pcm-card__btn:hover{ background: var(--pcm-primary-hover); }
#pcm-ai-widget .pcm-card__btn--ghost{
  background:#fff;
  color: var(--pcm-primary);
  border:1px solid rgba(128,11,195,.35);
}
#pcm-ai-widget .pcm-card__btn--ghost:hover{
  border-color: rgba(128,11,195,.55);
}

/* Typing dots */
.pcm-typing{
  display:inline-flex;
  gap:4px;
  align-items:center;
  padding:10px 12px;
  border-radius: 18px;
  background:#fff;
  border: 1px solid rgba(0,0,0,.06);
  box-shadow: 0 10px 28px rgba(0,0,0,.06);
  margin: 8px 0;
}
.pcm-dot{
  width:6px; height:6px; border-radius:50%;
  background: rgba(0,0,0,.35);
  animation: pcmDot 1.1s infinite ease-in-out;
}
.pcm-dot:nth-child(2){ animation-delay:.15s; }
.pcm-dot:nth-child(3){ animation-delay:.3s; }
@keyframes pcmDot{
  0%, 80%, 100%{ transform: translateY(0); opacity:.35; }
  40%{ transform: translateY(-3px); opacity:.9; }
}

@media (min-width: 520px){
#pcm-ai-widget #pcm-ai-widget .pcm-cards{ grid-template-columns: 1fr; }
}

/* ===== UI Premium v1.0.7: Compact + CTA bar ===== */
:root{
  --pcm-cta-h: 52px;
}
#pcm-ai-widget{
  width: min(380px, calc(100vw - 24px));
  height: min(560px, calc(100vh - 110px));
}
.pcm-ai__messages{
  padding-bottom: calc(var(--pcm-cta-h) + 12px);
}
.pcm-ai__cta{
  position:absolute;
  left:0; right:0; bottom:0;
  height: var(--pcm-cta-h);
  display:flex;
  gap:10px;
  align-items:center;
  justify-content:space-between;
  padding:10px 12px;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(8px);
  border-top: 1px solid rgba(0,0,0,.08);
}
.pcm-ai__cta .pcm-ai__badge{
  display:flex; align-items:center; gap:8px;
  font-size:12px; font-weight:900;
  color: #111827;
}
.pcm-ai__dot{
  width:9px; height:9px; border-radius:50%;
  background: rgba(138,196,64,.95);
  box-shadow: 0 0 0 5px rgba(138,196,64,.15);
}
.pcm-ai__ctaBtns{ display:flex; gap:8px; }
.pcm-ai__ctaBtn{
  border:none;
  background: var(--pcm-primary);
  color:#fff;
  padding:10px 12px;
  border-radius:999px;
  font-size:12px;
  font-weight:900;
  cursor:pointer;
  box-shadow: 0 16px 35px rgba(128,11,195,.20);
}
.pcm-ai__ctaBtn:hover{ background: var(--pcm-primary-hover); }
.pcm-ai__ctaBtn--ghost{
  background:#fff;
  color: var(--pcm-primary);
  border:1px solid rgba(128,11,195,.35);
  box-shadow: none;
}
.pcm-ai__ctaBtn--ghost:hover{
  border-color: rgba(128,11,195,.55);
}

/* ===== v1.0.9 Send button (paper plane icon) + human fallback ===== */
#pcm-ai-send{
  width:44px;
  height:44px;
  padding:0;
  border-radius:999px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  box-shadow: 0 16px 35px rgba(128,11,195,.20);
}
#pcm-ai-send:hover{
  box-shadow: 0 18px 44px rgba(128,11,195,.26);
}
.pcm-send-icon{
  width:18px;
  height:18px;
  display:block;
  background:#fff;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3.4 20.2 20.9 12 3.4 3.8l.1 6.6 10.5 1.6-10.5 1.6z'/%3E%3C/svg%3E") no-repeat center / contain;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3.4 20.2 20.9 12 3.4 3.8l.1 6.6 10.5 1.6-10.5 1.6z'/%3E%3C/svg%3E") no-repeat center / contain;
}
#pcm-ai-human.is-hidden{ display:none; }

/* ===== Product cards (namespaced to avoid theme collisions) ===== */
#pcm-ai-widget .pcm-ai-cards{
  display:grid;
  grid-template-columns: 1fr;
  gap:10px;
  margin:10px 0 6px;
}
#pcm-ai-widget .pcm-ai-card{
  display:flex;
  gap:10px;
  border:1px solid rgba(0,0,0,.08);
  border-radius:16px;
  padding:10px;
  background:#fff;
  box-shadow: 0 14px 30px rgba(0,0,0,.06);
  position: relative;
}
#pcm-ai-widget .pcm-ai-card__img{
  width:58px; height:58px; border-radius:14px; object-fit:cover;
  background: #f7f7fb;
  border:1px solid rgba(0,0,0,.06);
  flex: 0 0 auto;
}
#pcm-ai-widget .pcm-ai-card__body{ flex:1; min-width:0; }
#pcm-ai-widget .pcm-ai-card__title{
  font-weight:900; font-size:13px; margin:0 0 4px;
  line-height:1.2;
}
#pcm-ai-widget .pcm-ai-card__meta{
  display:flex; gap:10px; flex-wrap:wrap;
  font-size:12px; opacity:.9;
}
#pcm-ai-widget .pcm-ai-card__price{
  font-weight:900;
  color: var(--pcm-primary);
}
#pcm-ai-widget .pcm-ai-card__actions{
  display:flex; gap:8px; margin-top:8px; flex-wrap:wrap;
}
#pcm-ai-widget .pcm-ai-card__btn{
  border:none;
  background: var(--pcm-primary);
  color:#fff;
  padding:8px 10px;
  border-radius:999px;
  font-size:12px;
  font-weight:800;
  cursor:pointer;
}
#pcm-ai-widget .pcm-ai-card__btn:hover{ background: var(--pcm-primary-hover); }
#pcm-ai-widget .pcm-ai-card__btn--ghost{
  background:#fff;
  color: var(--pcm-primary);
  border:1px solid rgba(128,11,195,.35);
}
#pcm-ai-widget .pcm-ai-card__btn--ghost:hover{
  border-color: rgba(128,11,195,.55);
}

/* ===== v1.0.13: Disable quick replies / reduce handoff pressure ===== */
:root{ --pcm-cta-h: 44px; }
.pcm-ai__cta{ justify-content:flex-start; }

#pcm-ai-widget[data-quick="0"] #pcm-ai-quick{ display:none !important; }

/* ===== v1.0.16: Subtle animations + contextual CTA ===== */
#pcm-ai-widget .pcm-ai__bubble,
#pcm-ai-widget .pcm-ai-card,
#pcm-ai-widget .pcm-ai__cta{
  transform-origin: bottom right;
}
#pcm-ai-widget .pcm-ai__bubble{
  animation: pcmFadeUp .16s ease-out both;
}
#pcm-ai-widget .pcm-ai-card{
  animation: pcmFadeUp .18s ease-out both;
}
@keyframes pcmFadeUp{
  from{ opacity:0; transform: translateY(6px); }
  to{ opacity:1; transform: translateY(0); }
}
#pcm-ai-widget .pcm-ai__ctaBtns{ display:none; }
#pcm-ai-widget .pcm-ai__cta.is-cta-on .pcm-ai__ctaBtns{ display:flex; }
