/*
 * AT Category Flag
 * Full badge redesign with fixed sequence support in PHP:
 * discount -> wyprzedaz -> okazja -> nowosc
 */

.product-flags,
.js-product-flags {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  margin: 0 !important;
  padding: 0 !important;
  list-style: none !important;
  right: auto !important;
  bottom: auto !important;
  width: max-content;
  max-width: max-content;
}

/* Keep badge anchor consistent across listing cards. */
.thumbnail-container .product-flags,
.product-miniature .product-flags,
.thumbnail-container .js-product-flags,
.product-miniature .js-product-flags {
  left: 2px !important;
  top: 10px !important;
  right: auto !important;
  bottom: auto !important;
}

/* Product detail page has its own flag layout rules in theme CSS.
   Force a compact absolute badge stack so it never stretches over the image. */
.product-detail .images-container .product-cover > .product-flags,
.product-detail .images-container .product-cover > .js-product-flags {
  position: absolute !important;
  left: 2px !important;
  top: 10px !important;
  right: auto !important;
  bottom: auto !important;
  width: max-content !important;
  max-width: max-content !important;
  z-index: 100 !important;
  pointer-events: none;
}

/* PDP thumbs-left layout: thumb rail is 125px wide in custom CSS.
   Keep image layout untouched and offset only flags to the visible main image. */
.product-detail.product-thumbs-left .images-container .product-cover > .product-flags,
.product-detail.product-thumbs-left .images-container .product-cover > .js-product-flags {
  left: 127px !important;
}

.rtl .product-detail.product-thumbs-left .images-container .product-cover > .product-flags,
.rtl .product-detail.product-thumbs-left .images-container .product-cover > .js-product-flags {
  right: 127px !important;
  left: auto !important;
}

.product-flags .product-flag.discount,
.product-flags .product-flag.atcf-sale,
.product-flags .product-flag.atcf-category,
.product-flags .product-flag.new,
.js-product-flags .product-flag.discount,
.js-product-flags .product-flag.atcf-sale,
.js-product-flags .product-flag.atcf-category,
.js-product-flags .product-flag.new {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  min-width: 30px;
  width: auto;
  padding: 2px 8px 5px 7px !important;
  margin: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  color: #ffffff !important;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0;
  text-transform: none;
  box-shadow: none !important;
  white-space: nowrap;
  overflow: hidden;
}

.product-flags .product-flag.discount::before,
.product-flags .product-flag.atcf-sale::before,
.product-flags .product-flag.atcf-category::before,
.product-flags .product-flag.new::before,
.js-product-flags .product-flag.discount::before,
.js-product-flags .product-flag.atcf-sale::before,
.js-product-flags .product-flag.atcf-category::before,
.js-product-flags .product-flag.new::before {
  content: '';
  position: absolute;
  inset: 0;
  background-repeat: no-repeat;
  background-position: center;
  background-size: 100% 100%;
  z-index: -1;
}

.product-flags .product-flag.discount::before,
.js-product-flags .product-flag.discount::before {
  background-image: url('../img/badge-promo.svg');
}

.product-flags .product-flag.discount.atcf-discount--long,
.js-product-flags .product-flag.discount.atcf-discount--long {
  font-size: 11px;
  padding: 2px 8px 5px 7px !important;
}

.product-flags .product-flag.discount.atcf-discount--xlong,
.js-product-flags .product-flag.discount.atcf-discount--xlong {
  font-size: 10px;
  padding: 2px 8px 5px 7px !important;
}

.product-flags .product-flag.atcf-sale::before,
.js-product-flags .product-flag.atcf-sale::before {
  background-image: url('../img/badge-wyprzedaz.svg');
}

.product-flags .product-flag.atcf-category::before,
.js-product-flags .product-flag.atcf-category::before {
  background-image: url('../img/badge-okazja.svg');
}

.product-flags .product-flag.new::before,
.js-product-flags .product-flag.new::before {
  background-image: url('../img/badge-new.svg');
}

@media (max-width: 991px) {
  .product-flags,
  .js-product-flags {
    gap: 1px;
  }

  .thumbnail-container .product-flags,
  .product-miniature .product-flags,
  .thumbnail-container .js-product-flags,
  .product-miniature .js-product-flags {
    left: 2px !important;
    top: 10px !important;
    right: auto !important;
    bottom: auto !important;
  }

  .product-flags .product-flag.discount,
  .product-flags .product-flag.atcf-sale,
  .product-flags .product-flag.atcf-category,
  .product-flags .product-flag.new,
  .js-product-flags .product-flag.discount,
  .js-product-flags .product-flag.atcf-sale,
  .js-product-flags .product-flag.atcf-category,
  .js-product-flags .product-flag.new {
    font-size: 11px;
    min-height: 22px;
    min-width: 30px;
    padding: 2px 8px 5px 7px !important;
  }
}

@media (max-width: 575px) {
  .product-flags,
  .js-product-flags {
    gap: 1px;
  }

  .thumbnail-container .product-flags,
  .product-miniature .product-flags,
  .thumbnail-container .js-product-flags,
  .product-miniature .js-product-flags {
    left: 2px !important;
    top: 10px !important;
    right: auto !important;
    bottom: auto !important;
  }

  .product-flags .product-flag.discount,
  .product-flags .product-flag.atcf-sale,
  .product-flags .product-flag.atcf-category,
  .product-flags .product-flag.new,
  .js-product-flags .product-flag.discount,
  .js-product-flags .product-flag.atcf-sale,
  .js-product-flags .product-flag.atcf-category,
  .js-product-flags .product-flag.new {
    font-size: 10px !important;
    min-height: 22px;
    min-width: 26px;
    padding: 2px 8px 5px 7px !important;
  }
}
