/* Live chat widget (public/shop/js/chat.js). Design v2 (2026-12-03): launcher that turns into "close",
   panel with a dark header, intro with quick topics, grouped bubbles with avatar, day separators,
   "Seen", preview of a new answer next to the closed launcher; full screen on phones. */
.gch-btn, .gch, .gch-peek { --gch-r: 24px; --gch-ink: #14151b; --gch-soft: #f4f2ee; font-family: var(--body); -webkit-font-smoothing: antialiased; }

/* ---------- launcher ---------- */
.gch-btn { position: fixed; z-index: 112; left: 20px; bottom: 20px; width: 60px; height: 60px; border: 0; border-radius: 50%; background: var(--brand); color: #fff; cursor: pointer; display: grid; place-items: center; box-shadow: 0 14px 30px -10px rgba(255, 90, 31, .8), 0 3px 8px rgba(20, 21, 27, .18); transition: transform .2s cubic-bezier(.3, .7, .4, 1.4), bottom .25s, opacity .2s, box-shadow .2s; }
.gch-btn:hover { transform: scale(1.07); box-shadow: 0 18px 36px -10px rgba(255, 90, 31, .85), 0 3px 8px rgba(20, 21, 27, .2); }
.gch-btn:active { transform: scale(.96); }
.gch-btn:focus-visible { outline: 3px solid var(--brand-soft); outline-offset: 3px; }
.gch-btn svg { position: absolute; width: 28px; height: 28px; transition: transform .25s, opacity .2s; }
.gch-btn .gch-i-close { opacity: 0; transform: rotate(90deg) scale(.6); }
.gch-btn[aria-expanded="true"] .gch-i-chat { opacity: 0; transform: rotate(-90deg) scale(.6); }
.gch-btn[aria-expanded="true"] .gch-i-close { opacity: 1; transform: none; }
.gch-btn__dot { position: absolute; top: -2px; left: -2px; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: #e11d48; color: #fff; font: 800 11.5px/18px var(--body); text-align: center; border: 2px solid #fff; animation: gch-pop .3s cubic-bezier(.3, .7, .4, 1.6); }
.gch-btn__dot[hidden] { display: none; }
body:has(.pd__bar.show) .gch-btn { bottom: 92px; }
/* phones: the button steps aside while the page scrolls down (it covered card buttons and totals),
   comes back on scrolling up or a pause; above the cart's Total/Checkout bar */
.gch-btn.is-away { transform: translateY(calc(100% + 40px)); opacity: 0; pointer-events: none; }
@media (max-width: 1000px) { body:has(.cartbar.show) .gch-btn { bottom: 84px; } }

/* ---------- preview of a new answer while the window is closed ---------- */
.gch-peek { position: fixed; z-index: 111; left: 20px; bottom: 94px; width: 300px; padding: 14px 14px 14px 40px; display: flex; gap: 10px; align-items: flex-start; background: #fff; color: var(--ink); border-radius: 18px 18px 18px 6px; box-shadow: 0 22px 50px -16px rgba(20, 21, 27, .4), 0 0 0 1px rgba(20, 21, 27, .06); cursor: pointer; text-align: right; border: 0; font-size: 14px; line-height: 1.45; animation: gch-rise .3s cubic-bezier(.2, .8, .3, 1); }
.gch-peek[hidden] { display: none; }
.gch-peek b { display: block; font: 700 13px var(--display); margin-bottom: 2px; }
.gch-peek__b { min-width: 0; }
.gch-peek__t { overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; color: var(--ink-2); }
.gch-peek__x { position: absolute; top: 8px; left: 8px; width: 26px; height: 26px; border: 0; border-radius: 50%; background: var(--gch-soft); color: var(--mute); font-size: 16px; line-height: 1; cursor: pointer; }
body:has(.pd__bar.show) .gch-peek { bottom: 166px; }

/* ---------- window ---------- */
.gch { position: fixed; z-index: 111; left: 20px; bottom: 94px; width: 390px; height: min(640px, calc(100vh - 120px)); display: flex; flex-direction: column; background: var(--gch-soft); border-radius: var(--gch-r); overflow: hidden; box-shadow: 0 40px 90px -24px rgba(20, 21, 27, .5), 0 0 0 1px rgba(20, 21, 27, .07); font-size: 14.5px; line-height: 1.5; color: var(--ink); transform-origin: calc(100% - 30px) calc(100% + 40px); opacity: 0; transform: translateY(14px) scale(.96); transition: opacity .2s ease, transform .25s cubic-bezier(.2, .8, .3, 1); }
.gch.is-open { opacity: 1; transform: none; }
.gch[hidden] { display: none; }
body:has(.pd__bar.show) .gch { bottom: 166px; height: min(640px, calc(100vh - 190px)); }

/* header */
.gch__hd { position: relative; display: flex; align-items: center; gap: 12px; padding: 18px 18px 18px 16px; color: #fff; background: radial-gradient(120% 140% at 100% 0, rgba(255, 90, 31, .55) 0, rgba(255, 90, 31, 0) 55%), linear-gradient(160deg, #23252f 0, var(--gch-ink) 70%); }
.gch__av { position: relative; width: 44px; height: 44px; border-radius: 50%; background: #fff; display: grid; place-items: center; flex: none; box-shadow: 0 0 0 3px rgba(255, 255, 255, .12); }
.gch__av svg { width: 26px; height: 26px; }
.gch__av::after { content: ""; position: absolute; left: 0; bottom: 1px; width: 12px; height: 12px; border-radius: 50%; background: var(--green); border: 2px solid #1b1c23; }
.gch__hd b { display: block; font: 700 16px/1.25 var(--display); letter-spacing: -.01em; }
.gch__hd small { display: block; margin-top: 2px; color: rgba(255, 255, 255, .72); font-size: 12.5px; }
.gch__x { margin-right: auto; flex: none; width: 36px; height: 36px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .1); color: #fff; cursor: pointer; display: grid; place-items: center; transition: background .15s; }
.gch__x:hover { background: rgba(255, 255, 255, .2); }
.gch__x svg { width: 20px; height: 20px; }

/* scrolling part */
.gch__body { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 18px 16px 10px; scroll-behavior: smooth; }
.gch__body::-webkit-scrollbar { width: 6px; }
.gch__body::-webkit-scrollbar-thumb { background: rgba(20, 21, 27, .15); border-radius: 3px; }

/* intro: shown until the visitor has a conversation */
.gch__intro { background: #fff; border-radius: 20px; padding: 20px 18px 18px; box-shadow: 0 1px 2px rgba(20, 21, 27, .05), 0 0 0 1px rgba(20, 21, 27, .05); animation: gch-rise .35s cubic-bezier(.2, .8, .3, 1); }
.gch__intro[hidden] { display: none; }
.gch__intro h3 { margin: 0 0 6px; font: 800 22px/1.2 var(--display); letter-spacing: -.02em; }
.gch__intro p { margin: 0 0 14px; color: var(--ink-2); }
.gch__chips { display: flex; flex-wrap: wrap; gap: 8px; }
.gch__chip { padding: 8px 13px; border: 1px solid var(--line-2); border-radius: 999px; background: #fff; color: var(--ink); font: 600 13px/1.2 var(--body); cursor: pointer; transition: border-color .15s, background .15s, color .15s; }
.gch__chip:hover { border-color: var(--brand); color: var(--brand-ink); background: var(--brand-soft); }

/* messages */
.gch__list { display: flex; flex-direction: column; }
.gch__day { align-self: center; margin: 14px 0 8px; padding: 3px 10px; border-radius: 999px; background: rgba(20, 21, 27, .06); color: var(--mute); font-size: 11.5px; font-weight: 700; }
.gch__row { display: flex; align-items: flex-end; gap: 8px; margin-top: 10px; animation: gch-in .25s ease-out; }
.gch__row.is-cont { margin-top: 3px; }
.gch__row--me { justify-content: flex-end; }
.gch__ava { flex: none; width: 28px; height: 28px; border-radius: 50%; background: #fff; display: grid; place-items: center; box-shadow: 0 0 0 1px rgba(20, 21, 27, .08); }
.gch__ava svg { width: 17px; height: 17px; }
.gch__row.has-next .gch__ava { visibility: hidden; }
.gch__col { display: flex; flex-direction: column; max-width: 80%; min-width: 0; }
.gch__row--me .gch__col { align-items: flex-end; }
.gch__who-l { margin: 0 4px 3px 0; color: var(--mute); font-size: 11.5px; font-weight: 700; }
.gch__m { padding: 10px 14px; border-radius: 20px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14.5px; line-height: 1.45; }
.gch__m a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.gch__row--staff .gch__m { background: #fff; box-shadow: 0 1px 2px rgba(20, 21, 27, .06), 0 0 0 1px rgba(20, 21, 27, .05); }
.gch__row--me .gch__m { background: var(--brand); color: #fff; }
.gch__row--staff.has-next .gch__m { border-bottom-right-radius: 6px; }
.gch__row--staff.is-cont .gch__m { border-top-right-radius: 6px; }
.gch__row--me.has-next .gch__m { border-bottom-left-radius: 6px; }
.gch__row--me.is-cont .gch__m { border-top-left-radius: 6px; }
.gch__t { margin: 3px 6px 0; color: var(--mute); font-size: 11px; }
.gch__row.has-next .gch__t { display: none; }
.gch__seen { color: var(--green-ink); font-weight: 700; }
.gch__sys { align-self: center; max-width: 88%; margin: 12px 0 4px; padding: 8px 12px; border-radius: 12px; background: rgba(0, 182, 122, .1); color: var(--green-ink); font-size: 12.5px; text-align: center; }

/* form */
.gch__f { position: relative; padding: 10px 12px 10px; background: #fff; border-top: 1px solid rgba(20, 21, 27, .07); display: grid; gap: 8px; }
.gch__who { display: grid; gap: 8px; padding: 12px; border-radius: 16px; background: var(--gch-soft); }
.gch__who[hidden] { display: none; }
.gch__who-t { font: 700 13px var(--display); }
.gch__who-t small { display: block; margin-top: 1px; color: var(--mute); font: 400 12px var(--body); }
.gch__who-r { display: grid; grid-template-columns: 1fr 1.25fr; gap: 8px; }
.gch__f input { width: 100%; padding: 10px 12px; border: 1px solid var(--line-2); border-radius: 12px; font: inherit; font-size: 14px; color: inherit; background: #fff; transition: border-color .15s, box-shadow .15s; }
.gch__f input:focus { outline: 0; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.gch__in { display: flex; align-items: flex-end; gap: 6px; padding: 5px 16px 5px 5px; border: 1px solid var(--line-2); border-radius: 24px; background: #fff; transition: border-color .15s, box-shadow .15s; }
.gch__in:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.gch__in textarea { flex: 1; min-width: 0; height: 38px; max-height: 120px; padding: 9px 0; border: 0; outline: 0; resize: none; background: transparent; font: inherit; font-size: 14.5px; line-height: 20px; color: inherit; }
.gch__send { flex: none; width: 38px; height: 38px; border: 0; border-radius: 50%; background: var(--line); color: var(--mute); cursor: pointer; display: grid; place-items: center; transition: background .15s, color .15s, transform .15s; }
.gch__send.is-ready { background: var(--brand); color: #fff; }
.gch__send.is-ready:hover { transform: scale(1.06); }
.gch__send:disabled { opacity: .6; cursor: default; }
.gch__send svg { width: 18px; height: 18px; }
.gch__err { padding: 8px 12px; border-radius: 12px; background: #fdecee; color: #b4232f; font-size: 12.5px; }
.gch__err:empty { display: none; }
.gch__foot { display: flex; align-items: center; justify-content: center; gap: 6px; color: var(--mute); font-size: 11.5px; }
.gch__foot svg { width: 13px; height: 13px; flex: none; }
.gch__hp { position: absolute; right: -9999px; width: 1px; height: 1px; opacity: 0; }
.gch .cfbox { display: flex; justify-content: center; }
.gch .cfbox:empty { display: none; }

@keyframes gch-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes gch-rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes gch-pop { from { transform: scale(.4); } to { transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .gch, .gch-btn, .gch-btn svg, .gch__row, .gch__intro, .gch-peek, .gch-btn__dot { transition: none !important; animation: none !important; }
}

/* ---------- phones: the window takes the whole screen ---------- */
@media (max-width: 560px) {
  .gch, body:has(.pd__bar.show) .gch { inset: 0; width: auto; height: 100vh; height: 100dvh; border-radius: 0; transform-origin: 50% 100%; }
  .gch__hd { padding-top: max(14px, env(safe-area-inset-top)); padding-bottom: 14px; }
  .gch__f { padding-bottom: max(10px, env(safe-area-inset-bottom)); }
  body.gch-on { overflow: hidden; }
  body.gch-on .gch-btn { display: none; }
  /* a bit bigger on phones (owner 2026-12-01: 48 → 54px) */
  .gch-btn { left: 12px; bottom: 12px; width: 54px; height: 54px; }
  .gch-btn svg { width: 26px; height: 26px; }
  body:has(.pd__bar.show) .gch-btn { bottom: 84px; }
  .gch-peek { left: 12px; right: 12px; bottom: 78px; width: auto; }
  body:has(.pd__bar.show) .gch-peek { bottom: 150px; }
  .gch__f input, .gch__in textarea { font-size: 16px; }
  .gch__who-r { grid-template-columns: 1fr; }
}
