/* DM24 0.9.98: One badge implementation across grid, lists, carousels and single products.
   No .onsale class, so old theme sale-badge rules cannot recolor or reposition it. */
:root { --dm24-badge-navy: #132d4f; }
.woocommerce li.product,
.woocommerce ul.products li.product,
.dm24-home-products li.product,
.dm24-article-products li.product,
body.single-product .woocommerce div.product .woocommerce-product-gallery,
.dm24-list-product__media {
  position: relative !important;
}

/* The unified badge belongs to the product li (grid/carousel), dedicated image
   wrapper (list), or WooCommerce gallery (single). Never the whole product row. */
body .dm24-marketing-badge,
body .woocommerce .dm24-marketing-badge,
body .woocommerce ul.products li.product > .dm24-marketing-badge,
body .woocommerce .dm24-list-product__media > .dm24-marketing-badge,
body.single-product .woocommerce div.product .woocommerce-product-gallery > .dm24-marketing-badge {
  position: absolute !important;
  inset: 12px auto auto 12px !important;
  z-index: 15 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  box-sizing: border-box !important;
  width: max-content !important;
  max-width: calc(100% - 24px) !important;
  height: auto !important;
  min-width: 0 !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 5px 8px !important;
  border: 1px solid #d6dfeb !important;
  border-radius: 5px !important;
  box-shadow: none !important;
  background: #fff !important;
  color: #132d4f !important;
  font-size: 10px !important;
  font-family: inherit !important;
  font-weight: 750 !important;
  letter-spacing: .04em !important;
  line-height: 1.15 !important;
  text-decoration: none !important;
  text-transform: uppercase !important;
  white-space: nowrap !important;
  transform: none !important;
  pointer-events: none !important;
}

/* Only color varies; geometry never changes between badge types. */
body .dm24-marketing-badge--new,
body .woocommerce .dm24-marketing-badge--new { background:#fff !important; color:#132d4f !important; border-color:#d6dfeb !important; }
body .dm24-marketing-badge--bestseller,
body .woocommerce .dm24-marketing-badge--bestseller { background:#132d4f !important; color:#fff !important; border-color:#132d4f !important; }
body .dm24-marketing-badge--sale,
body .woocommerce .dm24-marketing-badge--sale { background:#d9480f !important; color:#fff !important; border-color:#d9480f !important; }

/* Catalog list badge must sit on the image, never overlay product facts/text. */
body.dm24-view-list .dm24-list-product__media > .dm24-marketing-badge {
  inset: 8px auto auto 8px !important;
  max-width: calc(100% - 16px) !important;
}

/* No duplicate unavailable badge; availability is displayed in the stock row. */
.woocommerce li.product.outofstock .onsale,
.woocommerce li.product.outofstock .sold-out,
.woocommerce li.product.outofstock .soldout,
.woocommerce li.product.outofstock .out-of-stock-badge,
.woocommerce li.product.dm24-marketing-unavailable .onsale,
.woocommerce li.product.dm24-marketing-unavailable .sold-out,
.woocommerce li.product.dm24-marketing-unavailable .soldout,
.woocommerce li.product.dm24-marketing-unavailable .out-of-stock-badge {
  display: none !important;
}
@media (max-width:760px) {
  body .dm24-marketing-badge,
  body .woocommerce .dm24-marketing-badge {
    inset: 10px auto auto 10px !important;
    padding: 4px 7px !important;
    font-size: 9px !important;
  }
  body.dm24-view-list .dm24-list-product__media > .dm24-marketing-badge {
    inset: 6px auto auto 6px !important;
  }
}

/* Product page: gallery is the containing block, independent of buy panel and
   any JS-driven two-column layout.  Keep it above product photos and controls. */
body.single-product .woocommerce div.product .woocommerce-product-gallery {
  position: relative !important;
}
body.single-product .woocommerce div.product .woocommerce-product-gallery > .dm24-marketing-badge {
  top: 12px !important;
  left: 12px !important;
  right: auto !important;
  bottom: auto !important;
  z-index: 20 !important;
}
@media (max-width:760px) {
  body.single-product .woocommerce div.product .woocommerce-product-gallery > .dm24-marketing-badge {
    top: 10px !important;
    left: 10px !important;
  }
}

/* 0.9.98: never show the original hook output at the viewport edge.
   Only reveal it after it is placed inside the image gallery. */
body.single-product .woocommerce div.product > .dm24-marketing-badge,
body.single-product .woocommerce div.product > :not(.woocommerce-product-gallery) > .dm24-marketing-badge {
  visibility: hidden !important;
}
body.single-product .woocommerce div.product .woocommerce-product-gallery > .dm24-marketing-badge.dm24-single-badge-placed {
  visibility: visible !important;
  top: 12px !important;
  left: 12px !important;
  z-index: 40 !important;
}
@media (max-width:760px) {
  body.single-product .woocommerce div.product .woocommerce-product-gallery > .dm24-marketing-badge.dm24-single-badge-placed {
    top: 10px !important;
    left: 10px !important;
  }
}
