/* Chat box (app/chat.php, assets/js/chat.js) */
.cbx{--cbx-p:var(--bivf-mulberry,#4A2169);--cbx-c:var(--bivf-coral,#F84848);position:fixed;right:24px;bottom:24px;z-index:1250;font-family:var(--bivf-body,system-ui,sans-serif)}
.cbx *{box-sizing:border-box}
.cbx-launch{position:relative;width:62px;height:62px;border-radius:50%;border:0;cursor:pointer;color:#fff;background:linear-gradient(135deg,var(--cbx-p),#7B3AA8 55%,var(--cbx-c));box-shadow:0 14px 34px rgba(74,33,105,.38);display:grid;place-items:center;transition:transform .35s cubic-bezier(.2,.9,.3,1.3);animation:cbxIn .7s cubic-bezier(.2,.9,.3,1.4) .6s both}
.cbx-launch:hover{transform:scale(1.07)}
.cbx-launch svg{position:absolute;width:28px;height:28px;fill:#fff;stroke:#fff;stroke-width:0;transition:transform .35s,opacity .25s}
.cbx-launch .cbx-ic-chat circle{fill:var(--cbx-p)}
.cbx-launch .cbx-ic-x{fill:none;stroke-width:2.4;stroke-linecap:round;opacity:0;transform:rotate(-90deg) scale(.5)}
.cbx[data-state=open] .cbx-ic-chat{opacity:0;transform:rotate(90deg) scale(.5)}
.cbx[data-state=open] .cbx-ic-x{opacity:1;transform:none}
.cbx-ring{position:absolute;inset:0;border-radius:50%;border:2px solid rgba(123,58,168,.55);animation:cbxRing 2.6s ease-out infinite}
.cbx-ring.r2{animation-delay:1.3s}
.cbx[data-state=open] .cbx-ring,.cbx.seen .cbx-ring{display:none}
.cbx-dot{position:absolute;top:3px;right:3px;width:14px;height:14px;border-radius:50%;background:#2EC27E;border:2.5px solid #fff;animation:cbxPop .4s 1.6s both}
.cbx[data-state=open] .cbx-dot{display:none}
.cbx-teaser{position:absolute;right:4px;bottom:76px;width:250px;background:#fff;border-radius:18px 18px 4px 18px;padding:14px 34px 14px 16px;box-shadow:0 16px 40px rgba(36,23,58,.18);font-size:14.5px;line-height:1.45;color:#24173A;cursor:pointer;animation:cbxRise .5s cubic-bezier(.2,.9,.3,1.3) both}
.cbx-teaser b{display:block;font-family:var(--bivf-display,inherit);font-size:15.5px;margin-bottom:2px}
.cbx-teaser-x{position:absolute;top:6px;right:6px;width:24px;height:24px;border:0;border-radius:50%;background:#F4EFF8;color:#4A2169;font-size:16px;line-height:1;cursor:pointer}
.cbx-panel{position:absolute;right:0;bottom:78px;width:380px;max-width:calc(100vw - 32px);height:min(600px,calc(100vh - 130px));background:#FBF9FE;border-radius:24px;box-shadow:0 30px 80px rgba(36,23,58,.28),0 0 0 1px rgba(74,33,105,.06);display:flex;flex-direction:column;overflow:hidden;transform-origin:bottom right;animation:cbxOpen .38s cubic-bezier(.2,.9,.3,1.15) both}
.cbx-panel[hidden],.cbx-teaser[hidden]{display:none}
.cbx-panel.closing{animation:cbxClose .22s ease-in both}
.cbx-head{display:flex;align-items:center;gap:10px;padding:14px 14px 14px 16px;color:#fff;background:linear-gradient(120deg,var(--cbx-p),#6B2F8F 60%,#8E3A86);position:relative;overflow:hidden}
.cbx-head::after{content:"";position:absolute;right:-40px;top:-60px;width:160px;height:160px;border-radius:50%;background:radial-gradient(circle,rgba(248,72,72,.45),transparent 70%);animation:cbxFloat 6s ease-in-out infinite}
.cbx-av{flex:none;width:40px;height:40px;border-radius:14px;background:rgba(255,255,255,.16);display:grid;place-items:center;animation:cbxBeat 2.4s ease-in-out infinite}
.cbx-av svg{width:22px;height:22px;fill:#fff}
.cbx-title{flex:1;min-width:0;position:relative;z-index:1}
.cbx-title b{display:block;font:600 16px/1.2 var(--bivf-display,inherit)}
.cbx-title small{display:flex;align-items:center;gap:6px;font-size:12.5px;opacity:.85;margin-top:3px}
.cbx-title i{width:8px;height:8px;border-radius:50%;background:#56E39F;box-shadow:0 0 0 3px rgba(86,227,159,.25)}
.cbx-lang{display:flex;background:rgba(255,255,255,.14);border-radius:999px;padding:3px;position:relative;z-index:1}
.cbx-lang button{border:0;background:none;color:#fff;font:600 12.5px var(--bivf-body,inherit);padding:5px 9px;border-radius:999px;cursor:pointer}
.cbx-lang button.on{background:#fff;color:var(--cbx-p)}
.cbx-close{position:relative;z-index:1;width:34px;height:34px;border:0;border-radius:50%;background:rgba(255,255,255,.14);cursor:pointer;display:grid;place-items:center}
.cbx-close svg{width:16px;height:16px;fill:none;stroke:#fff;stroke-width:2.4;stroke-linecap:round}
.cbx-body{flex:1;overflow-y:auto;padding:16px 14px 8px;display:flex;flex-direction:column;gap:10px;scroll-behavior:smooth;background-image:radial-gradient(rgba(74,33,105,.05) 1px,transparent 1px);background-size:16px 16px}
.cbx-m{max-width:86%;padding:10px 14px;border-radius:18px;font-size:14.5px;line-height:1.55;white-space:pre-line;word-wrap:break-word;animation:cbxMsg .35s cubic-bezier(.2,.9,.3,1.2) both}
.cbx-m.b{align-self:flex-start;background:#fff;color:#24173A;border-bottom-left-radius:6px;box-shadow:0 4px 14px rgba(74,33,105,.08)}
.cbx-m.u{align-self:flex-end;color:#fff;background:linear-gradient(135deg,var(--cbx-p),#7B3AA8);border-bottom-right-radius:6px;animation-name:cbxMsgR}
.cbx-acts{display:flex;flex-wrap:wrap;gap:6px;margin-top:10px;white-space:normal}
.cbx-acts a{display:inline-flex;align-items:center;gap:5px;text-decoration:none;font-size:13px;font-weight:600;padding:7px 12px;border-radius:999px;background:#F4EFF8;color:var(--cbx-p);transition:background .2s,transform .2s}
.cbx-acts a:hover{background:#EADFF5;transform:translateY(-1px)}
.cbx-acts a.wa{background:#E7F8EE;color:#1B7A45}
.cbx-acts a.main{background:var(--cbx-c);color:#fff}
.cbx-typing{align-self:flex-start;background:#fff;border-radius:18px;border-bottom-left-radius:6px;padding:12px 16px;display:flex;gap:5px;box-shadow:0 4px 14px rgba(74,33,105,.08);animation:cbxMsg .3s both}
.cbx-typing i{width:7px;height:7px;border-radius:50%;background:#B9A4CE;animation:cbxDots 1.2s infinite}
.cbx-typing i:nth-child(2){animation-delay:.15s}.cbx-typing i:nth-child(3){animation-delay:.3s}
.cbx-chips{display:flex;gap:6px;overflow-x:auto;padding:8px 12px 4px;scrollbar-width:none}
.cbx-chips::-webkit-scrollbar{display:none}
.cbx-chips button{flex:none;border:1px solid #E3D6F0;background:#fff;color:#4A2169;font:500 13px var(--bivf-body,inherit);padding:7px 12px;border-radius:999px;cursor:pointer;transition:all .2s;animation:cbxMsg .4s both}
.cbx-chips button:hover{background:var(--cbx-p);color:#fff;border-color:var(--cbx-p)}
.cbx-form{display:flex;gap:8px;padding:10px 12px 6px}
.cbx-form input{flex:1;min-width:0;border:1.5px solid #E3D6F0;border-radius:999px;padding:11px 16px;font:15px var(--bivf-body,inherit);background:#fff;color:#24173A;outline:none;transition:border-color .2s,box-shadow .2s}
.cbx-form input:focus{border-color:#9B6CC4;box-shadow:0 0 0 4px rgba(155,108,196,.15)}
.cbx-form button{flex:none;width:44px;height:44px;border:0;border-radius:50%;cursor:pointer;background:linear-gradient(135deg,var(--cbx-c),#FF8A4C);display:grid;place-items:center;transition:transform .2s}
.cbx-form button:hover{transform:scale(1.08) rotate(-8deg)}
.cbx-form button svg{width:20px;height:20px;fill:#fff}
.cbx-note{margin:0;padding:2px 16px 12px;font-size:11.5px;line-height:1.4;color:#7A6A8C;text-align:center}
@keyframes cbxIn{from{opacity:0;transform:scale(.3) translateY(30px)}to{opacity:1;transform:none}}
@keyframes cbxRing{0%{transform:scale(1);opacity:.9}100%{transform:scale(1.7);opacity:0}}
@keyframes cbxPop{from{transform:scale(0)}to{transform:scale(1)}}
@keyframes cbxRise{from{opacity:0;transform:translateY(12px) scale(.9)}to{opacity:1;transform:none}}
@keyframes cbxOpen{from{opacity:0;transform:translateY(20px) scale(.85)}to{opacity:1;transform:none}}
@keyframes cbxClose{to{opacity:0;transform:translateY(16px) scale(.9)}}
@keyframes cbxMsg{from{opacity:0;transform:translateY(10px) translateX(-6px) scale(.96)}to{opacity:1;transform:none}}
@keyframes cbxMsgR{from{opacity:0;transform:translateY(10px) translateX(6px) scale(.96)}to{opacity:1;transform:none}}
@keyframes cbxDots{0%,60%,100%{transform:translateY(0);opacity:.5}30%{transform:translateY(-5px);opacity:1}}
@keyframes cbxBeat{0%,100%{transform:scale(1)}15%{transform:scale(1.1)}30%{transform:scale(1)}45%{transform:scale(1.06)}}
@keyframes cbxFloat{0%,100%{transform:translate(0,0)}50%{transform:translate(-20px,14px)}}
/* the back-to-top button moves above the chat button */
.hp-top-btn{bottom:100px!important}
@media (max-width:1239.98px){
  .cbx{right:14px;bottom:calc(90px + env(safe-area-inset-bottom))}
  .cbx-launch{width:54px;height:54px}
  .hp-top-btn{bottom:calc(156px + env(safe-area-inset-bottom))!important}
}
@media (max-width:520px){
  .cbx-panel{position:fixed;left:8px;right:8px;bottom:calc(84px + env(safe-area-inset-bottom));top:auto;width:auto;max-width:none;height:min(78vh,620px)}
  .cbx-teaser{width:220px}
}
@media (prefers-reduced-motion:reduce){.cbx *,.cbx{animation:none!important;transition:none!important}}
.cbx-sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
