/* RE/MAX Rex chat widget — complements existing theme */
/* Ensure chat widget styles override main theme */

.remaxrex-chat,
.remaxrex-chat *,
.remaxrex-chat *::before,
.remaxrex-chat *::after {
  box-sizing: border-box;
}

.remaxrex-chat {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 99999;
  font-family: 'Open Sans', sans-serif;
  color: #252122 !important;
}

.remaxrex-chat-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border: 0;
  border-radius: 999px;
  padding: 0.85rem 1.1rem;
  background: #e31837; /* RE/MAX red */
  color: #fff;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(227, 24, 55, 0.3);
  font-size: 0.95rem;
  font-weight: 600;
}

.remaxrex-chat-toggle:hover {
  background: #c41230;
}

.remaxrex-chat-panel {
  position: absolute;
  right: 0;
  bottom: calc(100% + 0.75rem);
  width: min(22rem, calc(100vw - 2rem));
  height: 28rem;
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid rgba(227, 24, 55, 0.12);
  border-radius: 1rem;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.18);
  overflow: hidden;
}

.remaxrex-chat-header {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem;
  background: #e31837; /* RE/MAX red */
  color: #fff;
}

.remaxrex-chat-header p {
  margin: 0.25rem 0 0;
  font-size: 0.8rem;
  opacity: 0.85;
  line-height: 1.4;
}

.remaxrex-chat-close {
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

.remaxrex-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  background: #fafafa;
}

.remaxrex-chat-message {
  max-width: 90%;
  margin-bottom: 0.75rem;
  padding: 0.65rem 0.85rem;
  border-radius: 0.85rem;
  line-height: 1.45;
  font-size: 0.92rem;
  white-space: pre-wrap;
  word-break: break-word;
  color: #252122 !important;
}

.remaxrex-chat-message-user {
  margin-left: auto;
  background: #e31837;
  color: #fff !important;
}

.remaxrex-chat-message-assistant {
  background: #fff;
  border: 1px solid rgba(227, 24, 55, 0.12);
  color: #252122 !important;
}

.remaxrex-chat-thinking {
  display: flex;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: #fafafa;
}

.remaxrex-chat-thinking-dot {
  width: 8px;
  height: 8px;
  background: #e31837;
  border-radius: 50%;
  animation: remaxrex-thinking-blink 1.4s infinite ease-in-out both;
}

.remaxrex-chat-thinking-dot:nth-child(1) {
  animation-delay: -0.32s;
}

.remaxrex-chat-thinking-dot:nth-child(2) {
  animation-delay: -0.16s;
}

@keyframes remaxrex-thinking-blink {
  0%, 80%, 100% {
    transform: scale(0);
    opacity: 0.5;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

.remaxrex-chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0 1rem 0.75rem;
  background: #fafafa;
}

.remaxrex-chat-suggestion {
  border: 1px solid rgba(227, 24, 55, 0.15);
  background: #fff;
  color: #252122 !important;
  border-radius: 999px;
  padding: 0.35rem 0.65rem;
  font-size: 0.75rem;
  cursor: pointer;
}

.remaxrex-chat-suggestion:hover {
  background: #f0f0f0;
}

.remaxrex-chat-form {
  display: flex;
  gap: 0.5rem;
  padding: 0.85rem;
  border-top: 1px solid rgba(227, 24, 55, 0.12);
  background: #fff;
}

.remaxrex-chat-input {
  flex: 1;
  border: 1px solid rgba(227, 24, 55, 0.18);
  border-radius: 0.65rem;
  padding: 0.65rem 0.75rem;
  font: inherit;
}

.remaxrex-chat-send {
  border: 0;
  border-radius: 0.65rem;
  padding: 0.65rem 0.9rem;
  background: #e31837;
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.remaxrex-chat-send:disabled,
.remaxrex-chat-input:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

@media (max-width: 480px) {
  .remaxrex-chat-toggle-label {
    display: none;
  }

  .remaxrex-chat-panel {
    width: calc(100vw - 2rem);
    height: 70vh;
  }
}
