/* ============================================================
   Concierge chat widget (demo). Self-contained, theme-driven.
   Injected site-wide by main.js. Swap the demo brain for the
   real GHL chat widget later without touching this CSS.
   ============================================================ */
.la-chat, .la-chat *, .la-chat *::before, .la-chat *::after { box-sizing: border-box; }
.la-chat {
  position: fixed; right: 1.5rem; bottom: 1.5rem; z-index: 60;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
}
/* stack the back-to-top button above the launcher so they never overlap
   (!important beats the sticky-bar sibling rule in custom.css when the chat is present) */
.to-top { bottom: calc(1.5rem + 74px) !important; right: 1.5rem; }
@media (max-width: 1023px) {
  /* clear the sticky Call / Apply bar so the launcher never covers its buttons */
  .la-chat { right: 1rem; bottom: calc(5.2rem + env(safe-area-inset-bottom)); }
  .to-top { bottom: calc(9rem + env(safe-area-inset-bottom) + 60px) !important; }
}

/* ---------- launcher ---------- */
.la-launch {
  position: relative; width: 60px; height: 60px; border-radius: 9999px;
  border: none; cursor: pointer; display: flex; align-items: center; justify-content: center;
  color: #fff; background: linear-gradient(150deg, var(--primary-light), var(--primary) 55%, var(--primary-dark));
  box-shadow: 0 14px 34px -10px rgba(10,33,56,.55), 0 2px 8px rgba(10,33,56,.28);
  transition: transform .28s cubic-bezier(.34,1.56,.64,1), box-shadow .28s ease;
}
.la-launch:hover { transform: translateY(-2px) scale(1.04); box-shadow: 0 20px 42px -10px rgba(10,33,56,.6); }
.la-launch:active { transform: scale(.96); }
.la-launch svg { width: 27px; height: 27px; transition: transform .3s ease, opacity .25s ease; position: absolute; }
.la-launch .ic-close { opacity: 0; transform: rotate(-90deg) scale(.6); }
.la-chat.open .la-launch .ic-chat { opacity: 0; transform: rotate(90deg) scale(.6); }
.la-chat.open .la-launch .ic-close { opacity: 1; transform: rotate(0) scale(1); }
/* pulsing ring to draw the eye before first open */
.la-launch::after {
  content: ''; position: absolute; inset: 0; border-radius: inherit;
  box-shadow: 0 0 0 0 rgba(18,58,99,.45); animation: laPulse 2.6s ease-out infinite;
}
.la-chat.open .la-launch::after, .la-chat.engaged .la-launch::after { animation: none; }
@keyframes laPulse { 0%{box-shadow:0 0 0 0 rgba(18,58,99,.4);} 70%{box-shadow:0 0 0 16px rgba(18,58,99,0);} 100%{box-shadow:0 0 0 0 rgba(18,58,99,0);} }
/* unread dot */
.la-badge {
  position: absolute; top: -3px; right: -3px; min-width: 20px; height: 20px; padding: 0 5px;
  border-radius: 9999px; background: #e5484d; color: #fff; font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; border: 2px solid #fff;
  transform: scale(0); transition: transform .3s cubic-bezier(.34,1.56,.64,1);
}
.la-chat.has-unread .la-badge { transform: scale(1); }

/* greeting teaser bubble */
.la-teaser {
  position: absolute; bottom: 6px; right: 74px; max-width: 232px;
  background: #fff; color: var(--ink); border-radius: 16px 16px 4px 16px;
  padding: 11px 14px; font-size: .84rem; line-height: 1.4; box-shadow: 0 16px 40px -14px rgba(10,33,56,.4);
  border: 1px solid rgba(18,58,99,.08);
  opacity: 0; transform: translateY(8px) scale(.9); transform-origin: bottom right;
  pointer-events: none; transition: opacity .3s ease, transform .3s cubic-bezier(.34,1.56,.64,1);
}
.la-teaser.show { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }
.la-teaser-x {
  position: absolute; top: -7px; left: -7px; width: 20px; height: 20px; border-radius: 9999px;
  background: var(--primary); color: #fff; border: none; cursor: pointer; font-size: 12px; line-height: 1;
  display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 8px rgba(10,33,56,.3);
}
.la-chat.open .la-teaser { display: none; }

/* ---------- panel ---------- */
.la-panel {
  position: absolute; bottom: 74px; right: 0; width: 380px; max-width: calc(100vw - 2rem);
  height: 580px; max-height: calc(100vh - 6rem); display: flex; flex-direction: column;
  background: var(--cream); border-radius: 20px; overflow: hidden;
  box-shadow: 0 30px 70px -20px rgba(10,33,56,.55), 0 8px 24px rgba(10,33,56,.2);
  border: 1px solid rgba(255,255,255,.6);
  opacity: 0; transform: translateY(16px) scale(.96); transform-origin: bottom right;
  pointer-events: none; transition: opacity .3s ease, transform .32s cubic-bezier(.34,1.4,.64,1);
}
.la-chat.open .la-panel { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }

/* header */
.la-head {
  position: relative; flex: none; padding: 16px 16px 15px;
  background: linear-gradient(150deg, var(--primary-light), var(--primary) 60%, var(--primary-dark));
  color: #fff; display: flex; align-items: center; gap: 12px; overflow: hidden;
}
.la-head::before {
  content: ''; position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background: radial-gradient(120px 120px at 85% -20%, var(--glow), transparent 70%);
}
.la-ava { position: relative; flex: none; width: 44px; height: 44px; border-radius: 9999px;
  border: 2px solid rgba(255,255,255,.55); object-fit: cover; background: var(--primary-light); }
.la-ava-wrap { position: relative; flex: none; }
.la-ava-dot { position: absolute; right: 0; bottom: 1px; width: 12px; height: 12px; border-radius: 9999px;
  background: #2ecc71; border: 2px solid var(--primary); }
.la-head-t { position: relative; line-height: 1.2; min-width: 0; }
.la-head-name { font-family: 'Fraunces', Georgia, serif; font-weight: 600; font-size: 1.02rem; }
.la-head-sub { font-size: .74rem; color: rgba(255,255,255,.82); display: flex; align-items: center; gap: 5px; margin-top: 2px; }
.la-head-sub b { width: 6px; height: 6px; border-radius: 9999px; background: #2ecc71; display: inline-block; }
.la-close { margin-left: auto; position: relative; flex: none; width: 32px; height: 32px; border-radius: 9999px;
  border: none; background: rgba(255,255,255,.16); color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: background .2s ease; }
.la-close:hover { background: rgba(255,255,255,.28); }

/* body / messages */
.la-body { flex: 1 1 auto; overflow-y: auto; padding: 16px 14px 8px; display: flex; flex-direction: column; gap: 10px; scroll-behavior: smooth; }
.la-body::-webkit-scrollbar { width: 7px; }
.la-body::-webkit-scrollbar-thumb { background: rgba(18,58,99,.22); border-radius: 9999px; }
.la-row { display: flex; gap: 8px; align-items: flex-end; max-width: 100%; }
.la-row.user { flex-direction: row-reverse; }
.la-mini-ava { flex: none; width: 26px; height: 26px; border-radius: 9999px; object-fit: cover; border: 1px solid rgba(18,58,99,.15); align-self: flex-end; }
.la-bubble {
  max-width: 78%; padding: 10px 13px; font-size: .875rem; line-height: 1.48; border-radius: 15px;
  animation: laIn .32s cubic-bezier(.34,1.4,.64,1) both;
}
.la-row.bot .la-bubble { background: #fff; color: var(--ink); border-bottom-left-radius: 5px; box-shadow: 0 4px 16px -8px rgba(10,33,56,.28); border: 1px solid rgba(18,58,99,.05); }
.la-row.user .la-bubble { background: linear-gradient(150deg, var(--primary-light), var(--primary)); color: #fff; border-bottom-right-radius: 5px; }
.la-bubble strong { font-weight: 600; }
.la-bubble .fine { display: block; margin-top: 7px; font-size: .72rem; color: var(--muted); line-height: 1.4; }
@keyframes laIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* typing */
.la-typing .la-bubble { padding: 13px 15px; }
.la-dots { display: inline-flex; gap: 4px; }
.la-dots i { width: 7px; height: 7px; border-radius: 9999px; background: var(--primary-light); opacity: .5; animation: laBlink 1.2s infinite; }
.la-dots i:nth-child(2){ animation-delay: .2s; } .la-dots i:nth-child(3){ animation-delay: .4s; }
@keyframes laBlink { 0%,60%,100%{ transform: translateY(0); opacity:.4; } 30%{ transform: translateY(-4px); opacity:1; } }

/* quick-reply chips + CTAs */
.la-chips { display: flex; flex-wrap: wrap; gap: 7px; padding: 2px 4px 6px 40px; animation: laIn .32s ease both; }
.la-chips.full { padding-left: 4px; }
.la-chip {
  border: 1px solid var(--primary-light); background: #fff; color: var(--primary);
  border-radius: 9999px; padding: 7px 13px; font-size: .8rem; font-weight: 500; cursor: pointer;
  transition: background .18s ease, color .18s ease, transform .18s ease; line-height: 1.2;
}
.la-chip:hover { background: var(--primary); color: #fff; transform: translateY(-1px); }
.la-cta {
  display: inline-flex; align-items: center; gap: 7px; text-decoration: none;
  border-radius: 10px; padding: 9px 15px; font-size: .84rem; font-weight: 600; cursor: pointer; border: none;
}
.la-cta.primary { background: linear-gradient(150deg, var(--primary-light), var(--primary)); color: #fff; box-shadow: 0 8px 20px -8px rgba(10,33,56,.5); }
.la-cta.ghost { background: #fff; color: var(--primary); border: 1px solid var(--primary-light); }
.la-cta svg { width: 15px; height: 15px; }

/* inline lead form */
.la-lead { display: flex; flex-direction: column; gap: 8px; background: #fff; border: 1px solid rgba(18,58,99,.1);
  border-radius: 14px; padding: 13px; margin-left: 40px; box-shadow: 0 4px 16px -8px rgba(10,33,56,.25); animation: laIn .32s ease both; }
.la-lead input { width: 100%; border: 1px solid rgba(18,58,99,.2); border-radius: 9px; padding: 9px 11px; font-size: .85rem; color: var(--ink); font-family: inherit; }
.la-lead input:focus { outline: 2px solid var(--primary-light); outline-offset: 1px; border-color: transparent; }
.la-lead button { margin-top: 1px; }

/* footer input */
.la-foot { flex: none; display: flex; align-items: center; gap: 8px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: #fff; border-top: 1px solid rgba(18,58,99,.08); }
.la-input { flex: 1; border: 1px solid rgba(18,58,99,.16); border-radius: 9999px; padding: 10px 15px; font-size: .875rem;
  color: var(--ink); font-family: inherit; background: var(--cream); }
.la-input:focus { outline: none; border-color: var(--primary-light); box-shadow: 0 0 0 3px var(--ring); }
.la-send { flex: none; width: 40px; height: 40px; border-radius: 9999px; border: none; cursor: pointer; color: #fff;
  background: linear-gradient(150deg, var(--primary-light), var(--primary)); display: flex; align-items: center; justify-content: center;
  transition: transform .2s ease, opacity .2s ease; }
.la-send:hover { transform: scale(1.06); } .la-send:disabled { opacity: .4; cursor: default; transform: none; }
.la-send svg { width: 18px; height: 18px; }
.la-disc { flex: none; text-align: center; font-size: .64rem; color: var(--muted); padding: 0 12px 7px; background: #fff; line-height: 1.3; }

@media (max-width: 480px) {
  /* panel is anchored 74px above the raised launcher; keep its top on-screen */
  .la-panel { width: calc(100vw - 1.5rem); height: calc(100vh - 172px); height: calc(100dvh - 172px); }
  .la-teaser { max-width: 190px; }
}
@media (prefers-reduced-motion: reduce) {
  .la-launch::after { animation: none; }
  .la-bubble, .la-chips, .la-lead { animation: none; }
  .la-dots i { animation: none; opacity: .6; }
  .la-panel, .la-launch, .la-teaser { transition: opacity .2s ease; }
}
