/* ============================================================
   VIRALIS — chat widget (bubble + panel)
   The bubble reuses .fab-chat (base css / per-page offsets).
   Panel opens above it; on phones it becomes a bottom sheet.
   ============================================================ */
.fab-chat{ cursor:pointer; }
.fab-chat svg{ width:23px; height:23px; }
.fab-chat__badge{
  position:absolute; top:-3px; inset-inline-end:-3px; min-width:20px; height:20px; padding:0 5px; border-radius:999px;
  display:grid; place-items:center; background:var(--black); color:var(--gold); font-size:.68rem; font-weight:700; line-height:1;
  border:2px solid var(--ivory);
}

.chat__panel{
  position:fixed; z-index:70; inset-inline-end:1.6rem; bottom:5.6rem;
  width:min(380px, calc(100vw - 2rem)); height:min(570px, calc(100svh - 7.5rem));
  display:flex; flex-direction:column; overflow:hidden;
  background:var(--ivory); color:var(--black); border-radius:10px;
  border:1px solid rgba(200,167,114,.4); box-shadow:0 24px 70px rgba(0,0,0,.35);
  transform-origin:bottom right; animation:chatIn .32s var(--ease);
}
html[dir="rtl"] .chat__panel{ transform-origin:bottom left; }
@keyframes chatIn{ from{ opacity:0; transform:translateY(14px) scale(.96); } to{ opacity:1; transform:none; } }

/* ---- header ---- */
.chat__head{ display:flex; align-items:center; gap:.8rem; padding:.95rem 1rem .95rem 1.1rem; background:var(--black); color:var(--ivory); }
.chat__avatar{ width:38px; height:38px; border-radius:50%; flex-shrink:0; display:grid; place-items:center; background:var(--gold); color:var(--black); font-family:var(--font-display); font-weight:600; font-size:1.05rem; }
.chat__who{ flex:1; min-width:0; display:flex; flex-direction:column; line-height:1.25; }
.chat__who strong{ font-weight:500; font-size:.95rem; color:var(--gold); }
.chat__who span{ display:flex; align-items:center; gap:.4rem; font-size:.76rem; color:var(--stone); opacity:.85; }
.chat__dot{ width:7px; height:7px; border-radius:50%; background:#5FA08F; box-shadow:0 0 0 3px rgba(95,160,143,.25); }
.chat__actions{ display:flex; gap:.35rem; }
.chat__icon-btn{ width:32px; height:32px; border-radius:50%; display:grid; place-items:center; color:var(--ivory); transition:background .2s, color .2s; }
.chat__icon-btn:hover{ background:rgba(232,228,220,.16); color:var(--gold); }
.chat__icon-btn svg{ width:16px; height:16px; }

/* ---- conversation ---- */
.chat__log{ flex:1; overflow-y:auto; padding:1.1rem 1rem .6rem; display:flex; flex-direction:column; gap:.65rem; scroll-behavior:smooth; }
.chat__msg{ max-width:86%; }
.chat__msg p{ padding:.7rem .95rem; border-radius:14px; font-size:.92rem; line-height:1.45; white-space:pre-line; }
.chat__msg--bot{ align-self:flex-start; }
.chat__msg--bot p{ background:#fff; border:1px solid var(--line-on-light); border-end-start-radius:4px; }
.chat__msg--me{ align-self:flex-end; }
.chat__msg--me p{ background:var(--gold); color:var(--black); border-end-end-radius:4px; }
.chat__links{ display:flex; flex-wrap:wrap; gap:.4rem; margin-top:.45rem; }
.chat__links a{ font-size:.8rem; border:1px solid var(--black); border-radius:999px; padding:.3rem .8rem; background:transparent; transition:background .2s, color .2s; }
.chat__links a:hover{ background:var(--black); color:var(--gold); }
.chat__typing{ align-self:flex-start; display:flex; gap:4px; padding:.85rem 1rem; background:#fff; border:1px solid var(--line-on-light); border-radius:14px; border-end-start-radius:4px; }
.chat__typing span{ width:6px; height:6px; border-radius:50%; background:var(--gray); animation:chatDot 1.1s infinite ease-in-out; }
.chat__typing span:nth-child(2){ animation-delay:.15s; } .chat__typing span:nth-child(3){ animation-delay:.3s; }
@keyframes chatDot{ 0%,60%,100%{ opacity:.3; transform:none; } 30%{ opacity:1; transform:translateY(-3px); } }
.chat__chips{ display:flex; flex-wrap:wrap; gap:.45rem; margin-top:.2rem; }
.chat__chips button{ font-size:.82rem; border:1px solid var(--gold-deep); color:var(--gold-deep); border-radius:999px; padding:.4rem .9rem; background:transparent; transition:background .2s, color .2s; }
.chat__chips button:hover{ background:var(--gold-deep); color:var(--ivory); }

/* ---- input ---- */
.chat__form{ display:flex; gap:.5rem; padding:.7rem .8rem; border-top:1px solid var(--line-on-light); background:#fff; }
.chat__form input{ flex:1; min-width:0; border:1px solid var(--line-on-light); border-radius:999px; padding:.65rem 1rem; font:inherit; font-size:.92rem; background:var(--ivory); cursor:text; }
.chat__form input:focus{ outline:none; border-color:var(--gold-deep); }
.chat__send{ width:42px; height:42px; border-radius:50%; flex-shrink:0; display:grid; place-items:center; background:var(--black); color:var(--gold); transition:background .2s, color .2s, opacity .2s; }
.chat__send:hover:not([disabled]){ background:var(--gold); color:var(--black); }
.chat__send[disabled]{ opacity:.35; cursor:not-allowed; }
.chat__send svg{ width:17px; height:17px; }
html[dir="rtl"] .chat__send svg{ transform:scaleX(-1); }
.chat__note{ font-size:.72rem; color:var(--gray); text-align:center; padding:.1rem .8rem .7rem; background:#fff; }

/* ---- phones: bottom sheet ---- */
@media (max-width:640px){
  .chat__panel{ inset-inline:0; bottom:0; width:auto; height:min(82svh,620px); border-radius:14px 14px 0 0; border-bottom:0; transform-origin:bottom center; }
  .fab-chat.is-open{ display:none; }
  .chat__form input{ font-size:16px; }   /* stops iOS zoom-on-focus */
}

/* ---- live chat: sign-in gate, agent name, time / "Seen", system notes, end-chat confirm ---- */
.chat__body{ display:flex; flex-direction:column; flex:1; min-height:0; }
.chat__gate{ justify-content:flex-start; }
.chat__gate-actions{ display:flex; gap:.6rem; flex-wrap:wrap; margin-top:.4rem; }
.chat__gate-btn{ display:inline-flex; align-items:center; justify-content:center; min-height:40px; padding-inline:1.2rem; border-radius:2px; background:var(--black); color:var(--ivory); font-size:.86rem; }
.chat__gate-btn:hover{ background:var(--gold); color:var(--black); }
.chat__gate-btn--ghost{ background:transparent; color:var(--black); border:1px solid var(--line-on-light); }
.chat__gate-btn--ghost:hover{ background:transparent; border-color:var(--black); color:var(--black); }
.chat__from{ font-size:.72rem; color:var(--gold-deep); font-weight:600; margin-bottom:.2rem; display:block; }
.chat__meta{ display:block; font-size:.68rem; color:var(--gray); margin-top:.25rem; }
.chat__msg--me .chat__meta{ text-align:end; }
.chat__msg--system{ align-self:center; max-width:90%; }
.chat__msg--system p{ background:transparent; border:0; color:var(--gray); font-size:.78rem; text-align:center; padding:.2rem .4rem; }
.chat__error{ font-size:.78rem; color:var(--err); text-align:center; }
.chat__confirm{ padding:.8rem 1rem; border-top:1px solid var(--line-on-light); background:var(--stone); font-size:.84rem; }
.chat__confirm div{ display:flex; gap:.5rem; margin-top:.6rem; }
