/* =====================================================================
   Insight Residential Realty — "Concierge" lead chatbot
   A self-contained, on-brand chat widget. Reuses the site's design
   tokens (crimson / ink / glass) from styles.css. All classes are
   namespaced `irr-` to avoid collisions.
   ===================================================================== */

/* ---------- root & shared ---------- */
.irr-chat {
  --c-w: 384px;          /* panel width  */
  --c-fab: 64px;         /* launcher size */
  --c-crimson: var(--gold, #3b82f6);
  --c-crimson-lt: var(--gold-lt, #93c5fd);
  --c-crimson-dk: var(--gold-dk, #1d4ed8);
  --c-ink: var(--ink, #070a12);
  --c-glass: rgba(14, 19, 30, .78);
  --c-glass-hi: rgba(20, 27, 41, .86);
  --c-line: rgba(255, 255, 255, .1);
  --c-text: var(--text, #c6cdd8);
  --c-text-hi: var(--text-hi, #f6f2ea);
  --c-text-mut: var(--text-mut, #8b95a4);
  --c-ease: var(--ease, cubic-bezier(.22, .61, .36, 1));
  --c-ease-out: var(--ease-out, cubic-bezier(.16, 1, .3, 1));
  position: fixed;
  right: clamp(16px, 2.4vw, 26px);
  bottom: clamp(16px, 2.4vw, 26px);
  z-index: 9996;
  font-family: var(--font-sans, "Inter", system-ui, sans-serif);
}
.irr-chat *, .irr-chat *::before, .irr-chat *::after { box-sizing: border-box; }
.irr-chat button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }

/* the back-to-top button shares this corner — lift it above the FAB */
.to-top { bottom: calc(var(--c-fab, 64px) + 40px) !important; }
@media (max-width: 560px) { .to-top { bottom: calc(64px + 30px) !important; } }

/* hide launcher while the mobile nav overlay is open.
   NB: `visibility` (not just opacity) is required — the FAB's entrance
   animation uses `both` fill-mode, which would otherwise keep opacity:1. */
html.nav-open .irr-fab,
html.nav-open .irr-teaser { opacity: 0; visibility: hidden; pointer-events: none; }

/* ---------- launcher (FAB) ---------- */
.irr-fab {
  position: relative;
  width: var(--c-fab); height: var(--c-fab);
  border-radius: 50%;
  display: grid; place-items: center;
  color: #fff;
  background: linear-gradient(135deg, var(--c-crimson-lt) 0%, var(--c-crimson) 46%, var(--c-crimson-dk) 100%);
  box-shadow: 0 10px 30px rgba(59, 130, 246, .42), 0 2px 8px rgba(2, 4, 10, .4), inset 0 1px 0 rgba(255, 255, 255, .4);
  transition: transform .4s var(--c-ease-out), box-shadow .4s var(--c-ease);
  animation: irr-fab-in .6s var(--c-ease-out) both;
  -webkit-tap-highlight-color: transparent;
}
.irr-fab:hover { transform: translateY(-3px) scale(1.05); box-shadow: 0 16px 42px rgba(59, 130, 246, .55), inset 0 1px 0 rgba(255, 255, 255, .45); }
.irr-fab:active { transform: translateY(-1px) scale(.98); }
.irr-fab svg { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; transition: opacity .3s var(--c-ease), transform .35s var(--c-ease); }
.irr-fab .irr-fab-close { position: absolute; opacity: 0; transform: rotate(-90deg) scale(.6); }
.irr-chat.is-open .irr-fab .irr-fab-chat { opacity: 0; transform: rotate(90deg) scale(.6); }
.irr-chat.is-open .irr-fab .irr-fab-close { opacity: 1; transform: rotate(0) scale(1); }

/* pulsing ring to draw the eye (stops once opened or dismissed) */
.irr-fab::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  border: 2px solid var(--c-crimson-lt);
  animation: irr-pulse 2.6s var(--c-ease-out) infinite;
}
.irr-chat.is-open .irr-fab::after,
.irr-chat.is-engaged .irr-fab::after { display: none; }

/* unread badge */
.irr-fab-badge {
  position: absolute; top: -3px; right: -3px;
  min-width: 20px; height: 20px; padding: 0 5px;
  border-radius: 999px; background: #fff; color: var(--c-crimson-dk);
  font-size: 11px; font-weight: 800; line-height: 20px; text-align: center;
  box-shadow: 0 2px 8px rgba(2, 4, 10, .5);
  transform: scale(0); transition: transform .35s var(--c-ease-out);
}
.irr-chat.has-unread .irr-fab-badge { transform: scale(1); }
.irr-chat.is-open .irr-fab-badge { transform: scale(0); }

@keyframes irr-fab-in { from { opacity: 0; transform: scale(.4) translateY(20px); } to { opacity: 1; transform: none; } }
@keyframes irr-pulse { 0% { opacity: .7; transform: scale(1); } 70%, 100% { opacity: 0; transform: scale(1.5); } }

/* ---------- proactive teaser bubble ---------- */
.irr-teaser {
  position: absolute; right: 0; bottom: calc(var(--c-fab) + 16px);
  width: 288px; max-width: calc(100vw - 40px);
  display: flex; gap: 11px; align-items: flex-start;
  padding: 14px 16px 15px;
  background: var(--c-glass-hi);
  border: 1px solid var(--c-line);
  border-radius: 18px 18px 6px 18px;
  -webkit-backdrop-filter: blur(20px) saturate(1.3); backdrop-filter: blur(20px) saturate(1.3);
  box-shadow: 0 20px 50px rgba(2, 4, 10, .5), inset 0 1px 0 rgba(255, 255, 255, .06);
  color: var(--c-text-hi);
  cursor: pointer;
  transform-origin: bottom right;
  animation: irr-teaser-in .5s var(--c-ease-out) both;
}
.irr-teaser[hidden] { display: none; }
.irr-teaser-avatar { flex: 0 0 34px; width: 34px; height: 34px; border-radius: 50%; overflow: hidden; border: 1px solid var(--c-line); background: var(--c-ink); }
.irr-teaser-avatar img { width: 100%; height: 100%; object-fit: cover; }
.irr-teaser-body { font-size: 13.5px; line-height: 1.45; }
.irr-teaser-body strong { color: var(--c-crimson-lt); font-weight: 700; }
.irr-teaser-close {
  position: absolute; top: -9px; right: -9px; width: 24px; height: 24px; border-radius: 50%;
  display: grid; place-items: center; background: var(--c-ink); border: 1px solid var(--c-line);
  color: var(--c-text-mut); font-size: 15px; line-height: 1;
  box-shadow: 0 3px 10px rgba(2, 4, 10, .5);
}
.irr-teaser-close:hover { color: var(--c-text-hi); border-color: var(--c-crimson); }
@keyframes irr-teaser-in { from { opacity: 0; transform: scale(.7) translateY(12px); } to { opacity: 1; transform: none; } }

/* ---------- panel ---------- */
.irr-panel {
  position: absolute; right: 0; bottom: calc(var(--c-fab) + 16px);
  width: var(--c-w); max-width: calc(100vw - 32px);
  height: min(624px, calc(100vh - 120px));
  display: flex; flex-direction: column;
  background: var(--c-glass);
  border: 1px solid var(--c-line);
  border-radius: 22px;
  -webkit-backdrop-filter: blur(26px) saturate(1.35); backdrop-filter: blur(26px) saturate(1.35);
  box-shadow: 0 30px 80px rgba(2, 4, 10, .62), 0 0 0 1px rgba(59, 130, 246, .16), inset 0 1px 0 rgba(255, 255, 255, .07);
  overflow: hidden;
  transform-origin: bottom right;
  opacity: 0; visibility: hidden;
  transform: translateY(14px) scale(.94);
  transition: opacity .34s var(--c-ease-out), transform .38s var(--c-ease-out), visibility .34s;
}
.irr-chat.is-open .irr-panel { opacity: 1; visibility: visible; transform: none; }
.irr-panel[hidden] { display: none; }

/* header */
.irr-head {
  position: relative; flex: 0 0 auto;
  display: flex; align-items: center; gap: 12px;
  padding: 15px 15px 14px;
  background: linear-gradient(135deg, rgba(59, 130, 246, .28), rgba(29, 78, 216, .16) 60%, rgba(20, 27, 41, .2));
  border-bottom: 1px solid var(--c-line);
}
.irr-head::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(120% 140% at 88% -20%, rgba(147, 197, 253, .22), transparent 55%);
}
.irr-head-avatar {
  position: relative; flex: 0 0 44px; width: 44px; height: 44px; border-radius: 50%;
  overflow: hidden; border: 1.5px solid rgba(147, 197, 253, .55); background: var(--c-ink);
  box-shadow: 0 4px 14px rgba(2, 4, 10, .4);
}
.irr-head-avatar img { width: 100%; height: 100%; object-fit: cover; }
.irr-head-avatar::after {
  content: ""; position: absolute; right: 1px; bottom: 1px; width: 11px; height: 11px;
  border-radius: 50%; background: #4ec27a; border: 2px solid #12131a;
  box-shadow: 0 0 8px rgba(78, 194, 122, .9);
}
.irr-head-meta { flex: 1 1 auto; min-width: 0; position: relative; }
.irr-head-name { font-family: var(--font-serif, Georgia, serif); font-size: 17px; font-weight: 600; color: #fff; letter-spacing: -.01em; line-height: 1.15; }
.irr-head-sub { font-size: 11.5px; color: rgba(255, 255, 255, .72); display: flex; align-items: center; gap: 6px; margin-top: 1px; }
.irr-head-sub .irr-dot { width: 6px; height: 6px; border-radius: 50%; background: #4ec27a; box-shadow: 0 0 6px rgba(78, 194, 122, .9); }
.irr-head-actions { display: flex; gap: 4px; position: relative; }
.irr-head-btn { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; color: rgba(255, 255, 255, .8); transition: background .25s, color .25s; }
.irr-head-btn:hover { background: rgba(255, 255, 255, .12); color: #fff; }
.irr-head-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* trust ribbon */
/* The three trust items measured 386px in English against a 384px panel —
   just fitting — and 429px in Spanish, so the last one was sliced off inside
   the panel's overflow:hidden. Spanish runs roughly 15-20% longer than
   English as a rule, so the row now wraps and the gap tightens rather than
   relying on the English length holding. */
.irr-trust {
  flex: 0 0 auto; display: flex; align-items: center; justify-content: center;
  flex-wrap: wrap; gap: 4px 12px; row-gap: 4px;
  padding: 7px 10px; font-size: 11px; color: var(--c-text-mut);
  background: rgba(7, 10, 18, .4); border-bottom: 1px solid var(--c-line);
}
.irr-trust span { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
@media (max-width: 400px) { .irr-trust { font-size: 10.5px; gap: 3px 9px; } }
.irr-trust .irr-star { color: var(--c-crimson-lt); }
.irr-trust svg { width: 12px; height: 12px; }

/* progress pill + bar (appears after step 1) */
.irr-progress { display: none; align-items: center; gap: 11px; padding: 8px 15px; background: rgba(7, 10, 18, .4); border-bottom: 1px solid var(--c-line); }
.irr-progress.show { display: flex; }
.irr-progress-track { flex: 1 1 auto; height: 4px; border-radius: 3px; background: rgba(255, 255, 255, .09); overflow: hidden; }
.irr-progress-fill { height: 100%; border-radius: 3px; width: 0; background: linear-gradient(90deg, var(--c-crimson-dk), var(--c-crimson-lt)); box-shadow: 0 0 10px rgba(59, 130, 246, .5); transition: width .55s var(--c-ease-out); }
.irr-progress-label { flex: 0 0 auto; font-size: 10.5px; letter-spacing: .05em; text-transform: uppercase; color: var(--c-text-mut); white-space: nowrap; }
.irr-progress-label b { color: var(--c-crimson-lt); font-weight: 700; }

/* header call button gets a subtle accent */
.irr-head-btn.irr-call { color: #fff; }
.irr-head-btn.irr-call:hover { background: rgba(59, 130, 246, .5); }

/* message log */
.irr-log {
  flex: 1 1 auto; overflow-y: auto; overflow-x: hidden;
  padding: 18px 15px 8px;
  display: flex; flex-direction: column; gap: 10px;
  scroll-behavior: smooth;
  scrollbar-width: thin; scrollbar-color: rgba(59, 130, 246, .5) transparent;
}
.irr-log::-webkit-scrollbar { width: 7px; }
.irr-log::-webkit-scrollbar-thumb { background: rgba(59, 130, 246, .38); border-radius: 4px; }
.irr-log::-webkit-scrollbar-track { background: transparent; }

/* day/time divider */
.irr-divider { text-align: center; font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--c-text-mut); margin: 4px 0 2px; }

/* rows */
.irr-row { display: flex; align-items: flex-end; gap: 8px; max-width: 100%; animation: irr-msg-in .42s var(--c-ease-out) both; }
.irr-row--bot { justify-content: flex-start; }
.irr-row--user { justify-content: flex-end; }
.irr-row-avatar { flex: 0 0 26px; width: 26px; height: 26px; border-radius: 50%; overflow: hidden; border: 1px solid var(--c-line); background: var(--c-ink); align-self: flex-end; }
.irr-row-avatar img { width: 100%; height: 100%; object-fit: cover; }
.irr-row-avatar.is-hidden { visibility: hidden; }

.irr-bubble {
  max-width: 82%; padding: 10px 14px; font-size: 14.5px; line-height: 1.5;
  border-radius: 16px; position: relative; word-wrap: break-word;
}
.irr-row--bot .irr-bubble {
  background: rgba(255, 255, 255, .05); border: 1px solid var(--c-line);
  color: var(--c-text-hi); border-bottom-left-radius: 5px;
}
.irr-row--user .irr-bubble {
  background: linear-gradient(135deg, var(--c-crimson) 0%, var(--c-crimson-dk) 100%);
  color: #fff; border-bottom-right-radius: 5px;
  box-shadow: 0 4px 14px rgba(59, 130, 246, .3);
}
.irr-bubble a { color: var(--c-crimson-lt); text-decoration: underline; text-underline-offset: 2px; }
.irr-bubble b, .irr-bubble strong { color: #fff; font-weight: 700; }
.irr-row--bot .irr-bubble b { color: var(--c-crimson-lt); }

/* typing indicator */
.irr-typing { display: inline-flex; gap: 5px; padding: 14px 16px; align-items: center; }
.irr-typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--c-crimson-lt); opacity: .5; animation: irr-typing 1.3s infinite ease-in-out; }
.irr-typing i:nth-child(2) { animation-delay: .18s; }
.irr-typing i:nth-child(3) { animation-delay: .36s; }
@keyframes irr-typing { 0%, 60%, 100% { transform: translateY(0); opacity: .4; } 30% { transform: translateY(-5px); opacity: 1; } }
@keyframes irr-msg-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* inline listing card */
.irr-listing {
  display: flex; gap: 11px; align-items: center; text-decoration: none;
  padding: 9px; margin-top: 2px;
  background: rgba(255, 255, 255, .04); border: 1px solid var(--c-line); border-radius: 14px;
  transition: border-color .25s, transform .25s, box-shadow .25s; color: var(--c-text-hi);
  animation: irr-msg-in .42s var(--c-ease-out) both;
}
.irr-listing:hover { border-color: rgba(59, 130, 246, .55); transform: translateY(-2px); box-shadow: 0 10px 26px rgba(2, 4, 10, .4); }
.irr-listing-img { flex: 0 0 74px; width: 74px; height: 58px; border-radius: 9px; overflow: hidden; background: var(--c-ink); }
.irr-listing-img img { width: 100%; height: 100%; object-fit: cover; }
.irr-listing-body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.irr-listing-price { font-family: var(--font-serif, Georgia, serif); font-size: 16px; color: var(--c-crimson-lt); font-weight: 600; line-height: 1.1; }
.irr-listing-addr { font-size: 13px; color: var(--c-text-hi); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.irr-listing-spec { font-size: 11.5px; color: var(--c-text-mut); margin-top: 2px; }
.irr-listing-badge { flex: 0 0 auto; align-self: flex-start; font-size: 9.5px; letter-spacing: .04em; text-transform: uppercase; font-weight: 700; padding: 3px 7px; border-radius: 999px; }
.irr-badge-active { background: rgba(89, 168, 119, .18); color: #8fe0ad; border: 1px solid rgba(89, 168, 119, .4); }
.irr-badge-pending { background: rgba(217, 152, 72, .18); color: #f0c88a; border: 1px solid rgba(217, 152, 72, .4); }
.irr-badge-sold { background: rgba(165, 30, 45, .2); color: var(--c-crimson-lt); border: 1px solid rgba(165, 30, 45, .45); }

/* ---------- quick replies (chips) ---------- */
.irr-chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 4px 15px 10px; justify-content: flex-end; }
.irr-chip {
  padding: 9px 15px; font-size: 13.5px; font-weight: 500; color: var(--c-crimson-lt);
  background: rgba(59, 130, 246, .1); border: 1px solid rgba(59, 130, 246, .4);
  border-radius: 999px; line-height: 1.2; white-space: nowrap;
  transition: background .22s, border-color .22s, color .22s, transform .18s;
  animation: irr-chip-in .34s var(--c-ease-out) both;
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.irr-chip:hover { background: var(--c-crimson); border-color: var(--c-crimson); color: #fff; transform: translateY(-2px); box-shadow: 0 6px 18px rgba(59, 130, 246, .34); }
.irr-chip:active { transform: translateY(0) scale(.97); }
.irr-chip--primary { background: linear-gradient(120deg, var(--c-crimson-lt), var(--c-crimson) 55%, var(--c-crimson-dk)); border-color: transparent; color: #fff; }
.irr-chip--ghost { background: rgba(255, 255, 255, .04); border-color: var(--c-line); color: var(--c-text); }
.irr-chip--ghost:hover { color: #fff; background: rgba(255, 255, 255, .1); border-color: var(--c-line); box-shadow: none; }
.irr-chip[disabled] { opacity: .4; pointer-events: none; }
@keyframes irr-chip-in { from { opacity: 0; transform: translateY(8px) scale(.9); } to { opacity: 1; transform: none; } }

/* ---------- composer ---------- */
.irr-compose {
  flex: 0 0 auto; display: flex; align-items: flex-end; gap: 8px;
  padding: 11px 12px; border-top: 1px solid var(--c-line);
  background: rgba(7, 10, 18, .5);
}
.irr-input {
  flex: 1 1 auto; resize: none; max-height: 96px; min-height: 42px;
  padding: 11px 15px; font-size: 14.5px; line-height: 1.4;
  color: var(--c-text-hi); background: rgba(255, 255, 255, .05);
  border: 1px solid var(--c-line); border-radius: 21px;
  transition: border-color .25s, box-shadow .25s, background .25s;
}
.irr-input::placeholder { color: var(--c-text-mut); }
.irr-input:focus { outline: none; border-color: var(--c-crimson); box-shadow: 0 0 0 3px rgba(59, 130, 246, .16); background: rgba(255, 255, 255, .08); }
.irr-send {
  flex: 0 0 42px; width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center;
  color: #fff; background: linear-gradient(135deg, var(--c-crimson-lt), var(--c-crimson) 55%, var(--c-crimson-dk));
  box-shadow: 0 4px 14px rgba(59, 130, 246, .34); transition: transform .2s var(--c-ease-out), opacity .2s, box-shadow .25s;
}
.irr-send svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.irr-send:hover { transform: translateY(-2px) scale(1.05); box-shadow: 0 8px 22px rgba(59, 130, 246, .5); }
.irr-send:disabled { opacity: .4; pointer-events: none; box-shadow: none; }
.irr-compose.is-hidden { display: none; }

/* privacy footer note */
.irr-privacy { flex: 0 0 auto; text-align: center; font-size: 10.5px; color: var(--c-text-mut); padding: 0 12px 9px; background: rgba(7, 10, 18, .5); }
.irr-privacy svg { width: 10px; height: 10px; vertical-align: -1px; margin-right: 3px; }
.irr-privacy a { color: var(--c-text-mut); text-decoration: underline; }

/* powered / reset row inside header menu is unnecessary; keep it lean */

/* ---------- summary / confirmation card ---------- */
.irr-summary {
  margin-top: 2px; padding: 13px 15px; border-radius: 14px;
  background: rgba(59, 130, 246, .08); border: 1px solid rgba(59, 130, 246, .3);
  font-size: 13px; color: var(--c-text-hi); animation: irr-msg-in .42s var(--c-ease-out) both;
}
.irr-summary dt { color: var(--c-text-mut); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
.irr-summary dd { margin: 1px 0 8px; color: #fff; font-weight: 600; font-size: 14px; }
.irr-summary dd:last-child { margin-bottom: 0; }

/* ---------- mobile: full-height sheet ---------- */
@media (max-width: 480px) {
  .irr-chat { right: 0; bottom: 0; left: 0; }
  .irr-fab { position: fixed; right: 18px; bottom: 18px; }
  .irr-teaser { position: fixed; right: 18px; left: 18px; width: auto; bottom: calc(var(--c-fab) + 30px); }
  .irr-panel {
    position: fixed; inset: 0; width: 100vw; max-width: 100vw;
    height: 100dvh; border-radius: 0; border: none;
    transform: translateY(100%);
  }
  .irr-chat.is-open .irr-panel { transform: none; }
  .irr-head { padding-top: max(15px, env(safe-area-inset-top)); }
  .irr-compose { padding-bottom: max(11px, env(safe-area-inset-bottom)); }
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .irr-fab, .irr-fab::after, .irr-teaser, .irr-panel, .irr-row, .irr-chip, .irr-listing, .irr-summary, .irr-typing i { animation: none !important; }
  .irr-panel { transition: opacity .2s ease, visibility .2s ease; transform: none; }
  .irr-chat.is-open .irr-panel { transform: none; }
  .irr-log { scroll-behavior: auto; }
}

/* ---------- coexistence with the site's DossierBanner ----------
   Added when Zeb moved onto georgeroarealestate.com. The banner is fixed to
   the bottom edge (~64px tall); .gr-lift raises the whole widget clear of it
   while the banner is latched visible. zeb.js adds/removes the class. */
.irr-chat { transition: bottom .45s var(--c-ease-out); }
.irr-chat.gr-lift { bottom: 96px; }
@media (max-width: 480px) {
  /* On phones the fab is fixed independently of the wrapper. */
  .irr-chat.gr-lift .irr-fab { bottom: 84px; }
  .irr-chat.gr-lift .irr-teaser { bottom: calc(var(--c-fab) + 96px); }
}

/* ---------- header name: George's gradient serif ----------
   The widget presents as "George Roa · Assistant", like the widget it
   replaced. The name uses the site's serif and sapphire gradient (the .grad
   class from index.css also applies; this is the same effect self-contained
   so the widget never depends on the page's stylesheet). */
.irr-head-name {
  font-family: var(--font-serif, "Cormorant Garamond", Georgia, serif);
  font-size: 19px; font-weight: 600; letter-spacing: .01em;
  background: linear-gradient(120deg, #dbeafe 0%, #93c5fd 40%, #3b82f6 100%);
  -webkit-background-clip: text; background-clip: text;
  color: transparent; -webkit-text-fill-color: transparent;
}
