(function () { if (window.__cassChatLoaded) return; window.__cassChatLoaded = true; var EMBED_URL = "https://cassrealestate.lovable.app/embed/chat"; var Z = 2147483600; function $(tag, css) { var el = document.createElement(tag); if (css) el.style.cssText = css; return el; } function init() { var btn = $("button", [ "position:fixed","right:20px","bottom:20px","width:60px","height:60px", "border-radius:9999px","border:none","cursor:pointer","background:#0f172a", "color:#fff","box-shadow:0 10px 30px rgba(0,0,0,.25)", "display:flex","align-items:center","justify-content:center", "z-index:" + Z,"transition:transform .15s ease" ].join(";")); btn.setAttribute("aria-label", "Open chat"); btn.innerHTML = ''; btn.onmouseenter = function () { btn.style.transform = "scale(1.05)"; }; btn.onmouseleave = function () { btn.style.transform = "scale(1)"; }; var panel = $("div", [ "position:fixed","right:20px","bottom:90px","width:380px", "max-width:calc(100vw - 32px)","height:600px", "max-height:calc(100vh - 120px)","border-radius:16px", "overflow:hidden","box-shadow:0 20px 60px rgba(0,0,0,.3)", "background:#fff","z-index:" + Z,"display:none", "transform-origin:right bottom" ].join(";")); var iframe = $("iframe", "width:100%;height:100%;border:0;display:block;"); iframe.src = EMBED_URL; iframe.title = "Cass Real Estate chat"; iframe.allow = "clipboard-write"; panel.appendChild(iframe); var close = $("button", [ "position:absolute","top:10px","right:10px","width:28px","height:28px", "border-radius:9999px","border:none","background:rgba(0,0,0,.08)", "color:#111","cursor:pointer","font-size:16px","line-height:1","z-index:1" ].join(";")); close.innerHTML = "×"; close.setAttribute("aria-label", "Close chat"); panel.appendChild(close); var open = false; function toggle(force) { open = typeof force === "boolean" ? force : !open; panel.style.display = open ? "block" : "none"; btn.style.display = open ? "none" : "flex"; } btn.addEventListener("click", function () { toggle(true); }); close.addEventListener("click", function () { toggle(false); }); document.body.appendChild(btn); document.body.appendChild(panel); } if (document.readyState === "loading") { document.addEventListener("DOMContentLoaded", init); } else { init(); } })();