.real-estate-chatbot {
  --chatbot-blue: #12365a;
  --chatbot-green: #689f38;
  --chatbot-muted: #687783;
  position: relative;
  z-index: 1080;
}

#scrollUp {
  display: none !important;
}

.chatbot-launcher {
  align-items: center;
  background: var(--chatbot-blue);
  border: 0;
  border-radius: 999px;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 8px 24px rgba(8, 18, 49, .24);
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  font-size: 13px;
  font-weight: 700;
  gap: 9px;
  min-height: 52px;
  padding: 0 18px;
  position: fixed;
  right: calc(20px + env(safe-area-inset-right, 0px));
  transition: background-color .2s ease, transform .2s ease;
}

.chatbot-launcher[hidden] {
  display: none;
}

.chatbot-launcher:hover,
.chatbot-launcher:focus-visible {
  background: #1b4b76;
  color: #fff;
  transform: translateY(-2px);
}

.chatbot-launcher:focus-visible,
.chatbot-close:focus-visible,
.chatbot-option:focus-visible,
.chatbot-input-form button:focus-visible,
.chatbot-advisor-link:focus-visible {
  outline: 3px solid rgba(139, 195, 74, .6);
  outline-offset: 3px;
}

.chatbot-launcher i {
  font-size: 18px;
}

.chatbot-panel {
  background: #fff;
  border: 1px solid #e0e8ed;
  border-radius: 16px;
  bottom: calc(84px + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 16px 48px rgba(8, 18, 49, .24);
  display: flex;
  flex-direction: column;
  height: min(590px, calc(100vh - 120px));
  height: min(590px, calc(100dvh - 120px));
  max-height: 590px;
  overflow: hidden;
  position: fixed;
  right: calc(20px + env(safe-area-inset-right, 0px));
  width: min(380px, calc(100vw - 32px));
}

.chatbot-panel[hidden] {
  display: none;
}

.chatbot-header {
  align-items: center;
  background: var(--chatbot-blue);
  color: #fff;
  display: flex;
  flex: 0 0 auto;
  gap: 11px;
  padding: 14px 16px;
}

.chatbot-header-icon {
  align-items: center;
  display: inline-flex;
  flex: 0 0 48px;
  height: 48px;
  justify-content: center;
}

.chatbot-header-icon img {
  height: 48px;
  object-fit: contain;
  width: 48px;
}

.chatbot-header > div {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 2px;
}

.chatbot-header strong {
  color: #fff;
  font-size: 14px;
}

.chatbot-header small {
  color: rgba(255, 255, 255, .78);
  font-size: 11px;
}

.chatbot-close {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 50%;
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  height: 34px;
  justify-content: center;
  width: 34px;
}

.chatbot-close:hover {
  background: rgba(255, 255, 255, .14);
}

.chatbot-messages {
  background: #f4f7f9;
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  overflow-y: auto;
  padding: 16px 14px;
  scroll-behavior: smooth;
}

.chatbot-message {
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.5;
  max-width: 90%;
  overflow-wrap: anywhere;
  padding: 10px 12px;
  white-space: pre-line;
}

.chatbot-message--assistant {
  align-self: flex-start;
  background: #fff;
  border: 1px solid #e5ebef;
  color: var(--chatbot-blue);
}

.chatbot-message--user {
  align-self: flex-end;
  background: var(--chatbot-blue);
  color: #fff;
}

.chatbot-options {
  background: #f4f7f9;
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  gap: 7px;
  max-height: 190px;
  overflow-y: auto;
  padding: 0 14px 12px;
}

.chatbot-property-result {
  align-items: center;
  background: #fff;
  border: 1px solid #e0e8ed;
  border-radius: 10px;
  color: var(--chatbot-blue);
  display: flex;
  flex: 1 0 100%;
  gap: 9px;
  min-width: 0;
  padding: 7px;
  text-decoration: none;
}

.chatbot-property-result:hover,
.chatbot-property-result:focus-visible {
  border-color: #9cbd7b;
  color: var(--chatbot-blue);
  text-decoration: none;
}

.chatbot-property-result img {
  background: #edf2f5;
  border-radius: 7px;
  flex: 0 0 58px;
  height: 46px;
  object-fit: cover;
  width: 58px;
}

.chatbot-property-result > span {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.chatbot-property-result strong,
.chatbot-property-result small {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
}

.chatbot-property-result strong {
  color: var(--chatbot-blue);
  font-size: 11px;
  line-height: 1.3;
  -webkit-line-clamp: 2;
}

.chatbot-property-result small {
  color: var(--chatbot-muted);
  font-size: 10px;
  line-height: 1.25;
  -webkit-line-clamp: 1;
}

.chatbot-option {
  background: #fff;
  border: 1px solid #9cbd7b;
  border-radius: 999px;
  color: var(--chatbot-blue);
  cursor: pointer;
  font-size: 11px;
  line-height: 1.3;
  padding: 7px 11px;
  transition: background-color .2s ease, color .2s ease;
}

.chatbot-option:hover {
  background: var(--chatbot-green);
  color: #fff;
}

.chatbot-property-whatsapp {
  align-items: center;
  background: #eaf6e9;
  border-color: #9bc78d;
  color: #247342;
  display: inline-flex;
  gap: 6px;
  margin: -2px 0 3px auto;
  text-decoration: none;
}

.chatbot-property-whatsapp i {
  font-size: 14px;
}

.chatbot-property-whatsapp:hover,
.chatbot-property-whatsapp:focus-visible {
  background: #25a85a;
  border-color: #25a85a;
  color: #fff;
  text-decoration: none;
}

.chatbot-input-form .chatbot-main-menu {
  align-items: center;
  background: linear-gradient(135deg, #ffca28, #ffb300);
  border: 1px solid #f0a900;
  border-radius: 50%;
  box-shadow: 0 3px 10px rgba(18, 54, 90, .18);
  color: #12365a;
  cursor: pointer;
  display: inline-flex;
  flex: 0 0 40px;
  height: 40px;
  justify-content: center;
  margin: 0;
  padding: 0;
  transition: background-color .2s ease, box-shadow .2s ease, transform .2s ease;
  width: 40px;
}

.chatbot-main-menu:hover,
.chatbot-main-menu:focus-visible {
  background: #ffd54f;
  box-shadow: 0 5px 14px rgba(18, 54, 90, .24);
  color: #12365a;
  transform: translateY(-1px);
}

.chatbot-main-menu:focus-visible {
  outline: 3px solid rgba(18, 54, 90, .35);
  outline-offset: 2px;
}

.chatbot-main-menu i {
  font-size: 16px;
}

.chatbot-input-form {
  align-items: center;
  border-top: 1px solid #e5ebef;
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
  padding: 10px 12px;
}

.chatbot-input-form input {
  background: #f4f7f9;
  border: 1px solid #e0e8ed;
  border-radius: 999px;
  color: var(--chatbot-blue);
  flex: 1;
  font-size: 13px;
  height: 40px;
  min-width: 0;
  padding: 0 14px;
}

.chatbot-input-form input:focus {
  border-color: var(--chatbot-green);
  outline: 2px solid rgba(104, 159, 56, .18);
}

.chatbot-input-form button {
  align-items: center;
  background: var(--chatbot-green);
  border: 0;
  border-radius: 50%;
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  flex: 0 0 40px;
  height: 40px;
  justify-content: center;
}

.chatbot-advisor-link {
  align-items: center;
  background: #f0f7e9;
  border-top: 1px solid #dfebd2;
  color: #365c1d;
  display: flex;
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 700;
  gap: 8px;
  justify-content: center;
  padding: 11px;
  text-decoration: none;
}

.chatbot-advisor-link:hover {
  background: #e4f0d8;
  color: #365c1d;
  text-decoration: none;
}

.chatbot-advisor-link i {
  color: #25a85a;
  font-size: 16px;
}

@media (max-width: 480px) {
  .chatbot-panel {
    bottom: calc(78px + env(safe-area-inset-bottom, 0px));
    height: min(590px, calc(100vh - 100px));
    height: min(590px, calc(100dvh - 100px));
    right: calc(12px + env(safe-area-inset-right, 0px));
    width: calc(100vw - 24px);
  }

  .chatbot-launcher {
    bottom: calc(14px + env(safe-area-inset-bottom, 0px));
    min-height: 48px;
    right: calc(12px + env(safe-area-inset-right, 0px));
  }
}

@media (prefers-reduced-motion: reduce) {
  .chatbot-launcher,
  .chatbot-messages {
    scroll-behavior: auto;
    transition: none;
  }
}
