/* AHC Trợ lý — nút chat kiểu "thẻ tên" + khung chat */
#ahcty{--c:#0b2239;--a:#e3ad55;--a2:#cf9440;--ink:#13233a;--muted:#6b7a8c;--bg:#f7f5f0;position:fixed;bottom:22px;right:22px;z-index:99990;font:15px/1.5 "Be Vietnam Pro",system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;color:var(--ink);-webkit-font-smoothing:antialiased}
#ahcty.left{right:auto;left:22px}
#ahcty *{box-sizing:border-box}
/* ---- nút ---- */
.ahcty-pill{position:relative;display:flex;align-items:center;gap:14px;height:66px;padding:0 14px 0 92px;border:0;border-radius:999px;cursor:pointer;color:var(--c);
  background:linear-gradient(135deg,#f3c873 0%,var(--a) 45%,var(--a2) 100%);box-shadow:0 10px 28px rgba(11,34,57,.28),inset 0 1px 0 rgba(255,255,255,.55),inset 0 -2px 0 rgba(0,0,0,.08);
  transition:transform .25s cubic-bezier(.3,1.4,.5,1),box-shadow .25s;font:inherit;text-align:left}
.ahcty-pill:hover{transform:translateY(-3px);box-shadow:0 16px 34px rgba(11,34,57,.32),inset 0 1px 0 rgba(255,255,255,.55)}
.ahcty-pill:focus-visible{outline:3px solid #fff;outline-offset:3px}
.ahcty-ava{position:absolute;left:-6px;bottom:-2px;width:86px;height:86px;transform-origin:50% 100%;animation:ahcty-breathe 4s ease-in-out infinite;transition:transform .35s cubic-bezier(.3,1.5,.5,1)}
.ahcty-ava i{position:absolute;inset:0;border-radius:50%;background:radial-gradient(circle at 50% 35%,#fff8ea,#f3dcb1);border:3px solid #fff;box-shadow:0 6px 16px rgba(11,34,57,.25)}
.ahcty-ava img{position:absolute;inset:3px;width:calc(100% - 6px);height:calc(100% - 6px);border-radius:50%;object-fit:cover;object-position:50% 12%}
/* ảnh tách nền (sticker): đầu nhô lên khỏi nút như hình mẫu, không khung tròn */
#ahcty img{max-width:none!important;min-width:0;box-shadow:none;margin:0;padding:0}
.ahcty-ava.pop{left:4px;bottom:-1px;width:68px;height:auto}
.ahcty-ava.pop i,.ahcty-ava.pop:after{display:none}
.ahcty-ava.pop img{position:relative;inset:auto;display:block;width:100%!important;height:auto!important;border-radius:0;object-fit:contain;filter:drop-shadow(0 4px 6px rgba(11,34,57,.28))}
.ahcty-pill.pop{padding-left:86px}
.ahcty-pill.pop .ahcty-dot{left:56px;bottom:5px}
.ahcty-pill:hover .ahcty-ava{animation-play-state:paused;transform:rotate(-5deg) scale(1.05)}
.ahcty-dot{position:absolute;left:62px;bottom:6px;width:16px;height:16px;border-radius:50%;background:#22c55e;border:3px solid #fff}
.ahcty-dot:after{content:"";position:absolute;inset:-3px;border-radius:50%;border:2px solid #22c55e;animation:ahcty-ping 2s infinite}
.ahcty-tt b{display:block;font-size:20px;font-weight:800;letter-spacing:-.2px;line-height:1.15}
.ahcty-tt small{display:block;font-size:13px;font-weight:600;opacity:.82}
.ahcty-chev{display:grid;place-items:center;width:32px;height:32px;border-radius:50%;margin-left:6px;background:rgba(255,255,255,.35);transition:transform .3s}
.ahcty-chev svg{width:16px;height:16px}
#ahcty.open .ahcty-chev{transform:rotate(180deg)}
/* bong bóng "Chat với em nhé!" */
.ahcty-bub{position:absolute;bottom:102px;left:2px;padding:8px 16px;border-radius:999px;background:#fff;color:var(--c);font-weight:700;font-size:14px;white-space:nowrap;box-shadow:0 6px 18px rgba(11,34,57,.18);animation:ahcty-bob 2.8s ease-in-out infinite;cursor:pointer}
.ahcty-bub:after{content:"";position:absolute;left:36px;bottom:-7px;border:8px solid transparent;border-top-color:#fff;border-bottom:0}
.ahcty-bub i{position:absolute;right:-6px;top:-6px;width:20px;height:20px;border-radius:50%;background:var(--c);color:#fff;font:700 12px/20px sans-serif;text-align:center;font-style:normal;opacity:0;transition:opacity .2s}
.ahcty-bub:hover i{opacity:1}
#ahcty.open .ahcty-bub,#ahcty.nobub .ahcty-bub{display:none}
/* ---- khung chat ---- */
.ahcty-win{position:absolute;right:0;bottom:84px;width:384px;height:min(600px,calc(100vh - 130px));display:flex;flex-direction:column;background:var(--bg);border-radius:24px;overflow:hidden;
  box-shadow:0 24px 60px rgba(11,34,57,.32);transform-origin:bottom right;transform:translateY(16px) scale(.94);opacity:0;visibility:hidden;transition:.28s cubic-bezier(.3,1.3,.5,1)}
#ahcty.left .ahcty-win{right:auto;left:0;transform-origin:bottom left}
#ahcty.open .ahcty-win{transform:none;opacity:1;visibility:visible}
.ahcty-hd{position:relative;display:flex;align-items:center;gap:12px;padding:16px 16px 18px;color:#fff;background:linear-gradient(135deg,var(--c),#163a5c)}
.ahcty-hd:after{content:"";position:absolute;right:-30px;top:-40px;width:140px;height:140px;border-radius:50%;background:radial-gradient(circle,rgba(227,173,85,.35),transparent 70%)}
.ahcty-hd img{width:48px;height:48px;border-radius:50%;object-fit:cover;object-position:50% 10%;border:2px solid var(--a);background:#f6eddd;flex:none}
.ahcty-hd b{display:block;font-size:16px}.ahcty-hd small{display:flex;align-items:center;gap:6px;font-size:12.5px;opacity:.85}
.ahcty-hd small:before{content:"";width:8px;height:8px;border-radius:50%;background:#22c55e}
.ahcty-x{margin-left:auto;position:relative;z-index:1;width:34px;height:34px;border:0;border-radius:50%;background:rgba(255,255,255,.12);color:#fff;font-size:18px;cursor:pointer}
.ahcty-x:hover{background:rgba(255,255,255,.22)}
.ahcty-body{flex:1;overflow-y:auto;padding:16px 14px 8px;display:flex;flex-direction:column;gap:10px;scroll-behavior:smooth}
.ahcty-m{display:flex;gap:8px;align-items:flex-end;max-width:88%;animation:ahcty-in .3s ease both}
.ahcty-m img{width:28px;height:28px;border-radius:50%;object-fit:cover;object-position:50% 10%;flex:none;background:#f6eddd}
.ahcty-m .t{padding:10px 14px;border-radius:18px 18px 18px 6px;background:#fff;box-shadow:0 1px 2px rgba(11,34,57,.08);white-space:pre-line;word-wrap:break-word;overflow-wrap:anywhere}
.ahcty-m .t a{color:#0e7c83;font-weight:600}
.ahcty-m.u{align-self:flex-end;flex-direction:row-reverse}
.ahcty-m.u .t{background:var(--c);color:#fff;border-radius:18px 18px 6px 18px}
.ahcty-link{display:inline-flex;align-items:center;gap:6px;margin-top:8px;padding:6px 12px;border-radius:999px;background:#fdf3e1;color:#8a5a14!important;text-decoration:none;font-size:13px}
.ahcty-typing .t{display:flex;gap:4px;padding:14px 16px}
.ahcty-typing i{width:7px;height:7px;border-radius:50%;background:#b8c2cd;animation:ahcty-dots 1.2s infinite}
.ahcty-typing i:nth-child(2){animation-delay:.15s}.ahcty-typing i:nth-child(3){animation-delay:.3s}
.ahcty-chips{display:flex;flex-wrap:wrap;gap:6px;padding:0 14px 10px}
.ahcty-chips button{border:1px solid #e3d6bf;background:#fff;color:var(--c);border-radius:999px;padding:6px 12px;font:inherit;font-size:13px;cursor:pointer;transition:.15s}
.ahcty-chips button:hover{background:#fdf3e1;border-color:var(--a)}
.ahcty-ft{display:flex;gap:8px;align-items:flex-end;padding:10px 12px 12px;background:#fff;border-top:1px solid #efe9de}
.ahcty-ft textarea{flex:1;resize:none;border:1px solid #e3e0d8;border-radius:16px;padding:10px 14px;font:inherit;max-height:110px;outline:0;background:#faf9f6;color:var(--ink)}
.ahcty-ft textarea:focus{border-color:var(--a);background:#fff}
.ahcty-send{flex:none;width:42px;height:42px;border:0;border-radius:50%;background:var(--a);color:var(--c);cursor:pointer;display:grid;place-items:center;transition:.15s}
.ahcty-send:hover{filter:brightness(1.05);transform:scale(1.05)}.ahcty-send:disabled{opacity:.5;cursor:default;transform:none}
.ahcty-send svg{width:18px;height:18px}
.ahcty-note{font-size:11px;color:var(--muted);text-align:center;padding:0 12px 8px;background:#fff}
@keyframes ahcty-bob{0%,100%{transform:translateY(0)}50%{transform:translateY(-5px)}}
@keyframes ahcty-ping{0%{transform:scale(1);opacity:.8}100%{transform:scale(2.2);opacity:0}}
@keyframes ahcty-in{from{opacity:0;transform:translateY(6px)}to{opacity:1;transform:none}}
@keyframes ahcty-dots{0%,60%,100%{transform:translateY(0);opacity:.5}30%{transform:translateY(-4px);opacity:1}}

/* ===== hiệu ứng động ===== */
#ahcty .ahcty-pill{animation:ahcty-enter .8s cubic-bezier(.3,1.5,.5,1) .5s both,ahcty-wiggle 9s ease-in-out 4s infinite}
#ahcty.open .ahcty-pill{animation:none}
.ahcty-shine{position:absolute;inset:0;border-radius:inherit;overflow:hidden;pointer-events:none}
.ahcty-shine:after{content:"";position:absolute;top:0;bottom:0;left:-40%;width:30%;background:linear-gradient(100deg,transparent,rgba(255,255,255,.55),transparent);transform:skewX(-20deg);animation:ahcty-shine 5s ease-in-out 1.6s infinite}
.ahcty-chev svg{animation:ahcty-up 2.4s ease-in-out infinite}
#ahcty.open .ahcty-chev svg{animation:none}
.ahcty-bub{animation:ahcty-pop .55s cubic-bezier(.3,1.6,.5,1) 1.1s both,ahcty-bob 2.8s ease-in-out 1.7s infinite}
.ahcty-bt:after{content:"";display:inline-block;width:2px;height:1em;margin-left:2px;vertical-align:-2px;background:currentColor;animation:ahcty-caret 1s steps(1) infinite}
.ahcty-rays{position:absolute;right:-18px;top:-14px;width:22px;height:22px;pointer-events:none}
.ahcty-rays b{position:absolute;left:0;bottom:0;width:4px;height:12px;border-radius:3px;background:var(--a);transform-origin:50% 100%;animation:ahcty-ray 2.4s ease-in-out infinite}
.ahcty-rays b:nth-child(1){transform:rotate(-10deg) translate(2px,-8px)}
.ahcty-rays b:nth-child(2){transform:rotate(35deg) translate(8px,-4px);animation-delay:.12s}
.ahcty-rays b:nth-child(3){transform:rotate(80deg) translate(10px,4px);animation-delay:.24s}
.ahcty-hand{position:absolute;right:-6px;bottom:-22px;width:40px;height:40px;pointer-events:none;animation:ahcty-tap 2.4s ease-in-out 2s infinite;opacity:0}
.ahcty-hand svg{width:100%;height:100%;filter:drop-shadow(0 3px 4px rgba(0,0,0,.25))}
.ahcty-hand .r{stroke:var(--a)}
#ahcty.open .ahcty-hand,#ahcty.nobub .ahcty-hand{display:none}
.ahcty-chips button{animation:ahcty-in .35s ease both}
.ahcty-hd img{animation:ahcty-ring 2.6s ease-out infinite}
@keyframes ahcty-enter{from{opacity:0;transform:translateY(40px) scale(.7)}to{opacity:1;transform:none}}
@keyframes ahcty-wiggle{0%,92%,100%{transform:none}93%{transform:rotate(-3deg) scale(1.03)}95%{transform:rotate(3deg) scale(1.03)}97%{transform:rotate(-2deg)}99%{transform:rotate(1deg)}}
@keyframes ahcty-shine{0%{left:-40%}35%,100%{left:120%}}
@keyframes ahcty-breathe{0%,100%{transform:translateY(0) rotate(0)}50%{transform:translateY(-3px) rotate(-1.5deg)}}
@keyframes ahcty-up{0%,100%{transform:translateY(1px)}50%{transform:translateY(-3px)}}
@keyframes ahcty-pop{from{opacity:0;transform:translateY(10px) scale(.6)}to{opacity:1;transform:none}}
@keyframes ahcty-caret{50%{opacity:0}}
@keyframes ahcty-ray{0%,60%,100%{opacity:1}70%{opacity:.2}80%{opacity:1}}
@keyframes ahcty-tap{0%{opacity:0;transform:translate(14px,14px) scale(.9)}15%{opacity:1;transform:none}30%{transform:translate(-3px,-3px) scale(.88)}40%{transform:none}55%{transform:translate(-3px,-3px) scale(.88)}65%{transform:none}85%{opacity:1}100%{opacity:0;transform:translate(10px,10px)}}
@keyframes ahcty-ring{0%{box-shadow:0 0 0 0 rgba(227,173,85,.7)}70%{box-shadow:0 0 0 10px rgba(227,173,85,0)}100%{box-shadow:0 0 0 0 rgba(227,173,85,0)}}
@media (prefers-reduced-motion:reduce){#ahcty *{animation:none!important;transition:none!important}}
/* điện thoại */
@media (max-width:600px){
  #ahcty{bottom:14px;right:14px}#ahcty.left{left:14px}
  .ahcty-pill{height:56px;padding:0 10px 0 74px;gap:8px}
  .ahcty-ava{width:70px;height:70px}.ahcty-ava.pop{width:56px}.ahcty-pill.pop{padding-left:70px}.ahcty-pill.pop .ahcty-dot{left:46px}.ahcty-hand{display:none}.ahcty-dot{left:50px;bottom:4px;width:14px;height:14px}
  .ahcty-tt b{font-size:17px}.ahcty-tt small{font-size:12px}
  .ahcty-bub{bottom:86px;left:0;font-size:13px}
  .ahcty-win{position:fixed;inset:auto 8px 80px 8px;width:auto;height:calc(100% - 100px);border-radius:20px}
  #ahcty.open .ahcty-pill .ahcty-tt,#ahcty.open .ahcty-bub{display:none}
  #ahcty.open .ahcty-pill{padding-right:6px}
  .ahcty-ft textarea{font-size:16px}
}
/* ẩn khi mở menu / tìm kiếm của theme AHC */
body:has(#site-nav.is-open) #ahcty,body:has(.search-layer.is-open) #ahcty{display:none}
