/* Floating AI Chatbot launcher, auto-injected site-wide via wp_footer (never a shortcode).
   Fixed-position overlay, scoped under .realtyzhub-chatbot so it never leaks into (or inherits
   from) the host theme. Same "targeted !important escape hatch" pattern as booking-widget.css,
   for the same reason: host themes commonly style bare `button`/`input` elements with rules
   specific enough to otherwise bleed into this widget. */

.realtyzhub-chatbot {
  --rh-accent: #006AFF;
  --rh-text: #1e293b;
  --rh-muted: #64748b;
  --rh-border: #e2e8f0;

  position: fixed !important;
  bottom: 20px;
  z-index: 999999;
  font-family: "Plus Jakarta Sans", ui-sans-serif, system-ui, -apple-system, sans-serif;
  color: var(--rh-text);
  text-align: left;
  line-height: 1.5;
}
.realtyzhub-chatbot * {
  box-sizing: border-box;
}
.realtyzhub-chatbot--bottom-right {
  right: 20px;
}
.realtyzhub-chatbot--bottom-left {
  left: 20px;
}

.realtyzhub-chatbot-launcher {
  position: relative;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: none !important;
  background: var(--rh-chat-accent, var(--rh-accent)) !important;
  color: #ffffff !important;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px -2px rgba(15, 23, 42, 0.28);
  cursor: pointer;
  outline: none !important;
  transition: transform 0.15s ease;
}
.realtyzhub-chatbot-launcher:hover {
  transform: scale(1.06);
}
.realtyzhub-chatbot-launcher svg {
  width: 26px;
  height: 26px;
}
.realtyzhub-chatbot-icon-close {
  display: none;
}
.realtyzhub-chatbot.is-open .realtyzhub-chatbot-icon-chat {
  display: none;
}
.realtyzhub-chatbot.is-open .realtyzhub-chatbot-icon-close {
  display: block;
}

/* A one-shot (not looping) attention ring -- JS adds this class ~4s after load if the panel
   hasn't been opened yet, and removes it the moment it is opened. */
.realtyzhub-chatbot--attention .realtyzhub-chatbot-launcher::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid var(--rh-chat-accent, var(--rh-accent));
  animation: realtyzhub-chatbot-pulse 1.6s ease-out 3;
}
@keyframes realtyzhub-chatbot-pulse {
  0% { transform: scale(1); opacity: 0.7; }
  100% { transform: scale(1.6); opacity: 0; }
}

.realtyzhub-chatbot-panel {
  position: absolute;
  bottom: 72px;
  width: 380px;
  max-width: calc(100vw - 40px);
  height: 560px;
  max-height: calc(100vh - 140px);
  background: #ffffff;
  border: 1px solid var(--rh-border);
  border-radius: 18px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 16px 40px -8px rgba(15, 23, 42, 0.22);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px) scale(0.98);
  transition: opacity 0.15s ease, transform 0.15s ease;
}
.realtyzhub-chatbot--bottom-right .realtyzhub-chatbot-panel {
  right: 0;
}
.realtyzhub-chatbot--bottom-left .realtyzhub-chatbot-panel {
  left: 0;
}
.realtyzhub-chatbot.is-open .realtyzhub-chatbot-panel {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.realtyzhub-chatbot-header {
  flex-shrink: 0;
  padding: 12px 14px;
  background: var(--rh-chat-accent, var(--rh-accent)) !important;
  color: #ffffff !important;
  display: flex;
  align-items: center;
  gap: 10px;
}
.realtyzhub-chatbot-header-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.realtyzhub-chatbot-header-avatar svg {
  width: 19px;
  height: 19px;
  color: #ffffff;
}
.realtyzhub-chatbot-header-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.realtyzhub-chatbot-name {
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.realtyzhub-chatbot-status {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 500;
  opacity: 0.88;
}
.realtyzhub-chatbot-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #4ade80;
  flex-shrink: 0;
}
.realtyzhub-chatbot-close {
  border: none !important;
  background: transparent !important;
  color: #ffffff !important;
  cursor: pointer;
  outline: none !important;
  padding: 4px;
  display: flex;
  opacity: 0.9;
  flex-shrink: 0;
}
.realtyzhub-chatbot-close:hover {
  opacity: 1;
}
.realtyzhub-chatbot-close svg {
  width: 18px;
  height: 18px;
}

.realtyzhub-chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #f8fafc;
}

.realtyzhub-chatbot-message {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  max-width: 88%;
}
.realtyzhub-chatbot-message--model {
  align-self: flex-start;
}
.realtyzhub-chatbot-message--user {
  align-self: flex-end;
}
.realtyzhub-chatbot-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--rh-chat-accent, var(--rh-accent));
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.realtyzhub-chatbot-avatar svg {
  width: 14px;
  height: 14px;
}
.realtyzhub-chatbot-col {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.realtyzhub-chatbot-message--user .realtyzhub-chatbot-col {
  align-items: flex-end;
}
.realtyzhub-chatbot-bubble {
  padding: 10px 13px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.55;
  word-break: break-word;
}
.realtyzhub-chatbot-bubble a {
  color: inherit;
  text-decoration: underline;
}
.realtyzhub-chatbot-message--model .realtyzhub-chatbot-bubble {
  background: #ffffff;
  border: 1px solid var(--rh-border);
  color: var(--rh-text);
  border-bottom-left-radius: 4px;
}
.realtyzhub-chatbot-message--user .realtyzhub-chatbot-bubble {
  background: var(--rh-chat-accent, var(--rh-accent));
  color: #ffffff;
  border-bottom-right-radius: 4px;
}
.realtyzhub-chatbot-time {
  font-size: 10px;
  color: var(--rh-muted);
  margin-top: 3px;
  padding: 0 3px;
}

.realtyzhub-chatbot-chips {
  flex-shrink: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 16px 12px;
  background: #f8fafc;
}
.realtyzhub-chatbot-chip {
  border: 1px solid var(--rh-chat-accent, var(--rh-accent)) !important;
  background: #ffffff !important;
  color: var(--rh-chat-accent, var(--rh-accent)) !important;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  outline: none !important;
  transition: background 0.15s ease, color 0.15s ease;
}
.realtyzhub-chatbot-chip:hover {
  background: var(--rh-chat-accent, var(--rh-accent)) !important;
  color: #ffffff !important;
}

.realtyzhub-chatbot-typing {
  flex-shrink: 0;
  padding: 0 16px 10px;
  background: #f8fafc;
  align-items: center;
  gap: 4px;
}
.realtyzhub-chatbot-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--rh-muted);
  opacity: 0.5;
  animation: realtyzhub-chatbot-bounce 1.2s infinite ease-in-out;
}
.realtyzhub-chatbot-typing span:nth-child(2) {
  animation-delay: 0.15s;
}
.realtyzhub-chatbot-typing span:nth-child(3) {
  animation-delay: 0.3s;
}
@keyframes realtyzhub-chatbot-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-4px); opacity: 1; }
}

.realtyzhub-chatbot-form {
  flex-shrink: 0;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid var(--rh-border);
  background: #ffffff;
}
.realtyzhub-chatbot-input {
  flex: 1;
  border: 1px solid var(--rh-border) !important;
  background: #f8fafc !important;
  color: var(--rh-text) !important;
  border-radius: 14px;
  padding: 10px 12px;
  font-size: 13px;
  font-family: inherit;
  outline: none !important;
  resize: none;
  max-height: 110px;
  overflow-y: auto;
  line-height: 1.4;
}
.realtyzhub-chatbot-input:focus {
  border-color: var(--rh-chat-accent, var(--rh-accent)) !important;
}
.realtyzhub-chatbot-send {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: none !important;
  background: var(--rh-chat-accent, var(--rh-accent)) !important;
  color: #ffffff !important;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  outline: none !important;
}
.realtyzhub-chatbot-send svg {
  width: 17px;
  height: 17px;
}

.realtyzhub-chatbot-footer {
  flex-shrink: 0;
  text-align: center;
  font-size: 10px;
  color: var(--rh-muted);
  padding: 6px 0 9px;
  background: #ffffff;
}

@media (max-width: 480px) {
  .realtyzhub-chatbot-panel {
    position: fixed;
    top: 16px;
    bottom: 16px;
    left: 12px;
    right: 12px;
    width: auto;
    max-width: none;
    height: auto;
    max-height: none;
    border-radius: 20px;
  }
  .realtyzhub-chatbot--bottom-right,
  .realtyzhub-chatbot--bottom-left {
    right: 16px;
    left: auto;
    bottom: 16px;
  }
}
