/* ============================================================================
   chat-widget.css — floating "live chat" lead form (blocks/chat-widget.js)

   The widget is a second entrance to the SAME lead pipeline: the form inside
   carries `lead-form`, `js-lead-phone`, `form-submit` and `form-status`, so
   lead-form.js submits it to api_local/integration/api.php with the same
   single-geo phone country. Nothing here talks to a chat server.

   All colours come from palette tokens; radii/shadows from the active skin.
   ============================================================================ */

.cw{position:fixed;right:20px;bottom:20px;z-index:9000;
  font-family:var(--font-body),'Work Sans',Arial,sans-serif;color:var(--ink);
  -webkit-tap-highlight-color:transparent}
.cw [hidden]{display:none!important}

/* ------------------------------ launcher -------------------------------- */
.cw-bubble{position:relative;display:grid;place-items:center;width:58px;height:58px;
  padding:0;border:0;border-radius:50%;cursor:pointer;
  background:var(--acc-deep);background-image:var(--grad);color:var(--btn-ink);
  box-shadow:0 12px 30px -12px rgb(0 0 0/.45),0 0 0 4px color-mix(in srgb,var(--acc) 16%,transparent);
  transition:transform .2s ease,box-shadow .2s ease}
.cw-bubble:hover{transform:translateY(-2px)}
.cw-bubble:focus-visible{outline:3px solid var(--acc);outline-offset:3px}
.cw-bubble img{width:100%;height:100%;border-radius:50%;object-fit:cover}
.cw-bubble .cw-glyph{display:grid;place-items:center;width:100%;height:100%;
  font-size:24px;line-height:1}
.cw-bubble .cw-dot{position:absolute;right:1px;bottom:1px;width:14px;height:14px;
  border-radius:50%;background:var(--up);border:2px solid var(--bg)}
.cw.is-nudge .cw-bubble{animation:cw-nudge 1.1s ease 2}
@keyframes cw-nudge{
  0%,100%{transform:translateY(0)}
  35%{transform:translateY(-5px) scale(1.03)}
  65%{transform:translateY(-2px)}
}

/* ------------------------------ panel ----------------------------------- */
.cw-panel{position:absolute;right:0;bottom:74px;display:flex;flex-direction:column;
  width:min(372px,calc(100vw - 32px));height:min(590px,calc(100vh - 118px));
  background:var(--panel);border:1px solid var(--line);border-radius:var(--r-card);
  box-shadow:var(--shadow-card),0 30px 70px -30px rgb(0 0 0/.5);
  overflow:hidden;transform-origin:100% 100%;
  animation:cw-in .18s ease both}
@keyframes cw-in{from{opacity:0;transform:translateY(10px) scale(.98)}to{opacity:1;transform:none}}
@media(prefers-reduced-motion:reduce){.cw-panel{animation:none}}

.cw-head{display:flex;align-items:center;gap:11px;padding:13px 14px;
  background:var(--acc-deep);color:var(--btn-ink)}
.cw-avatar{display:grid;place-items:center;flex:0 0 auto;width:42px;height:42px;
  border-radius:50%;object-fit:cover;background:color-mix(in srgb,#fff 22%,var(--acc-deep));
  color:var(--btn-ink);font-weight:800;font-size:16px;letter-spacing:.02em;
  border:2px solid color-mix(in srgb,#fff 30%,transparent)}
.cw-id{display:grid;gap:1px;min-width:0;line-height:1.25}
.cw-id b{font-size:14.5px;font-weight:700;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.cw-id span{font-size:11.5px;opacity:.72}
.cw-close{margin-left:auto;width:32px;height:32px;flex:0 0 auto;border:0;border-radius:50%;
  background:color-mix(in srgb,#fff 14%,transparent);color:inherit;cursor:pointer;
  font-size:17px;line-height:1;display:grid;place-items:center}
.cw-close:hover{background:color-mix(in srgb,#fff 24%,transparent)}
.cw-close:focus-visible{outline:2px solid var(--btn-ink);outline-offset:2px}

/* ------------------------------ messages -------------------------------- */
.cw-log{flex:1 1 auto;display:flex;flex-direction:column;gap:9px;
  padding:15px 14px;overflow-y:auto;overscroll-behavior:contain;
  background:var(--bg-soft)}
.cw-msg{max-width:86%;padding:9px 12px 7px;border-radius:14px;
  font-size:13.5px;line-height:1.45;word-break:break-word;
  animation:cw-msg .18s ease both}
.cw-msg p{margin:0;color:inherit;font-size:inherit;line-height:inherit}
.cw-msg .cw-time{display:block;margin-top:3px;font-size:10px;opacity:.55;text-align:right}
.cw-in{align-self:flex-start;background:var(--card);color:var(--card-ink);
  border:1px solid var(--line);border-bottom-left-radius:5px}
.cw-out{align-self:flex-end;background:var(--acc-deep);color:var(--btn-ink);
  border-bottom-right-radius:5px}
@keyframes cw-msg{from{opacity:0;transform:translateY(4px)}to{opacity:1;transform:none}}

.cw-typing{align-self:flex-start;display:flex;gap:4px;padding:11px 14px;
  background:var(--card);border:1px solid var(--line);border-radius:14px;
  border-bottom-left-radius:5px}
.cw-typing i{width:6px;height:6px;border-radius:50%;background:var(--muted);
  animation:cw-dot 1s infinite ease-in-out}
.cw-typing i:nth-child(2){animation-delay:.15s}
.cw-typing i:nth-child(3){animation-delay:.3s}
@keyframes cw-dot{0%,60%,100%{opacity:.35;transform:translateY(0)}30%{opacity:1;transform:translateY(-2px)}}
@media(prefers-reduced-motion:reduce){.cw-typing i{animation:none;opacity:.6}}

/* ------------------------------ composer / form ------------------------- */
.cw-foot{flex:0 0 auto;padding:11px 12px 12px;border-top:1px solid var(--line);
  background:var(--panel);overflow-y:auto;overscroll-behavior:contain}
.cw-say{display:flex;align-items:center;gap:8px;margin:0}
.cw-say input{flex:1 1 auto;min-width:0;padding:11px 13px;border:1px solid var(--line);
  border-radius:var(--r-pill);background:var(--bg);color:var(--ink);font-size:13.5px}
.cw-say input:focus{outline:2px solid color-mix(in srgb,var(--acc) 38%,transparent);outline-offset:1px}
.cw-say button{flex:0 0 auto;width:40px;height:40px;border:0;border-radius:50%;
  background:var(--acc-deep);color:var(--btn-ink);font-size:17px;cursor:pointer;
  display:grid;place-items:center}
.cw-say button:disabled{opacity:.45;cursor:default}

.cw-form{display:grid;gap:8px;margin:0}
.cw-form .cw-row{display:grid;grid-template-columns:1fr 1fr;gap:8px}
.cw-form .form-group{gap:4px;min-width:0}
.cw-form .form-group label{font-size:11px;font-weight:600;gap:4px}
.cw-form .form-group input{width:100%;min-width:0;padding:9px 11px;font-size:13px;background:var(--bg);color:var(--ink)}
.cw-form .form-error{font-size:10.5px;min-height:0}
.cw-form .form-error:empty{display:none}
.cw-form .iti{width:100%}
.cw-form .form-submit{margin-top:1px;padding:11px 16px;font-size:13px;border-radius:var(--r-btn)}
.cw-form .form-consent{font-size:9.5px;line-height:1.5;margin-top:2px;
  max-height:52px;overflow:auto}
.cw-form .form-status{font-size:11.5px;margin:0}
.cw-form .form-status:empty{display:none}

/* intl-tel-input inside the panel: keep the country list above the sheet */
.cw .iti__country-list{z-index:9002}
.cw .iti{display:block}

/* ------------------------------ mobile ---------------------------------- */
@media(max-width:520px){
  .cw{right:14px;bottom:14px;left:14px}
  .cw-bubble{margin-left:auto;width:54px;height:54px}
  .cw-panel{position:fixed;right:0;bottom:0;left:0;width:100%;
    height:auto;max-height:88dvh;border-radius:18px 18px 0 0;
    border-bottom:0;padding-bottom:env(safe-area-inset-bottom)}
  .cw-head{padding-top:14px}
  .cw-form .cw-row{grid-template-columns:1fr 1fr}
}
@media print{#cw{display:none!important}}
