#inreal-ai-chat-root {
  --inreal-accent: #a6ff00;
  --inreal-launcher-color: var(--inreal-accent);
  /* IMPORTANT:
     - keep the launcher pinned to the viewport (not to sticky headers)
     - themes often override fixed elements on mobile, so we use !important
  */
  position: fixed !important;
  right: 18px;
  bottom: 18px;
  z-index: 2147483647 !important;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

.inreal-ai-btn {
  width: 56px; height: 56px; border-radius: 999px; border: none; cursor: pointer;
  background: var(--inreal-launcher-color); color: #0b0b0b; font-weight: 800;
  box-shadow: 0 10px 25px rgba(0,0,0,.25);
}

.inreal-ai-panel {
  width: 330px; max-width: calc(100vw - 36px);
  height: 420px; background: #0f0f0f; color: #f2f2f2;
  border-radius: 18px; overflow: hidden;
  box-shadow: 0 18px 55px rgba(0,0,0,.35);
  display: none;
}

/* Desktop: allow resizing */
@media (min-width: 769px){
  .inreal-ai-panel{
    resize: both;
    overflow: auto;
    min-width: 320px;
    min-height: 360px;
    max-width: 560px;
    max-height: 80vh;
  }
}

/* Mobile: fullscreen panel (do NOT stretch the root, otherwise the launcher jumps to the top) */
@media (max-width: 768px){
  /* Force launcher to bottom-right on mobile (override any inline top/left set by settings/theme) */
  #inreal-ai-chat-root{
    position: fixed !important;
    right: 16px !important;
    bottom: 16px !important;
    top: auto !important;
    left: auto !important;
    transform: none !important;
  }

  .inreal-ai-panel{
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    max-width: none;
    border-radius: 0;
  }
  #inreal-ai-chat-root.inreal-open .inreal-ai-launcher{ display: none; }
}

/* Body lock when chat open on mobile */
body.inreal-ai-body-lock{ overflow:hidden !important; }

.inreal-ai-panel.open { display: flex; flex-direction: column; }

.inreal-ai-header {
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #121212;
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.inreal-ai-header-left{ display:flex; align-items:center; gap:10px; }
.inreal-ai-avatar{ width:34px; height:34px; border-radius:999px; background: rgba(255,255,255,.12); overflow:hidden; flex:0 0 auto; }
.inreal-ai-avatar img{ width:100%; height:100%; object-fit:cover; display:block; }
.inreal-ai-title { font-weight: 900; font-size: 14px; line-height:1.1; }
.inreal-ai-subtitle{ font-size:12px; color: rgba(255,255,255,.65); margin-top:2px; }

.inreal-ai-close { background: transparent; border: none; color: #bbb; font-size: 18px; cursor: pointer; }

.inreal-ai-messages { padding: 12px; overflow: auto; flex: 1; }

.inreal-ai-bubble {
  padding: 10px 12px; border-radius: 14px; margin-bottom: 10px; line-height: 1.25;
  font-size: 14px; white-space: pre-wrap;
}

.inreal-ai-bubble.assistant { background: rgba(166,255,0,.10); border: 1px solid rgba(166,255,0,.16); }
.inreal-ai-bubble.assistant[data-typing="1"]{ opacity:.85; }
.inreal-ai-bubble.user { background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.10); margin-left: 36px; }

.inreal-ai-input {
  display: flex; gap: 8px; padding: 10px; background: #121212; border-top: 1px solid rgba(255,255,255,.08);
}

.inreal-ai-input input {
  flex: 1; border-radius: 12px; border: 1px solid rgba(255,255,255,.12);
  background: #0c0c0c; color: #f2f2f2; padding: 10px 12px; outline: none;
}

.inreal-ai-input button {
  border-radius: 12px; border: none; cursor: pointer;
  background: var(--inreal-accent); color: #0b0b0b; font-weight: 900; padding: 0 14px;
}

.inreal-ai-typing{ display:inline-flex; gap:4px; align-items:center; }
.inreal-ai-dot{ width:6px; height:6px; border-radius:99px; background: rgba(255,255,255,.65); animation: inreal-ai-bounce 1.2s infinite; }
.inreal-ai-dot:nth-child(2){ animation-delay: .15s; }
.inreal-ai-dot:nth-child(3){ animation-delay: .30s; }

@keyframes inreal-ai-bounce{
  0%, 80%, 100%{ transform: translateY(0); opacity:.5; }
  40%{ transform: translateY(-4px); opacity:1; }
}

/* Theme support */
#inreal-ai-chat-root.inreal-theme-light .inreal-ai-panel{ background:#ffffff; color:#111; }
#inreal-ai-chat-root.inreal-theme-light .inreal-ai-header{ background:#f5f5f5; border-bottom:1px solid rgba(0,0,0,.08); }
#inreal-ai-chat-root.inreal-theme-light .inreal-ai-subtitle{ color: rgba(0,0,0,.55); }
#inreal-ai-chat-root.inreal-theme-light .inreal-ai-close{ color:#444; }
#inreal-ai-chat-root.inreal-theme-light .inreal-ai-input{ background:#f5f5f5; border-top:1px solid rgba(0,0,0,.08); }
#inreal-ai-chat-root.inreal-theme-light .inreal-ai-input input{ background:#fff; color:#111; border:1px solid rgba(0,0,0,.14); }
#inreal-ai-chat-root.inreal-theme-light .inreal-ai-bubble.user{ background: rgba(0,0,0,.05); border:1px solid rgba(0,0,0,.08); }
#inreal-ai-chat-root.inreal-theme-light .inreal-ai-bubble.assistant{ background: rgba(166,255,0,.14); border:1px solid rgba(166,255,0,.22); }

.inreal-ai-theme-toggle{
  background: transparent;
  border: 1px solid rgba(255,255,255,.18);
  color: inherit;
  border-radius: 10px;
  padding: 4px 8px;
  font-size: 12px;
  cursor: pointer;
  margin-right: 8px;
}
#inreal-ai-chat-root.inreal-theme-light .inreal-ai-theme-toggle{ border:1px solid rgba(0,0,0,.18); }

/* Header WhatsApp link */
.inreal-ai-wa{
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding:6px 10px;
  border-radius:10px;
  text-decoration:none;
  font-size:12px;
  font-weight:800;
  color: inherit;
  border:1px solid rgba(255,255,255,.18);
}
#inreal-ai-chat-root.inreal-theme-light .inreal-ai-wa{ border:1px solid rgba(0,0,0,.18); }

/* Quick reply chips */
.inreal-ai-quick{ display:flex; gap:8px; padding: 10px; background: transparent; }
.inreal-ai-chip{
  border:1px solid rgba(255,255,255,.16);
  background: rgba(255,255,255,.06);
  color: inherit;
  padding:8px 10px;
  border-radius:999px;
  font-size:13px;
  cursor:pointer;
  transition: transform .06s ease, background .15s ease, border-color .15s ease;
}
.inreal-ai-chip:hover{ background: rgba(255,255,255,.10); }
.inreal-ai-chip:active{ transform: scale(.98); }
#inreal-ai-chat-root.inreal-theme-light .inreal-ai-chip{
  border:1px solid rgba(0,0,0,.12);
  background: rgba(0,0,0,.03);
}

/* Property cards */
.inreal-ai-text{ white-space: pre-wrap; }
.inreal-ai-cards{ margin-top:10px; display:flex; flex-direction:column; gap:10px; }
.inreal-ai-cards-track{
  display:flex;
  gap:10px;
  overflow-x:auto;
  padding-bottom:6px;
  scroll-snap-type:x mandatory;
  -webkit-overflow-scrolling: touch;
}
.inreal-ai-cards-track::-webkit-scrollbar{ height:6px; }
.inreal-ai-cards-track::-webkit-scrollbar-thumb{ background: rgba(255,255,255,.18); border-radius:999px; }
#inreal-ai-chat-root.inreal-theme-light .inreal-ai-cards-track::-webkit-scrollbar-thumb{ background: rgba(0,0,0,.18); }
.inreal-ai-card{
  display:flex;
  gap:10px;
  border-radius:14px;
  overflow:hidden;
  border:1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.06);
  flex:0 0 270px;
  scroll-snap-align:start;
}
#inreal-ai-chat-root.inreal-theme-light .inreal-ai-card{
  border:1px solid rgba(0,0,0,.10);
  background: rgba(0,0,0,.03);
}
.inreal-ai-card-img{ width:86px; height:86px; flex:0 0 auto; background: rgba(255,255,255,.08); }
.inreal-ai-card-img.placeholder{ background: rgba(255,255,255,.06); }
.inreal-ai-card-img img{ width:100%; height:100%; object-fit:cover; display:block; }
.inreal-ai-card-body{ padding:10px; flex:1; min-width:0; }
.inreal-ai-card-title{ font-weight:900; font-size:13px; line-height:1.2; }
.inreal-ai-card-meta{ margin-top:6px; font-size:12px; opacity:.9; }
.inreal-ai-card-extra{ margin-top:4px; font-size:12px; opacity:.75; }
.inreal-ai-card-actions{ margin-top:8px; display:flex; gap:8px; }
.inreal-ai-card-btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:7px 10px;
  border-radius:10px;
  text-decoration:none;
  font-size:12px;
  font-weight:900;
  background: rgba(255,255,255,.10);
  color: inherit;
  border:1px solid rgba(255,255,255,.16);
  transition: transform .06s ease, background .15s ease, border-color .15s ease;
}
.inreal-ai-card-btn:hover{ background: rgba(255,255,255,.14); }
.inreal-ai-card-btn:active{ transform: scale(.98); }
.inreal-ai-card-btn.secondary{
  background: transparent;
  border:1px solid rgba(255,255,255,.22);
}
#inreal-ai-chat-root.inreal-theme-light .inreal-ai-card-btn.secondary{
  background: transparent;
  border:1px solid rgba(0,0,0,.16);
}
#inreal-ai-chat-root.inreal-theme-light .inreal-ai-card-btn{
  background: rgba(0,0,0,.05);
  border:1px solid rgba(0,0,0,.10);
}

.inreal-ai-cards-wa{ margin-top:2px; }
.inreal-ai-wa-btn{
  display:flex;
  width:100%;
  justify-content:center;
  padding:10px 12px;
  border-radius:12px;
  text-decoration:none;
  font-weight:950;
  background: var(--inreal-accent);
  color: #0b0b0b;
}

/* Tooltip */
.inreal-ai-tooltip{ display:none; position:absolute; right:70px; bottom:10px; max-width:220px; padding:10px 12px; border-radius:14px; background:#111; color:#fff; box-shadow:0 10px 25px rgba(0,0,0,.25); border:1px solid rgba(255,255,255,.10); }
.inreal-ai-tooltip.show{ display:block; }
#inreal-ai-chat-root.inreal-theme-light .inreal-ai-tooltip{ background:#fff; color:#111; border:1px solid rgba(0,0,0,.10); }

.inreal-ai-btn.hidden{ display:none; }

/* Fullscreen on mobile */
@media (max-width: 768px){
  #inreal-ai-chat-root{
    right: 0;
    left: 0;
    top: 0;
    bottom: 0;
  }
  .inreal-ai-panel{
    width: 100vw;
    height: 100vh;
    max-width: none;
    border-radius: 0;
  }
  #inreal-ai-chat-root.inreal-open .inreal-ai-launcher{ display:none; }
}

/* Resizable panel on desktop */
@media (min-width: 769px){
  .inreal-ai-panel{
    resize: both;
    overflow: auto;
    min-width: 320px;
    min-height: 360px;
    max-width: 640px;
    max-height: 80vh;
  }
}

/* Body lock when open (mobile) */
body.inreal-ai-body-lock{
  overflow: hidden !important;
  touch-action: none;
}
