/* ==========================================================================
   live-chat.css — live chat bubble + window (includes/live-chat.php)
   ========================================================================== */
.lc {
  --lc-c1: #2f5bff;
  --lc-c2: #8b5cf6;
  --lc-bottom: 24px;
  position: fixed;
  right: 22px;
  bottom: var(--lc-bottom);
  z-index: 960;
  font-family: var(--font-body);
  transition: bottom 0.4s ease;
}
body:has(.sticky-cta-bar.show) .lc { --lc-bottom: 88px; }
.lc.is-open { z-index: 1150; } /* above the navbar (1000), below popups (1200) */
/* back-to-top button sits above the chat bubble */
body:has(.lc) .fab { bottom: 98px; right: 30px; width: 46px; height: 46px; font-size: 1rem; }
body:has(.sticky-cta-bar.show):has(.lc) .fab { bottom: 162px; }
body:has(.lc.is-open) .sr { transform: translate(110%, -50%); }
.nx-menu-open .lc,
body:has(.ixm:not([hidden])) .lc,
body:has(.wn:not([hidden])) .lc { display: none; }

/* ---- bubble ---- */
.lc-launcher {
  position: relative;
  width: 62px;
  height: 62px;
  border: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--lc-c1), var(--lc-c2));
  color: #fff;
  font-size: 1.5rem;
  cursor: pointer;
  box-shadow: 0 18px 36px -14px var(--lc-c1), 0 0 0 0 rgba(47, 91, 255, 0.45);
  animation: lc-in 0.6s 0.8s var(--ease-out-quart) backwards, lc-ring 3.2s 2s ease-out infinite;
  transition: transform 0.3s ease;
}
.lc-launcher:hover { transform: scale(1.07) rotate(-4deg); }
.lc.is-open .lc-launcher { animation: none; transform: none; }
@keyframes lc-in { from { opacity: 0; transform: scale(0.4) translateY(30px); } }
@keyframes lc-ring {
  0% { box-shadow: 0 18px 36px -14px var(--lc-c1), 0 0 0 0 rgba(47, 91, 255, 0.45); }
  40%, 100% { box-shadow: 0 18px 36px -14px var(--lc-c1), 0 0 0 16px rgba(47, 91, 255, 0); }
}
.lc-launcher-ic { position: absolute; inset: 0; display: grid; place-items: center; transition: transform 0.35s var(--ease-out-quart), opacity 0.25s ease; }
.lc-ic-close { opacity: 0; transform: rotate(-90deg) scale(0.6); }
.lc.is-open .lc-ic-chat { opacity: 0; transform: rotate(90deg) scale(0.6); }
.lc.is-open .lc-ic-close { opacity: 1; transform: none; }
.lc-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  display: grid;
  place-items: center;
  border-radius: 99px;
  background: var(--color-danger);
  border: 2px solid var(--bg-body);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 800;
  animation: lc-pop 0.4s ease;
}
.lc-badge[hidden] { display: none; }
@keyframes lc-pop { 50% { transform: scale(1.35); } }
.lc-launcher-dot {
  position: absolute;
  bottom: 3px;
  right: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--gray-400);
  border: 2px solid #fff;
}
.lc.is-online .lc-launcher-dot { background: #10b981; }

/* ---- greeting ---- */
.lc-hello {
  position: absolute;
  right: 4px;
  bottom: 76px;
  width: 240px;
  padding: 0.85rem 1rem;
  border-radius: 16px 16px 4px 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  box-shadow: var(--card-shadow-hover);
  font-size: 0.85rem;
  color: var(--text-secondary);
  animation: lc-hello 0.45s var(--ease-out-quart);
}
.lc-hello[hidden] { display: none; }
.lc-hello strong { display: block; color: var(--text-primary); margin-bottom: 0.15rem; }
.lc-hello-x {
  position: absolute;
  top: -9px;
  left: -9px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-muted);
  font-size: 0.7rem;
  cursor: pointer;
}
@keyframes lc-hello { from { opacity: 0; transform: translateY(10px) scale(0.95); } }
.lc.is-open .lc-hello { display: none; }

/* ---- window ---- */
.lc-panel {
  position: absolute;
  right: 0;
  bottom: 78px;
  width: 370px;
  height: min(660px, calc(100vh - 40px));
  height: min(660px, calc(100dvh - 40px));
  display: flex;
  flex-direction: column;
  border-radius: 22px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  box-shadow: 0 40px 90px -30px rgba(6, 7, 15, 0.55);
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(18px) scale(0.96);
  transform-origin: bottom right;
  transition: opacity 0.25s ease, transform 0.35s var(--ease-out-quart), visibility 0s 0.35s;
}
/* While open, the window takes the bubble's place (its ✕ closes it), which
   leaves room for the whole start form without scrolling */
.lc.is-open .lc-launcher { display: none; }
.lc.is-open .lc-panel { bottom: 0; }
.lc.is-open .lc-panel { opacity: 1; visibility: visible; transform: none; transition: opacity 0.25s ease, transform 0.35s var(--ease-out-quart), visibility 0s; }

.lc-head {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1rem 1rem 1.1rem;
  background: linear-gradient(135deg, var(--lc-c1), var(--lc-c2));
  color: #fff;
  overflow: hidden;
}
.lc-head::after {
  content: "";
  position: absolute;
  width: 180px;
  height: 180px;
  right: -60px;
  top: -90px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
}
.lc-head-av { position: relative; flex: none; width: 44px; height: 44px; border-radius: 50%; background: #fff; display: grid; place-items: center; }
.lc-head-av img { width: 32px; height: 32px; object-fit: contain; }
.lc-head-dot { position: absolute; right: 0; bottom: 0; width: 12px; height: 12px; border-radius: 50%; background: var(--gray-400); border: 2px solid #fff; }
.lc.is-online .lc-head-dot { background: #22c55e; }
.lc-head-txt { position: relative; z-index: 1; display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.lc-head-txt strong { font-size: 1rem; }
.lc-head-txt small { font-size: 0.76rem; opacity: 0.9; }
.lc-head-btn {
  position: relative;
  z-index: 1;
  margin-left: auto;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 0;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  cursor: pointer;
  transition: background 0.25s ease;
}
.lc-head-btn:hover { background: rgba(255, 255, 255, 0.3); }
.lc-end-btn {
  position: relative;
  z-index: 1;
  margin-left: auto;
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.7rem;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 0.74rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s ease;
}
.lc-end-btn[hidden] { display: none; }
.lc-end-btn:hover { background: rgba(239, 68, 68, 0.85); border-color: transparent; }
.lc-end-btn:not([hidden]) + .lc-head-btn { margin-left: 0.4rem; }
.lc-confirm {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  padding: 0.65rem 0.9rem;
  background: color-mix(in srgb, var(--color-danger) 10%, var(--bg-surface));
  border-bottom: 1px solid color-mix(in srgb, var(--color-danger) 30%, transparent);
  font-size: 0.8rem;
  color: var(--text-primary);
  animation: lc-msg 0.25s ease;
}
.lc-confirm[hidden] { display: none; }
.lc-confirm span { flex: 1 1 100%; }
.lc-confirm button { border: 0; border-radius: 99px; padding: 0.35rem 0.85rem; font-size: 0.76rem; font-weight: 700; cursor: pointer; }
.lc-confirm-yes { background: var(--color-danger); color: #fff; }
.lc-confirm-no { background: var(--bg-surface-alt); color: var(--text-primary); border: 1px solid var(--border-color) !important; }

/* start screen */
.lc-start {
  flex: 1;
  overflow-y: auto;
  padding: 0.9rem 1rem;
  background: var(--bg-surface-alt);
  scrollbar-width: none; /* still scrolls on very short screens, but no bar */
}
.lc-start::-webkit-scrollbar { display: none; }
.lc-start[hidden] { display: none; }
.lc-welcome { text-align: center; margin-bottom: 0.7rem; }
.lc-wave { display: inline-block; font-size: 1.25rem; animation: lc-wave 2.4s ease-in-out infinite; transform-origin: 70% 70%; }
@keyframes lc-wave { 0%, 60%, 100% { transform: none; } 10%, 30% { transform: rotate(16deg); } 20%, 40% { transform: rotate(-8deg); } }
.lc-welcome h3 { margin: 0.25rem 0; font-family: var(--font-heading); font-size: 1.15rem; font-weight: 700; color: var(--text-primary); }
.lc-welcome p { margin: 0; font-size: 0.84rem; color: var(--text-secondary); }
.lc-quick { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.4rem; margin-bottom: 0.75rem; }
.lc-quick button {
  padding: 0.4rem 0.75rem;
  border-radius: 99px;
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.2s ease, transform 0.2s ease;
}
.lc-quick button:hover,
.lc-quick button.is-on { border-color: var(--lc-c1); color: var(--lc-c1); transform: translateY(-1px); }
.lc-start-form { display: flex; flex-direction: column; gap: 0.5rem; }
.lc-in { position: relative; }
.lc-in > i { position: absolute; left: 0.85rem; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: 0.8rem; }
.lc-in input,
.lc-in textarea {
  width: 100%;
  padding: 0.7rem 0.85rem 0.7rem 2.3rem;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: 0.88rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.lc-in-area textarea { padding-left: 0.85rem; resize: none; }
.lc-in input:focus,
.lc-in textarea:focus { outline: none; border-color: var(--lc-c1); box-shadow: 0 0 0 3px rgba(47, 91, 255, 0.14); }
.lc-in.is-bad input,
.lc-in.is-bad textarea { border-color: var(--color-danger); }
.lc-hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; overflow: hidden; }
.lc-err { margin: 0; font-size: 0.8rem; color: var(--color-danger); }
.lc-err[hidden] { display: none; }
.lc-start-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.8rem;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--lc-c1), var(--lc-c2));
  color: #fff;
  font-weight: 700;
  font-size: 0.92rem;
  cursor: pointer;
  box-shadow: 0 12px 24px -12px var(--lc-c1);
  transition: transform 0.2s ease;
}
.lc-start-btn:hover { transform: translateY(-1px); }
.lc-start-btn:disabled { opacity: 0.7; cursor: wait; }

/* conversation */
.lc-chat { flex: 1; display: flex; flex-direction: column; min-height: 0; background: var(--bg-surface-alt); }
.lc-chat[hidden] { display: none; }
.lc-msgs {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 1rem 0.9rem 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.lc-day { align-self: center; margin: 0.5rem 0; padding: 0.15rem 0.65rem; border-radius: 99px; background: var(--bg-surface); border: 1px solid var(--border-color); font-size: 0.68rem; color: var(--text-muted); }
.lc-m { display: flex; flex-direction: column; max-width: 82%; animation: lc-msg 0.3s var(--ease-out-quart); }
@keyframes lc-msg { from { opacity: 0; transform: translateY(8px); } }
.lc-m.me { align-self: flex-end; align-items: flex-end; }
.lc-m.them { align-self: flex-start; }
.lc-m.sys { align-self: center; max-width: 92%; }
.lc-who { font-size: 0.68rem; font-weight: 700; color: var(--text-muted); margin: 0.35rem 0 0.15rem 0.4rem; }
.lc-b {
  padding: 0.55rem 0.8rem;
  border-radius: 16px;
  font-size: 0.87rem;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.lc-m.me .lc-b { background: linear-gradient(135deg, var(--lc-c1), #5b5bf6); color: #fff; border-bottom-right-radius: 5px; }
.lc-m.them .lc-b { background: var(--bg-surface); color: var(--text-primary); border: 1px solid var(--border-color); border-bottom-left-radius: 5px; }
.lc-m.sys .lc-b { background: transparent; color: var(--text-muted); font-size: 0.76rem; text-align: center; padding: 0.3rem; }
.lc-b a { color: inherit; text-decoration: underline; }
.lc-t { font-size: 0.64rem; color: var(--text-muted); margin: 0.15rem 0.4rem 0; }
.lc-m.is-sending .lc-b { opacity: 0.6; }
.lc-m.is-failed .lc-b { opacity: 1; background: color-mix(in srgb, var(--color-danger) 85%, #000); }
.lc-retry { border: 0; background: none; color: var(--color-danger); font-size: 0.7rem; font-weight: 700; cursor: pointer; padding: 0.1rem 0.4rem; }
.lc-typing { display: flex; align-items: center; gap: 0.4rem; padding: 0 1rem 0.4rem; font-size: 0.74rem; color: var(--text-muted); }
.lc-typing[hidden] { display: none; }
.lc-typing span { display: inline-flex; gap: 3px; padding: 0.4rem 0.55rem; border-radius: 12px; background: var(--bg-surface); border: 1px solid var(--border-color); }
.lc-typing i { width: 5px; height: 5px; border-radius: 50%; background: var(--text-muted); animation: lc-dot 1.2s ease-in-out infinite; }
.lc-typing i:nth-child(2) { animation-delay: 0.15s; }
.lc-typing i:nth-child(3) { animation-delay: 0.3s; }
@keyframes lc-dot { 0%, 60%, 100% { transform: none; opacity: 0.5; } 30% { transform: translateY(-3px); opacity: 1; } }
.lc-compose {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  padding: 0.65rem 0.7rem;
  border-top: 1px solid var(--border-color);
  background: var(--bg-surface);
}
.lc-compose textarea {
  flex: 1;
  max-height: 110px;
  padding: 0.6rem 0.85rem;
  border-radius: 18px;
  border: 1px solid var(--border-color);
  background: var(--bg-surface-alt);
  color: var(--text-primary);
  font-size: 0.88rem;
  line-height: 1.4;
  resize: none;
}
.lc-compose textarea:focus { outline: none; border-color: var(--lc-c1); }
.lc-send {
  flex: none;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--lc-c1), var(--lc-c2));
  color: #fff;
  cursor: pointer;
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.lc-send:hover { transform: scale(1.08) rotate(-8deg); }
.lc-send:disabled { opacity: 0.5; transform: none; cursor: default; }
.lc-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 1rem;
  border-top: 1px solid var(--border-color);
  background: var(--bg-surface);
  font-size: 0.72rem;
  color: var(--text-muted);
}
.lc-foot a { color: #16a34a; font-weight: 700; text-decoration: none; }
.lc-foot a:hover { text-decoration: underline; }

/* phones: the window fills the screen */
@media (max-width: 575.98px) {
  .lc { right: 14px; --lc-bottom: 16px; }
  body:has(.sticky-cta-bar.show) .lc { --lc-bottom: 128px; }
  .lc-launcher { width: 56px; height: 56px; font-size: 1.3rem; }
  body:has(.lc) .fab { bottom: 84px; right: 19px; width: 42px; height: 42px; }
  body:has(.sticky-cta-bar.show):has(.lc) .fab { bottom: 196px; }
  .lc.is-open { inset: 0; right: 0; bottom: 0; }
  .lc.is-open .lc-launcher { display: none; }
  .lc-panel { position: fixed; inset: 0; width: auto; height: auto; bottom: 0; border-radius: 0; border: 0; }
  .lc-hello { width: 210px; }
  .lc-in input, .lc-in textarea, .lc-compose textarea { font-size: 16px; } /* stops iOS zooming in */
}
html.lc-lock, html.lc-lock body { overflow: hidden; }

@media (prefers-reduced-motion: reduce) {
  .lc-launcher, .lc-wave, .lc-typing i, .lc-m, .lc-hello { animation: none !important; }
  .lc-panel { transition: none; }
}
