/* Chat widget – slim, modern. Load after your main CSS. */
.inv-chat-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(145deg, #0f172a 0%, #020617 100%);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0,0,0,.3), 0 0 0 1px rgba(255,255,255,.08);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9998;
  will-change: transform;
  transition: transform .25s ease;
}
.inv-chat-fab:hover {
  transform: translateY(-2px);
  /* Static shadow on hover to avoid non-composited box-shadow animation (Lighthouse) */
  box-shadow: 0 6px 24px rgba(0,0,0,.35), 0 0 0 1px rgba(6,182,212,.25);
}
.inv-chat-fab .inv-chat-fab-icon { width: 22px; height: 22px; }

.inv-chat.inv-chat-panel {
  position: fixed;
  bottom: 88px;
  right: 24px;
  width: 340px;
  max-width: calc(100vw - 40px);
  height: 480px;
  max-height: 80vh;
  background: rgba(15,23,42,.98);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 16px;
  box-shadow: 0 20px 40px rgba(0,0,0,.4);
  display: flex;
  flex-direction: column;
  z-index: 9997;
  overflow: hidden;
  opacity: 0;
  transform: scale(.96) translateY(8px);
  transition: opacity .25s ease, transform .25s ease;
}
.inv-chat-panel.inv-hidden { display: flex !important; visibility: hidden; opacity: 0; transform: scale(.96) translateY(8px); pointer-events: none; }
.inv-chat.inv-chat-panel:not(.inv-hidden) { visibility: visible; opacity: 1; transform: scale(1) translateY(0); }

.inv-chat-header {
  padding: 14px 18px 12px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  flex-shrink: 0;
}
.inv-chat-header-top { display: flex; align-items: center; gap: 8px; }
.inv-chat-ai-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  font-size: .625rem;
  font-weight: 700;
  letter-spacing: .08em;
  color: #0f172a;
  background: linear-gradient(135deg, #22d3ee 0%, #06b6d4 100%);
  border-radius: 6px;
}
.inv-chat-header h3 { font-size: 1rem; font-weight: 600; color: rgba(255,255,255,.95); letter-spacing: -.02em; margin: 0; }
.inv-chat-header-desc { font-size: .6875rem; color: rgba(255,255,255,.45); margin: 6px 0 0; line-height: 1.35; }

.inv-chat-messages {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px 18px;
  font-size: .875rem;
  line-height: 1.5;
  min-height: 0;
}
.inv-chat-msg {
  margin-bottom: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  max-width: 90%;
  animation: inv-msg-in .3s ease backwards;
}
.inv-chat-msg.user {
  background: rgba(6,182,212,.25);
  color: #fff;
  margin-left: auto;
  border: 1px solid rgba(6,182,212,.3);
}
.inv-chat-msg.bot {
  background: rgba(255,255,255,.05);
  color: rgba(255,255,255,.9);
  border: 1px solid rgba(255,255,255,.08);
  white-space: pre-wrap;
}
.inv-chat-msg.bot .inv-chat-link { color: #22d3ee; font-weight: 500; text-decoration: none; }
.inv-chat-msg.bot .inv-chat-link:hover { text-decoration: underline; }
.inv-chat-msg-loading { color: rgba(255,255,255,.45); animation: inv-load-pulse 1s ease-in-out infinite; }
@keyframes inv-msg-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
@keyframes inv-load-pulse { 0%, 100% { opacity: .45; } 50% { opacity: 1; } }

.inv-chat-prompts-wrap {
  flex-shrink: 0;
  padding: 10px 18px 12px;
  border-top: 1px solid rgba(255,255,255,.06);
  display: flex;
  align-items: center;
  gap: 10px;
}
.inv-chat-prompts-label { font-size: .625rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: rgba(255,255,255,.35); white-space: nowrap; }
.inv-chat-prompts-scroll { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0; flex: 1; min-width: 0; scrollbar-width: none; }
.inv-chat-prompts-scroll::-webkit-scrollbar { height: 0; display: none; }
.inv-chat-prompt {
  flex-shrink: 0;
  padding: 6px 12px;
  font-size: .75rem;
  font-weight: 500;
  color: rgba(255,255,255,.85);
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 20px;
  cursor: pointer;
  transition: background .2s, border-color .2s;
}
.inv-chat-prompt:hover { background: rgba(6,182,212,.12); border-color: rgba(6,182,212,.35); }

.inv-chat-form {
  flex-shrink: 0;
  padding: 12px 18px 16px;
  border-top: 1px solid rgba(255,255,255,.06);
  display: flex;
  gap: 10px;
  align-items: center;
}
.inv-chat-form input {
  flex: 1;
  min-width: 0;
  padding: 12px 14px;
  font-size: .875rem;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 12px;
  color: #fff;
  transition: border-color .2s, box-shadow .2s;
}
.inv-chat-form input::placeholder { color: rgba(255,255,255,.35); }
.inv-chat-form input:focus { outline: none; border-color: rgba(6,182,212,.5); box-shadow: 0 0 0 2px rgba(6,182,212,.15); }
.inv-chat-form .inv-chat-send, .inv-chat-form button {
  padding: 12px 16px;
  font-size: .875rem;
  font-weight: 600;
  background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
  color: #0f172a;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: opacity .2s, transform .2s;
}
.inv-chat-form .inv-chat-send:hover, .inv-chat-form button:hover { opacity: .95; transform: translateY(-1px); }

.inv-chat-messages::-webkit-scrollbar { width: 4px; }
.inv-chat-messages::-webkit-scrollbar-track { background: transparent; }
.inv-chat-messages::-webkit-scrollbar-thumb { background: rgba(6,182,212,.25); border-radius: 2px; }
.inv-chat-messages::-webkit-scrollbar-thumb:hover { background: rgba(6,182,212,.4); }

/* Realty Maitra: chat on left so it doesn’t cover the back-to-top arrow (right) */
body.rm-page .inv-chat-fab { right: auto; left: 24px; }
body.rm-page .inv-chat.inv-chat-panel { right: auto; left: 24px; }

@media (prefers-reduced-motion: reduce) {
  .inv-chat-fab, .inv-chat-fab .inv-chat-fab-icon, .inv-chat.inv-chat-panel, .inv-chat-msg, .inv-chat-msg-loading, .inv-chat-prompt, .inv-chat-form input, .inv-chat-form button { animation: none !important; transition-duration: .1s !important; }
}
