.sabay-chat {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 1200;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #1f2933;
  --sabay-primary: #087f8c;
  --sabay-header: #0b5963;
  --sabay-accent: #e8f6f7;
}

.sabay-chat * {
  box-sizing: border-box;
}

.sabay-chat__button {
  width: 62px;
  height: 62px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--sabay-primary);
  color: #fff;
  box-shadow: 0 18px 45px rgba(8, 127, 140, .28);
  cursor: pointer;
  transition: transform .2s ease, box-shadow .2s ease;
  animation: sabayPulse 2.8s infinite ease-in-out;
  overflow: hidden;
}

.sabay-chat__button:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 22px 52px rgba(8, 127, 140, .36);
}

.sabay-chat__button svg {
  width: 28px;
  height: 28px;
}

.sabay-chat__button img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sabay-chat__button img + svg {
  display: none;
}

.sabay-chat__teaser {
  position: absolute;
  right: 74px;
  bottom: 9px;
  min-width: 210px;
  padding: 10px 12px;
  border: 1px solid rgba(31, 41, 51, .1);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 16px 38px rgba(17, 24, 39, .16);
  opacity: 1;
  transform: translateX(0);
  transition: opacity .2s ease, transform .2s ease;
}

.sabay-chat.is-open .sabay-chat__teaser {
  opacity: 0;
  transform: translateX(10px);
  pointer-events: none;
}

.sabay-chat__teaser strong,
.sabay-chat__teaser span {
  display: block;
}

.sabay-chat__teaser strong {
  font-size: 13px;
}

.sabay-chat__teaser span {
  margin-top: 2px;
  color: #52616b;
  font-size: 12px;
}

.sabay-chat__panel {
  position: absolute;
  right: 0;
  bottom: 76px;
  width: min(390px, calc(100vw - 28px));
  height: min(620px, calc(100vh - 112px));
  display: none;
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
  border: 1px solid rgba(31, 41, 51, .12);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(17, 24, 39, .24);
  transform-origin: right bottom;
  animation: sabayPanelIn .22s ease both;
}

.sabay-chat.is-open .sabay-chat__panel {
  display: grid;
}

.sabay-chat__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px;
  background: var(--sabay-header);
  color: #fff;
}

.sabay-chat__avatar {
  position: relative;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, .14);
  overflow: hidden;
}

.sabay-chat__avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sabay-chat__avatar b {
  font-size: 13px;
}

.sabay-chat__avatar span {
  position: absolute;
  right: 2px;
  bottom: 2px;
  width: 11px;
  height: 11px;
  border: 2px solid var(--sabay-header);
  border-radius: 50%;
  background: #25d366;
}

.sabay-chat__title {
  display: grid;
  gap: 2px;
  margin-right: auto;
}

.sabay-chat__title strong {
  font-size: 15px;
}

.sabay-chat__title span {
  color: rgba(255, 255, 255, .76);
  font-size: 12px;
}

.sabay-chat__close {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, .14);
  color: #fff;
  cursor: pointer;
}

.sabay-chat__messages {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  overflow-y: auto;
  background: linear-gradient(180deg, var(--sabay-accent), #f6f8f8 42%);
}

.sabay-chat__message {
  max-width: 86%;
  padding: 11px 13px;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.45;
  white-space: pre-wrap;
}

.sabay-chat__message--bot {
  align-self: flex-start;
  background: #fff;
  border: 1px solid rgba(31, 41, 51, .08);
  box-shadow: 0 8px 20px rgba(17, 24, 39, .04);
}

.sabay-chat__message--user {
  align-self: flex-end;
  background: var(--sabay-primary);
  color: #fff;
}

.sabay-chat__typing {
  width: fit-content;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #52616b;
}

.sabay-chat__typing-dots {
  display: inline-flex;
  gap: 4px;
}

.sabay-chat__typing-dots span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--sabay-primary);
  animation: sabayTyping 1s infinite ease-in-out;
}

.sabay-chat__typing-dots span:nth-child(2) {
  animation-delay: .15s;
}

.sabay-chat__typing-dots span:nth-child(3) {
  animation-delay: .3s;
}

@keyframes sabayTyping {
  0%, 80%, 100% {
    opacity: .35;
    transform: translateY(0);
  }

  40% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

.sabay-chat__quick {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.sabay-chat__chip {
  border: 1px solid rgba(8, 127, 140, .28);
  border-radius: 999px;
  padding: 8px 10px;
  background: #fff;
  color: var(--sabay-header);
  font-size: 12px;
  cursor: pointer;
  transition: transform .16s ease, background .16s ease;
}

.sabay-chat__chip:hover {
  transform: translateY(-1px);
  background: var(--sabay-accent);
}

.sabay-chat__results {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.sabay-chat__tour {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid rgba(8, 127, 140, .18);
  border-radius: 8px;
  background: #fff;
}

.sabay-chat__tour strong {
  font-size: 13px;
}

.sabay-chat__tour span {
  color: #52616b;
  font-size: 12px;
}

.sabay-chat__tour a {
  width: fit-content;
  color: var(--sabay-primary);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}

.sabay-chat__listing img {
  width: 100%;
  max-height: 130px;
  object-fit: cover;
  border-radius: 6px;
  background: #f1f5f5;
}

.sabay-chat__action-link {
  display: flex;
  width: fit-content;
  margin-top: 8px;
  border-radius: 8px;
  padding: 9px 11px;
  background: var(--sabay-primary);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}

.sabay-chat__more {
  width: 100%;
  margin: 8px 0 2px;
  border: 1px solid rgba(8, 127, 140, .28);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff;
  color: var(--sabay-header);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.sabay-chat__form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid rgba(31, 41, 51, .1);
  background: #fff;
}

.sabay-chat__input {
  min-width: 0;
  border: 1px solid rgba(31, 41, 51, .16);
  border-radius: 8px;
  padding: 12px;
  outline: 0;
  font-size: 14px;
}

.sabay-chat__input:focus {
  border-color: #087f8c;
  box-shadow: 0 0 0 3px rgba(8, 127, 140, .12);
}

.sabay-chat__send {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 8px;
  background: var(--sabay-primary);
  color: #fff;
  cursor: pointer;
}

.sabay-chat__send:disabled,
.sabay-chat__input:disabled {
  opacity: .58;
  cursor: wait;
}

/* Classified projects use a denser marketplace treatment. */
.sabay-chat--classifieds .sabay-chat__panel {
  width: min(420px, calc(100vw - 28px));
  border-color: rgba(25, 55, 43, .14);
  box-shadow: 0 26px 72px rgba(25, 55, 43, .22);
}

.sabay-chat--classifieds .sabay-chat__header {
  min-height: 76px;
  border-bottom: 3px solid var(--sabay-primary);
}

.sabay-chat--classifieds .sabay-chat__messages {
  background: #f4f7f5;
}

.sabay-chat--classifieds .sabay-chat__message--bot {
  border-color: rgba(25, 55, 43, .1);
}

.sabay-chat--classifieds .sabay-chat__message--bot:has(.sabay-chat__results) {
  width: 100%;
  max-width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.sabay-chat--classifieds .sabay-chat__results {
  gap: 10px;
  margin-top: 10px;
}

.sabay-chat--classifieds .sabay-chat__listing {
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(25, 55, 43, .13);
  background: #fff;
  box-shadow: 0 8px 24px rgba(25, 55, 43, .07);
  transition: border-color .18s ease, transform .18s ease, box-shadow .18s ease;
}

.sabay-chat--classifieds .sabay-chat__listing:hover {
  border-color: var(--sabay-primary);
  transform: translateY(-1px);
  box-shadow: 0 12px 28px rgba(25, 55, 43, .11);
}

.sabay-chat__listing-image {
  position: relative;
  min-height: 150px;
  overflow: hidden;
  background: #e7eee9;
}

.sabay-chat__listing-image img {
  width: 100%;
  height: 100%;
  max-height: none;
  object-fit: cover;
  border-radius: 0;
}

.sabay-chat__listing-image span {
  position: absolute;
  inset: 0;
  display: none;
  place-items: center;
  color: var(--sabay-header);
  font-size: 12px;
  font-weight: 700;
}

.sabay-chat__listing-image.is-empty span {
  display: grid;
}

.sabay-chat__listing-body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
  padding: 11px 12px;
}

.sabay-chat__listing-body strong {
  display: -webkit-box;
  overflow: hidden;
  font-size: 14px;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.sabay-chat__listing-category {
  color: var(--sabay-primary) !important;
  font-size: 10px !important;
  font-weight: 700;
  text-transform: uppercase;
}

.sabay-chat__listing-price {
  color: #19372b;
  font-size: 15px;
}

.sabay-chat__listing-location {
  display: flex;
  align-items: center;
  gap: 4px;
  color: #617069 !important;
}

.sabay-chat__listing-location svg {
  width: 13px;
  height: 13px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
}

.sabay-chat__listing-body p {
  display: -webkit-box;
  margin: 1px 0 0;
  overflow: hidden;
  color: #52615a;
  font-size: 11px;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.sabay-chat__listing-body a {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: auto;
}

.sabay-chat__listing-body a svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

@media (max-width: 380px) {
  .sabay-chat--classifieds .sabay-chat__listing {
    grid-template-columns: 96px minmax(0, 1fr);
  }

  .sabay-chat__listing-image {
    min-height: 142px;
  }
}

@media (max-width: 520px) {
  .sabay-chat {
    right: 14px;
    bottom: 14px;
  }

  .sabay-chat__panel {
    right: -7px;
    bottom: 72px;
  }

  .sabay-chat__teaser {
    display: none;
  }
}

@keyframes sabayPanelIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(.98);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes sabayPulse {
  0%, 100% {
    box-shadow: 0 18px 45px rgba(8, 127, 140, .28);
  }

  50% {
    box-shadow: 0 18px 45px rgba(8, 127, 140, .44);
  }
}
