.estate-ad-slot {
  margin: 1.5rem 0;
}

.estate-ad-loading .estate-ad-placeholder {
  opacity: .7;
}

.estate-ad-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  border: 1px solid rgba(47, 125, 94, .18);
  border-radius: 18px;
  background: linear-gradient(135deg, #f6fbf8 0%, #ffffff 72%);
  box-shadow: 0 10px 26px rgba(27, 72, 54, .08);
  padding: 1.1rem 1.25rem;
  color: #173b2d;
}

.estate-ad-main {
  min-width: 0;
  flex: 1 1 auto;
}

.estate-ad-brandline {
  display: flex;
  align-items: center;
  gap: .55rem;
  margin-bottom: .45rem;
}

.estate-ad-logo {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  object-fit: cover;
  background: #e8f4ed;
}

.estate-ad-logo-placeholder {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--estate-primary);
  font-size: .78rem;
  font-weight: 700;
}

.estate-ad-sponsored {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: #e8f4ed;
  color: var(--estate-primary);
  font-size: .78rem;
  font-weight: 700;
  padding: .18rem .55rem;
}

.estate-ad-title {
  margin: 0;
  font-size: 1.08rem;
  line-height: 1.25;
  color: #143629;
}

.estate-ad-subtitle,
.estate-ad-body {
  margin: .32rem 0 0;
  color: #52645b;
  line-height: 1.4;
}

.estate-ad-cta {
  display: inline-flex;
  margin-top: .75rem;
  border-radius: 999px;
  background: var(--estate-primary);
  color: #fff !important;
  text-decoration: none;
  font-weight: 700;
  padding: .52rem .95rem;
}

.estate-ad-media {
  flex: 0 0 170px;
  max-width: 170px;
}

.estate-ad-media img {
  display: block;
  width: 100%;
  height: 96px;
  object-fit: cover;
  border-radius: 14px;
}

@media (max-width: 760px) {
  .estate-ad-card {
    align-items: flex-start;
    flex-direction: column;
  }
  .estate-ad-media {
    max-width: none;
    width: 100%;
  }
  .estate-ad-media img {
    height: 140px;
  }
}

/* Hotfix 1.2.95: map_ad floating placement for the public map. */
.estate-map-ad-slot {
  position: absolute;
  right: 2.1rem;
  bottom: 2.1rem;
  z-index: 8;
  margin: 0;
  width: min(420px, calc(100% - 2rem));
  pointer-events: none;
}

.estate-map-ad-slot.estate-ad-empty,
.estate-map-ad-slot.estate-ad-error,
.estate-map-ad-slot.estate-ad-closed {
  display: none;
}

.estate-map-ad-placeholder {
  display: none;
}

.estate-map-ad-overlay {
  position: relative;
  pointer-events: none;
}

.estate-map-ad-card {
  position: relative;
  pointer-events: auto;
  border: 1px solid rgba(47, 125, 94, .16);
  border-radius: 20px;
  background: rgba(255, 255, 255, .96);
  box-shadow: 0 18px 40px rgba(15, 23, 42, .18);
  padding: 1rem 1rem 1.05rem;
  backdrop-filter: blur(10px);
}

.estate-map-ad-sponsored {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: #e8f4ed;
  color: var(--estate-primary);
  font-size: .76rem;
  font-weight: 800;
  padding: .18rem .62rem;
  margin-bottom: .7rem;
}

.estate-ad-close {
  position: absolute;
  right: .82rem;
  top: .68rem;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #5b6b63;
  font-size: 1.45rem;
  line-height: 1;
  cursor: pointer;
}

.estate-ad-close:hover,
.estate-ad-close:focus {
  background: #eef5f1;
  color: #123b2b;
  outline: none;
}

.estate-map-ad-content {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 1rem;
  align-items: center;
}

.estate-map-ad-logo-wrap .estate-ad-logo {
  width: 88px;
  height: 88px;
  border-radius: 16px;
  border: 1px solid rgba(47, 125, 94, .18);
  background: #f5faf7;
  color: var(--estate-primary);
  font-size: 2.4rem;
}

.estate-map-ad-logo-wrap .estate-ad-logo-placeholder {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.estate-map-ad-title {
  margin: 0;
  color: #142336;
  font-size: 1.16rem;
  line-height: 1.22;
  font-weight: 850;
}

.estate-map-ad-subtitle,
.estate-map-ad-body {
  margin: .34rem 0 0;
  color: #536575;
  line-height: 1.38;
  font-size: .9rem;
}

.estate-map-ad-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: .78rem;
  min-width: 176px;
  border-radius: 10px;
  background: var(--estate-primary);
  color: #fff !important;
  text-decoration: none;
  font-weight: 850;
  padding: .62rem 1.1rem;
}

.estate-map-ad-cta:hover,
.estate-map-ad-cta:focus {
  background: var(--estate-primary-dark);
  text-decoration: none;
}

.estate-map-ad-partner-pin {
  position: absolute;
  right: calc(100% + 5.2rem);
  bottom: calc(100% + 4.1rem);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .28rem;
  filter: drop-shadow(0 8px 18px rgba(15, 23, 42, .22));
}

.estate-map-ad-pin-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: #fff;
  color: var(--estate-primary);
  font-size: 1.35rem;
  font-weight: 800;
}

.estate-map-ad-pin-label {
  border-radius: 8px;
  background: #fff;
  color: #1f2937;
  font-size: .78rem;
  font-weight: 800;
  padding: .22rem .48rem;
}

.estate-map-ad-partner-pin::after {
  content: "";
  position: absolute;
  left: calc(100% + .2rem);
  top: 56px;
  width: 82px;
  height: 38px;
  border-bottom: 2px dashed rgba(33, 117, 90, .55);
  border-right: 2px dashed rgba(33, 117, 90, .55);
  transform: rotate(14deg);
  border-radius: 0 0 18px 0;
}

@media (max-width: 980px) {
  .estate-map-ad-slot {
    left: 1rem;
    right: 1rem;
    bottom: 1rem;
    width: auto;
  }

  .estate-map-ad-partner-pin {
    display: none;
  }
}

@media (max-width: 640px) {
  .estate-map-ad-content {
    grid-template-columns: 62px minmax(0, 1fr);
    gap: .75rem;
  }

  .estate-map-ad-logo-wrap .estate-ad-logo {
    width: 62px;
    height: 62px;
    border-radius: 14px;
    font-size: 1.75rem;
  }

  .estate-map-ad-title {
    font-size: 1rem;
  }

  .estate-map-ad-body {
    display: none;
  }

  .estate-map-ad-cta {
    min-width: 0;
    padding: .52rem .9rem;
  }
}

/* Hotfix 1.2.97: geo-positioned map_ad partner markers with SVG stickers. */
.estate-map-ad-location-marker {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: .25rem;
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
  filter: drop-shadow(0 8px 18px rgba(15, 23, 42, .24));
}

.estate-map-ad-location-marker-inner {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: #fff;
  color: var(--estate-primary);
  font-size: 1.25rem;
  font-weight: 850;
  overflow: hidden;
}

.estate-map-ad-location-marker-inner img {
  display: block;
  width: 32px;
  height: 32px;
  object-fit: contain;
}

.estate-map-ad-location-marker-label {
  display: inline-flex;
  border-radius: 999px;
  background: #fff;
  color: #1f2937;
  font-size: .76rem;
  font-weight: 850;
  line-height: 1;
  padding: .28rem .52rem;
  white-space: nowrap;
}

.estate-map-ad-location-marker:hover .estate-map-ad-location-marker-inner,
.estate-map-ad-location-marker:focus .estate-map-ad-location-marker-inner {
  outline: 3px solid rgba(33, 117, 90, .25);
}


/* Hotfix 1.3.0: first sponsored partner card in the map object list. */
.estate-map-list-ad-slot {
  margin: 0;
}

.estate-map-list-ad-slot.estate-ad-empty,
.estate-map-list-ad-slot.estate-ad-error,
.estate-map-list-ad-slot.estate-ad-closed {
  display: none !important;
}

.estate-map-list-ad-card {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  gap: .9rem;
  align-items: center;
  border: 1px solid rgba(47, 125, 94, .20);
  border-radius: 18px;
  background: linear-gradient(135deg, #f4fbf7 0%, #ffffff 74%);
  box-shadow: 0 10px 26px rgba(15, 23, 42, .08);
  padding: .75rem .85rem;
  color: #173b2d;
}

.estate-map-list-ad-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
}

.estate-map-list-ad-logo .estate-ad-logo {
  width: 58px;
  height: 58px;
  border-radius: 14px;
  border: 1px solid rgba(47, 125, 94, .18);
  background: #f5faf7;
  color: var(--estate-primary);
  font-size: 1.85rem;
}

.estate-map-list-ad-text {
  min-width: 0;
}

.estate-map-list-ad-meta {
  display: flex;
  flex-wrap: wrap;
  gap: .38rem;
  align-items: center;
  margin-bottom: .3rem;
}

.estate-map-list-ad-sponsored {
  border-radius: 999px;
  background: #e8f4ed;
  color: var(--estate-primary);
  font-size: .68rem;
  font-weight: 850;
  padding: .17rem .5rem;
}

.estate-map-list-ad-partner {
  color: #547064;
  font-size: .76rem;
  font-weight: 750;
}

.estate-map-list-ad-title {
  margin: 0;
  color: #142336;
  font-size: .98rem;
  line-height: 1.2;
  font-weight: 850;
}

.estate-map-list-ad-subtitle,
.estate-map-list-ad-body {
  margin: .25rem 0 0;
  color: #52645b;
  font-size: .82rem;
  line-height: 1.32;
}

.estate-map-list-ad-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: .55rem;
  border: 1px solid rgba(47, 125, 94, .22);
  border-radius: 8px;
  background: #eef8f3;
  color: var(--estate-primary) !important;
  text-decoration: none;
  font-size: .82rem;
  font-weight: 850;
  padding: .36rem .72rem;
}

.estate-map-list-ad-cta:hover,
.estate-map-list-ad-cta:focus {
  background: var(--estate-primary);
  color: #fff !important;
  text-decoration: none;
}

@media (max-width: 420px) {
  .estate-map-list-ad-card {
    grid-template-columns: 64px minmax(0, 1fr);
    padding: .7rem;
  }

  .estate-map-list-ad-logo .estate-ad-logo {
    width: 50px;
    height: 50px;
  }
}

/* Hotfix 1.3.40: selected map ad marker is visually linked to the visible ad box. */
.estate-map-ad-location-marker-active .estate-map-ad-location-marker-inner,
.estate-map-ad-location-marker-active:focus .estate-map-ad-location-marker-inner {
    transform: translateY(-2px) scale(1.08);
    box-shadow: 0 0 0 4px rgba(15, 107, 82, 0.18), 0 12px 30px rgba(15, 23, 42, 0.24);
}

/* Hotfix 1.3.42: bind map_ad pins and boxes with explicit click behavior. */
.estate-map-ad-partner-pin {
  display: none !important;
}

.estate-map-ad-card {
  cursor: pointer;
}

.estate-map-ad-card:focus {
  outline: 3px solid rgba(33, 117, 90, .28);
  outline-offset: 3px;
}

.estate-map-ad-card .estate-map-ad-cta,
.estate-map-ad-card .estate-ad-close {
  cursor: pointer;
}

.estate-map-ad-location-marker-active .estate-map-ad-location-marker-inner,
.estate-map-ad-location-marker.is-active .estate-map-ad-location-marker-inner,
.estate-map-ad-location-marker-active:focus .estate-map-ad-location-marker-inner,
.estate-map-ad-location-marker.is-active:focus .estate-map-ad-location-marker-inner {
  outline: 4px solid rgba(33, 117, 90, .30);
  box-shadow: 0 0 0 6px rgba(33, 117, 90, .12);
  transform: scale(1.08);
}

.estate-map-ad-location-marker-active .estate-map-ad-location-marker-label,
.estate-map-ad-location-marker.is-active .estate-map-ad-location-marker-label {
  background: var(--estate-primary);
  color: #fff;
}

.estate-map-ad-marker-selected .estate-map-ad-card {
  border-color: rgba(33, 117, 90, .34);
}


/* Hotfix 1.3.44: make map_ad partner pins unambiguous and distinct from property markers. */
.estate-map-ad-location-marker {
  z-index: 30;
}

.estate-map-ad-location-marker-inner {
  position: relative;
  width: 50px;
  height: 38px;
  border: 2px solid #fff;
  border-radius: 14px;
  background: #123b2b;
  color: #fff;
  font-size: .78rem;
  font-weight: 900;
  letter-spacing: .04em;
  line-height: 34px;
  text-align: center;
  box-shadow: 0 10px 26px rgba(15, 23, 42, .26);
}

.estate-map-ad-location-marker-inner::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -8px;
  width: 14px;
  height: 14px;
  margin-left: -7px;
  background: #123b2b;
  border-right: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(45deg);
}

.estate-map-ad-location-marker-inner img {
  display: none !important;
}

.estate-map-ad-location-marker-label {
  margin-top: .42rem;
  background: #123b2b;
  color: #fff;
}

.estate-map-ad-location-marker-active .estate-map-ad-location-marker-inner,
.estate-map-ad-location-marker.is-active .estate-map-ad-location-marker-inner,
.estate-map-ad-location-marker-active:focus .estate-map-ad-location-marker-inner,
.estate-map-ad-location-marker.is-active:focus .estate-map-ad-location-marker-inner {
  outline: 4px solid rgba(18, 59, 43, .22);
  box-shadow: 0 0 0 7px rgba(18, 59, 43, .12), 0 16px 32px rgba(15, 23, 42, .28);
  transform: translateY(-2px) scale(1.06);
}

/* Hotfix 1.3.45: render dynamic backend SVG marker pins through the public marker API. */
.estate-map-ad-location-marker-has-svg .estate-map-ad-location-marker-inner {
  width: 52px;
  height: 64px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  line-height: 1;
  overflow: visible;
  box-shadow: none;
}

.estate-map-ad-location-marker-has-svg .estate-map-ad-location-marker-inner::after {
  display: none;
}

.estate-map-ad-location-marker-has-svg .estate-map-ad-location-marker-inner img {
  display: block !important;
  width: 52px;
  height: 64px;
  object-fit: contain;
}


/* Hotfix 1.4.8: package-aware public ad suppression for PLUS/paid users. */
.estate-ad-disabled,
.estate-ad-slot.estate-ad-disabled,
.estate-home-ad-card.estate-ad-disabled,
[data-estate-frontend-ad].estate-ad-disabled {
  display: none !important;
}


/* Hotfix 1.6.0.4: mobile map workspace compatibility. */
.estate-map-ad-card .estate-ad-close {
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

@media (max-width: 56.25rem), (hover: none) and (pointer: coarse) {
  .estate-map-ad-slot {
    right: max(.75rem, env(safe-area-inset-right));
    left: max(.75rem, env(safe-area-inset-left));
    bottom: calc(max(.75rem, env(safe-area-inset-bottom)) + 4.5rem);
    width: auto;
    max-width: none;
  }

  [data-map-workspace-panel]:not([data-map-workspace-panel=""]) .estate-map-ad-slot,
  .re-map-app[data-map-workspace-panel]:not([data-map-workspace-panel=""]) .estate-map-ad-slot {
    display: none;
  }

  .estate-map-ad-card {
    max-height: min(38dvh, 18rem);
    overflow: auto;
    overscroll-behavior: contain;
    border-radius: 1rem;
    padding-right: 3.5rem;
  }
}


/* Hotfix 1.6.0.5: hardened map advertisement interaction and mobile layout. */
:root {
  --estate-z-map-ad: 400;
  --estate-map-touch-target: 44px;
}

.estate-map-ad-slot {
  z-index: var(--estate-z-map-ad);
}

.estate-map-ad-card .estate-ad-close {
  width: var(--estate-map-touch-target);
  height: var(--estate-map-touch-target);
  min-width: var(--estate-map-touch-target);
  min-height: var(--estate-map-touch-target);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
}

@media (max-width: 56.25rem), (hover: none) and (pointer: coarse) {
  .estate-map-ad-slot {
    left: max(.65rem, env(safe-area-inset-left));
    right: max(.65rem, env(safe-area-inset-right));
    bottom: calc(max(.65rem, env(safe-area-inset-bottom)) + 4.85rem);
    width: auto;
    max-width: none;
  }

  .estate-map-ad-card {
    max-height: min(36dvh, 16rem);
    overflow: auto;
    overscroll-behavior: contain;
    padding: .7rem 3.35rem .7rem .7rem;
    border-radius: 1rem;
  }

  .estate-map-ad-content {
    grid-template-columns: 56px minmax(0, 1fr);
    gap: .7rem;
    align-items: center;
  }

  .estate-map-ad-logo-wrap .estate-ad-logo,
  .estate-map-ad-logo-wrap .estate-ad-logo-placeholder {
    width: 56px;
    height: 56px;
  }

  .estate-map-ad-title {
    font-size: .95rem;
    line-height: 1.15;
  }

  .estate-map-ad-subtitle,
  .estate-map-ad-body {
    margin-top: .2rem;
    font-size: .8rem;
    line-height: 1.3;
  }

  .estate-map-ad-cta {
    min-height: 40px;
    margin-top: .45rem;
    padding: .55rem .7rem;
  }

  .estate-map-ad-card .estate-ad-close {
    top: .25rem;
    right: .25rem;
  }
}

/* Keep the advertisement visible while it is the active workspace panel. */
@media (max-width: 56.25rem), (hover: none) and (pointer: coarse) {
  .re-map-app[data-map-workspace-panel="advertisement"] .estate-map-ad-slot:not(.estate-ad-closed),
  [data-map-workspace-panel="advertisement"] .estate-map-ad-slot:not(.estate-ad-closed) {
    display: block;
  }
}
