:root{color-scheme:light}
#pcwb-widget{position:fixed;bottom:20px;z-index:999999;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;--pcwb-ink:#1a2233;--pcwb-sub:#6b7280;--pcwb-bg:#f3f5f8;--pcwb-shadow:0 10px 30px rgba(20,20,43,.14)}
#pcwb-widget *{box-sizing:border-box}
#pcwb-widget.pcwb-right{right:20px; bottom:60px;}
#pcwb-widget.pcwb-left{left:20px}

/* ---------- Floating buttons ---------- */
.pcwb-buttons{display:flex;flex-direction:column;align-items:flex-end;gap:14px}
#pcwb-widget.pcwb-left .pcwb-buttons{align-items:flex-start}
.pcwb-fab{position:relative;width:60px;height:60px;border:0;border-radius:50% !important;display:grid;place-items:center;box-shadow:0 8px 24px rgba(0,0,0,.22);cursor:pointer;text-decoration:none;transition:transform .22s cubic-bezier(.34,1.56,.64,1),box-shadow .22s ease}
.pcwb-fab:hover{transform:translateY(-3px) scale(1.06);box-shadow:0 14px 32px rgba(0,0,0,.26)}
.pcwb-fab:active{transform:translateY(0) scale(.96)}
.pcwb-fab svg{width:26px;height:26px;position:relative;z-index:2}

.pcwb-chat{background:linear-gradient(145deg,var(--pcwb-color),color-mix(in srgb,var(--pcwb-color) 68%,#000));color:#fff; border-radius:50%!important;}
.pcwb-chat svg{fill:none;stroke:#fff;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.pcwb-chat::before{content:"";position:absolute;inset:0;border-radius:50%;background:var(--pcwb-color);opacity:.55;animation:pcwb-pulse 2.6s ease-out infinite}
.pcwb-chat.pcwb-open::before{animation:none;opacity:0}

.pcwb-whatsapp{background:linear-gradient(145deg,#2fd766,#1ea952)}
.pcwb-whatsapp svg{fill:#fff;stroke:none}

.pcwb-badge{position:absolute;top:-3px;right:-3px;min-width:19px;height:19px;padding:0 4px;border-radius:999px;background:#ff4d4f;color:#fff;font-size:11px;font-weight:700;display:grid;place-items:center;border:2px solid #fff;z-index:3;animation:pcwb-badge-in .25s ease}
.pcwb-badge[hidden]{display:none}

@keyframes pcwb-pulse{0%{transform:scale(1);opacity:.55}75%{transform:scale(1.55);opacity:0}100%{transform:scale(1.55);opacity:0}}
@keyframes pcwb-badge-in{from{transform:scale(0)}to{transform:scale(1)}}

/* ---------- Panel ---------- */
.pcwb-panel{width:min(376px,calc(100vw - 32px));height:min(560px,72vh);background:#fff;border-radius:20px;box-shadow:var(--pcwb-shadow);overflow:hidden;margin-bottom:16px;border:1px solid rgba(20,20,43,.06);display:flex;flex-direction:column;transform-origin:bottom var(--pcwb-origin,right);animation:pcwb-panel-in .28s cubic-bezier(.2,.9,.3,1.2)}
#pcwb-widget.pcwb-left .pcwb-panel{--pcwb-origin:left}
.pcwb-panel[hidden]{display:none}
@keyframes pcwb-panel-in{from{opacity:0;transform:translateY(14px) scale(.96)}to{opacity:1;transform:translateY(0) scale(1)}}

.pcwb-header{flex:0 0 auto;background:linear-gradient(120deg,var(--pcwb-color),color-mix(in srgb,var(--pcwb-color) 72%,#000));color:#fff;padding:14px 16px;display:flex;justify-content:space-between;align-items:center;gap:10px}
.pcwb-header-info{display:flex;align-items:center;gap:11px;min-width:0}
.pcwb-avatar{flex:0 0 auto;width:38px;height:38px;border-radius:50%;background:rgba(255,255,255,.22);display:grid;place-items:center;position:relative}
.pcwb-avatar svg{width:20px;height:20px;fill:none;stroke:#fff;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.pcwb-avatar .pcwb-dot{position:absolute;bottom:-1px;right:-1px;width:11px;height:11px;border-radius:50%;background:#3ddc73;border:2px solid var(--pcwb-color)}
.pcwb-header-text{min-width:0}
.pcwb-header-text strong{display:block;font-size:15px;font-weight:700;line-height:1.25;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.pcwb-header-text small{display:block;font-size:12px;opacity:.88;margin-top:1px}
.pcwb-header button{flex:0 0 auto;background:rgba(255,255,255,.16);border:0;width:32px;height:32px;border-radius:50%;color:#fff;cursor:pointer;display:grid;place-items:center;transition:background .15s ease}
.pcwb-header button:hover{background:rgba(255,255,255,.28)}
.pcwb-header button svg{width:16px;height:16px;fill:none;stroke:#fff;stroke-width:2.2;stroke-linecap:round}

.pcwb-messages{flex:1 1 auto;padding:16px;overflow-y:auto;background:var(--pcwb-bg);display:flex;flex-direction:column;scroll-behavior:smooth}
.pcwb-messages::-webkit-scrollbar{width:6px}
.pcwb-messages::-webkit-scrollbar-thumb{background:rgba(20,20,43,.16);border-radius:999px}

.pcwb-row{display:flex;align-items:flex-end;gap:8px;margin:0 0 12px;max-width:92%;animation:pcwb-msg-in .22s ease}
.pcwb-row.pcwb-user{align-self:flex-end;flex-direction:row-reverse}
@keyframes pcwb-msg-in{from{opacity:0;transform:translateY(6px)}to{opacity:1;transform:translateY(0)}}
.pcwb-mini-avatar{flex:0 0 auto;width:24px;height:24px;border-radius:50%;background:var(--pcwb-color);display:grid;place-items:center;margin-bottom:2px}
.pcwb-mini-avatar svg{width:13px;height:13px;fill:none;stroke:#fff;stroke-width:2.4;stroke-linecap:round;stroke-linejoin:round}

.pcwb-msg{padding:10px 13px;border-radius:16px;font-size:14px;line-height:1.5;white-space:pre-wrap;word-break:break-word;color:var(--pcwb-ink)}
.pcwb-bot .pcwb-msg{background:#fff;border:1px solid #e9ebf0;border-bottom-left-radius:5px;box-shadow:0 1px 2px rgba(20,20,43,.04)}
.pcwb-user .pcwb-msg{background:linear-gradient(135deg,var(--pcwb-color),color-mix(in srgb,var(--pcwb-color) 75%,#000));color:#fff;border-bottom-right-radius:5px}

button#pcwb-chat-toggle {
    border-radius: 50% !important;
}

.pcwb-typing .pcwb-msg{display:flex;align-items:center;gap:4px;padding:12px 14px}
.pcwb-typing span{width:6px;height:6px;border-radius:50%;background:#9aa2b1;animation:pcwb-bounce 1.1s infinite ease-in-out}
.pcwb-typing span:nth-child(2){animation-delay:.15s}
.pcwb-typing span:nth-child(3){animation-delay:.3s}
@keyframes pcwb-bounce{0%,60%,100%{transform:translateY(0);opacity:.5}30%{transform:translateY(-4px);opacity:1}}

.pcwb-product{display:grid;grid-template-columns:56px 1fr;gap:11px;background:#fff;border:1px solid #e9ebf0;border-radius:14px;padding:10px;margin:8px 0 0;max-width:92%;transition:box-shadow .15s ease,transform .15s ease}
.pcwb-product:hover{box-shadow:0 6px 18px rgba(20,20,43,.1);transform:translateY(-1px)}
.pcwb-product img{width:56px;height:56px;object-fit:cover;border-radius:10px;background:#f1f2f5}
.pcwb-product-info{min-width:0}
.pcwb-product a{font-weight:700;color:var(--pcwb-ink);text-decoration:none;font-size:13px;display:block}
.pcwb-product a:hover{text-decoration:underline}
.pcwb-product .price{font-weight:700;color:var(--pcwb-color);font-size:13px;margin-top:2px}
.pcwb-product .pcwb-stock{display:inline-flex;align-items:center;gap:4px;font-size:11px;font-weight:600;margin-top:4px;padding:2px 7px;border-radius:999px}
.pcwb-stock.in{background:#e7f8ee;color:#0e9f5f}
.pcwb-stock.out{background:#fdeceb;color:#e5484d}
.pcwb-product small.pcwb-excerpt{display:block;color:var(--pcwb-sub);margin-top:4px;font-size:12px;line-height:1.4}

.pcwb-form{flex:0 0 auto;padding:10px 12px;display:flex;gap:8px;border-top:1px solid #edeef2;background:#fff}
.pcwb-form input{flex:1;border:1px solid #dde1e8;border-radius:24px;padding:0 15px;height:42px;outline:none;font-size:14px;background:var(--pcwb-bg);transition:border-color .15s ease,background .15s ease}
.pcwb-form input:focus{border-color:var(--pcwb-color);background:#fff}
.pcwb-form button{flex:0 0 auto;width:42px;height:42px;border:0;border-radius:50%;background:linear-gradient(135deg,var(--pcwb-color),color-mix(in srgb,var(--pcwb-color) 72%,#000));color:#fff;cursor:pointer;display:grid;place-items:center;transition:transform .15s ease}
.pcwb-form button:hover{transform:scale(1.06)}
.pcwb-form button:disabled{opacity:.55;cursor:default;transform:none}
.pcwb-form button svg{width:18px;height:18px;fill:none;stroke:#fff;stroke-width:2.3;stroke-linecap:round;stroke-linejoin:round}

/* ---------- Mobile ---------- */
@media (max-width:480px){
  #pcwb-widget.pcwb-right,#pcwb-widget.pcwb-left{right:14px;left:auto;bottom:80px}
  .pcwb-fab{width:54px;height:54px}
  .pcwb-fab svg{width:24px;height:24px}
  .pcwb-panel{position:fixed;inset:0;width:100vw;height:100dvh;max-height:100dvh;margin:0;border-radius:0;animation:pcwb-panel-in-mobile .25s ease}
  .pcwb-header{padding-top:max(14px,env(safe-area-inset-top))}
  .pcwb-form{padding-bottom:max(10px,env(safe-area-inset-bottom))}
  .pcwb-buttons{position:relative;z-index:2}
}
@keyframes pcwb-panel-in-mobile{from{opacity:0;transform:translateY(100%)}to{opacity:1;transform:translateY(0)}}

@media (prefers-reduced-motion:reduce){
  .pcwb-fab,.pcwb-chat::before,.pcwb-panel,.pcwb-row,.pcwb-typing span{animation:none!important;transition:none!important}
}
