#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;
  position: relative;
}

/* Desktop: allow resizing */
@media (min-width: 769px){
  .inreal-ai-panel{
    resize: both !important;
    overflow: hidden;
    min-width: 320px;
    min-height: 360px;
    max-width: 560px;
    max-height: 80vh;
  }
  /* Resize handle (desktop): visible grip in the top-left corner */
  .inreal-ai-resizer{
    position:absolute;
    left:8px;
    top:8px;
    right:auto;
    bottom:auto;
    width:22px;
    height:22px;
    cursor:nwse-resize;
    border-radius:6px;
    background:
      linear-gradient(135deg, rgba(0,0,0,.00) 0 48%, rgba(0,0,0,.35) 48% 52%, rgba(0,0,0,.00) 52% 100%),
      linear-gradient(135deg, rgba(0,0,0,.00) 0 58%, rgba(0,0,0,.25) 58% 62%, rgba(0,0,0,.00) 62% 100%),
      rgba(255,255,255,.18);
    box-shadow: 0 1px 6px rgba(0,0,0,.18);
    opacity:.9;
    user-select:none;
  }
  .inreal-ai-resizer:hover{ opacity:1; }
  .inreal-ai-resizer::after{
    content:"⤢";
    position:absolute;
    inset:0;
    display:flex;
    align-items:center;
    justify-content:center;
    font-size:12px;
    line-height:1;
    color:rgba(0,0,0,.55);
    pointer-events:none;
  }

}

/* Mobile: fullscreen panel (do NOT stretch the root, otherwise the launcher jumps to the top) */
@media (max-width: 768px){
  .inreal-ai-resizer{ display:none !important; }

  /* 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-meta{
  font-size: 11px;
  opacity: .75;
  margin-bottom: 6px;
  font-weight: 800;
}

.inreal-ai-bubble-text{ 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:12px;
  overflow-x:auto;
  padding:2px 2px 10px;
  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); }

/* Card — vertical, more "real-estate" like */
.inreal-ai-card{
  position:relative;
  display:flex;
  flex-direction:column;
  border-radius:16px;
  overflow:hidden;
  border:1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.07);
  box-shadow: 0 10px 26px rgba(0,0,0,.22);
  flex:0 0 248px;
  scroll-snap-align:start;
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}
.inreal-ai-card:hover{
  transform: translateY(-2px);
  box-shadow: 0 14px 34px rgba(0,0,0,.26);
  border-color: rgba(255,255,255,.22);
}
#inreal-ai-chat-root.inreal-theme-light .inreal-ai-card{
  border:1px solid rgba(0,0,0,.10);
  background: rgba(255,255,255,.92);
  box-shadow: 0 10px 24px rgba(0,0,0,.10);
}
#inreal-ai-chat-root.inreal-theme-light .inreal-ai-card:hover{
  box-shadow: 0 14px 32px rgba(0,0,0,.12);
  border-color: rgba(0,0,0,.16);
}

.inreal-ai-card-img{
  width:100%;
  height:124px;
  flex:0 0 auto;
  background: rgba(255,255,255,.10);
}
.inreal-ai-card-img.placeholder{ background: rgba(255,255,255,.08); }
#inreal-ai-chat-root.inreal-theme-light .inreal-ai-card-img{ background: rgba(0,0,0,.05); }
.inreal-ai-card-img img{ width:100%; height:100%; object-fit:cover; display:block; }

.inreal-ai-card-body{ padding:12px 12px 12px; display:flex; flex-direction:column; gap:8px; min-width:0; }
.inreal-ai-card-title{
  font-weight:950;
  font-size:13px;
  line-height:1.25;
  letter-spacing:.1px;
  display:-webkit-box;
  -webkit-line-clamp:2;
  -webkit-box-orient:vertical;
  overflow:hidden;
}

.inreal-ai-card-meta{ display:flex; flex-wrap:wrap; gap:6px; }
.inreal-ai-card-meta span{
  display:inline-flex;
  align-items:center;
  padding:5px 8px;
  border-radius:999px;
  font-size:11.5px;
  font-weight:900;
  background: rgba(255,255,255,.10);
  border:1px solid rgba(255,255,255,.16);
}
#inreal-ai-chat-root.inreal-theme-light .inreal-ai-card-meta span{
  background: rgba(0,0,0,.04);
  border:1px solid rgba(0,0,0,.10);
}

.inreal-ai-card-extra{ font-size:12px; opacity:.85; display:flex; flex-wrap:wrap; gap:6px; }

.inreal-ai-card-actions{ margin-top:2px; display:grid; grid-template-columns: 1fr 1fr; gap:8px; }
.inreal-ai-card-btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:9px 10px;
  border-radius:12px;
  text-decoration:none;
  font-size:12px;
  font-weight:950;
  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,.04);
  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:260px;
  padding:12px 14px;
  border-radius:14px;
  background:#111;
  color:#fff;
  box-shadow:0 12px 30px rgba(0,0,0,.28);
  border:1px solid rgba(255,255,255,.14);
  font-size:13px;
  line-height:1.25;
}
.inreal-ai-tooltip.show{ display:block; }

.inreal-ai-tooltip::after{
  content:"";
  position:absolute;
  right:-7px;
  bottom:16px;
  width:12px;
  height:12px;
  background:#111;
  border-right:1px solid rgba(255,255,255,.14);
  border-bottom:1px solid rgba(255,255,255,.14);
  transform:rotate(-45deg);
  border-bottom-right-radius:2px;
}

#inreal-ai-chat-root.inreal-theme-light .inreal-ai-tooltip{
  background:#fff;
  color:#111;
  border:1px solid rgba(0,0,0,.12);
  box-shadow:0 12px 30px rgba(0,0,0,.18);
}
#inreal-ai-chat-root.inreal-theme-light .inreal-ai-tooltip::after{
  background:#fff;
  border-right:1px solid rgba(0,0,0,.12);
  border-bottom:1px solid rgba(0,0,0,.12);
}

.inreal-ai-tooltip-close{
  position:absolute;
  top:6px;
  right:6px;
  width:22px;
  height:22px;
  border:none;
  border-radius:8px;
  background:rgba(255,255,255,.10);
  color:inherit;
  font-size:16px;
  line-height:22px;
  cursor:pointer;
}
#inreal-ai-chat-root.inreal-theme-light .inreal-ai-tooltip-close{
  background:rgba(0,0,0,.06);
}
.inreal-ai-tooltip-close:hover{ filter:brightness(1.1); }
.inreal-ai-tooltip-text{ padding-right:26px; }


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

/* Fullscreen on mobile */
@media (max-width: 768px){
  .inreal-ai-resizer{ display:none !important; }

  #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;
}
