/* =========================================================
   Catalog wide banner after 2 rows
   Маленькие рекламные карточки теперь делаются в Elementor.
   ========================================================= */

/* ВАЖНО: баннер «три девушки» в каталоге — это ИМЕННО этот клон
   `.uz-catalog-wide-banner` (img banner-bt.webp), НЕ инжектнутый
   `.uz-catalog-ad-listing-item`. У клона нет `.elementor-widget-container`,
   а у виджета `.uz-mobile-after-listing-banner` есть padding-top:20px →
   плашку «Реклама» крепим к `<a>` (он точно облегает картинку), иначе бейдж
   вылезает над картинкой. Проверять скрином на нужном элементе (feh-qa/probe.mjs). */

/* Клон большого баннера внутри JetEngine Listing Grid */
#models_filter .uz-catalog-wide-banner {
  grid-column: 1 / -1 !important;
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  display: block !important;
}

#models_filter .uz-catalog-wide-banner > * {
  width: 100% !important;
  max-width: 100% !important;
}

#models_filter .uz-catalog-wide-banner .uz-mobile-after-listing-banner,
#models_filter .uz-catalog-wide-banner .uz-catalog-banner-clone {
  width: 100% !important;
  max-width: 100% !important;
  display: block !important;
}

#models_filter .uz-catalog-wide-banner img {
  width: 100% !important;
  max-width: 100% !important;
  height: auto !important;
  display: block !important;
}

/* Скрываем исходный Elementor-баннер, когда JS уже сделал клон внутри сетки */
body:not(.elementor-editor-active) .uz-catalog-banner-source-hidden {
  display: none !important;
}

/* В редакторе Elementor исходный баннер лучше видеть */
body.elementor-editor-active .uz-catalog-banner-source-hidden {
  display: block !important;
}

/* Чтобы баннер не слипался с карточками */
#models_filter .uz-catalog-wide-banner {
  margin-top: 0 !important;
  margin-bottom: 0 !important;
}

@media (max-width: 767px) {
  #models_filter .uz-catalog-wide-banner {
    grid-column: 1 / -1 !important;
  }
}



/* Баннер-карточка внутри Listing Grid */
.uz-listing-ad-card {
  width: 100%;
  height: 100%;
  min-height: 490px;
  border-radius: 16px;
  overflow: hidden;
  background: #111;
}

.uz-listing-ad-card .elementor-widget-image,
.uz-listing-ad-card .elementor-widget-container,
.uz-listing-ad-card a {
  width: 100%;
  height: 100%;
  display: block;
}

.uz-listing-ad-card img {
  width: 100%;
  height: 100%;
  min-height: 490px;
  object-fit: cover;
  object-position: center center;
  display: block;
}






/* Большой баннер внутри каталога */
.uz-catalog-wide-banner {
  position: relative !important;
}

/* Плашка "Реклама" — крепим к САМОМУ виджету-картинке клона
   (`.uz-mobile-after-listing-banner`), а НЕ к grid-item.
   У клона нет `.elementor-widget-container`, а grid-item бывает выше картинки
   (картинка смещается вниз) — из-за этого прежний `.uz-catalog-wide-banner::before`
   висел в пустоте НАД картинкой. Заставляем виджет облегать картинку и сажаем
   бейдж на неё. */
.uz-catalog-wide-banner .uz-mobile-after-listing-banner {
  position: relative !important;
  height: auto !important;
  align-self: flex-start !important;
}
.uz-catalog-wide-banner .uz-mobile-after-listing-banner a {
  position: relative !important;   /* badge host — <a> hugs the image exactly */
  height: auto !important;
  display: block;
  font-size: 0;
  line-height: 0;
}
.uz-catalog-wide-banner .uz-mobile-after-listing-banner img {
  height: auto !important;
  display: block;
}
/* pin the badge to the <a> (== image box), NOT the widget: the widget has a
   20px padding-top that pushed the badge above the image (half sticking out). */
.uz-catalog-wide-banner .uz-mobile-after-listing-banner a::before {
  content: "Реклама";
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 20;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  min-height: 24px;
  padding: 5px 12px;

  border-radius: 999px;
  background: #e10067;
  color: #fff;

  font-size: 13px;
  font-weight: 700;
  line-height: 1;

  pointer-events: none;
}

/* чтобы плашка не обрезалась и была поверх картинки */
.uz-catalog-wide-banner .uz-mobile-after-listing-banner,
.uz-catalog-wide-banner .elementor-widget-container,
.uz-catalog-wide-banner img {
  position: relative;
  z-index: 1;
}