/* Shared product labels: home, listings, product gallery and quick view.
 * Load before theme.css: important layers have reversed precedence, so this
 * layer must be registered before Bootstrap and legacy badge colour layers.
 * Labels are informational, not buttons. Product data and text are unchanged.
 */
@layer sg-product-labels {
  .product-flags {
    position: absolute !important;
    inset: 12px 12px auto 12px !important;
    z-index: 5 !important;
    display: flex !important;
    flex-flow: row wrap !important;
    align-items: flex-start !important;
    align-content: flex-start !important;
    justify-content: flex-start !important;
    gap: 6px !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: calc(100% - 24px) !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    list-style: none !important;
    pointer-events: none !important;
  }

  .product-flags > :is(.badge, .product-flag) {
    display: inline-flex !important;
    position: static !important;
    align-items: center !important;
    flex: 0 1 auto !important;
    width: fit-content !important;
    min-width: 0 !important;
    max-width: 100% !important;
    min-height: 28px !important;
    height: auto !important;
    margin: 0 !important;
    padding: 6px 10px !important;
    border: 1px solid #dcc2b5 !important;
    border-radius: 8px !important;
    background: #fffaf7 !important;
    color: #713820 !important;
    box-shadow: 0 2px 7px rgb(7 20 38 / 6%) !important;
    font-family: var(--SGGLOVES-font-body, Inter, Arial, sans-serif) !important;
    font-size: 11px !important;
    font-weight: 600 !important;
    line-height: 1.35 !important;
    letter-spacing: .035em !important;
    text-transform: uppercase !important;
    text-align: start !important;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
    word-break: normal !important;
    text-overflow: clip !important;
    transform: none !important;
    transition: none !important;
    animation: none !important;
    opacity: 1 !important;
  }

  /* No glowing dots or ribbon triangles from older theme/module styles. */
  .product-flags > :is(.badge, .product-flag)::before,
  .product-flags > :is(.badge, .product-flag)::after {
    content: none !important;
    display: none !important;
  }

  .product-flags > :is(.discount, .discount-percentage, .discount-amount, .on-sale, .on_sale) {
    background: #99492f !important;
    border-color: #99492f !important;
    color: #fff !important;
  }

  .product-flags > :is(.out_of_stock, .out-of-stock, .unavailable) {
    background: #f3f5f7 !important;
    border-color: #d6dee7 !important;
    color: #435166 !important;
  }

  .product-flags > :is(.badge, .product-flag):empty {
    display: none !important;
  }

  /* The related-product sidebar uses small thumbnails. Keep every label in
   * normal flow there, instead of spilling over the photo and product title. */
  .quickview .SGGLOVES-quickview-related .product-miniature__inner:has(.product-flags) {
    height: auto !important;
    grid-template-rows: auto !important;
  }

  .quickview .SGGLOVES-quickview-related .product-miniature__top:has(.product-flags) {
    display: block !important;
    height: auto !important;
    max-height: none !important;
  }

  .quickview .SGGLOVES-quickview-related .product-flags {
    position: static !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 0 8px !important;
  }

  .quickview .SGGLOVES-quickview-related .product-miniature__inner:has(.product-flags) .product-miniature__bottom {
    padding-top: 8px !important;
  }

  @media (max-width: 767.98px) {
    .product-flags {
      inset: 8px 8px auto 8px !important;
      max-width: calc(100% - 16px) !important;
      gap: 4px !important;
    }
    .product-flags > :is(.badge, .product-flag) {
      min-height: 25px !important;
      padding: 5px 7px !important;
      font-size: 10px !important;
      letter-spacing: .025em !important;
    }
  }

  @media (forced-colors: active) {
    .product-flags > :is(.badge, .product-flag) {
      border-color: CanvasText !important;
      background: Canvas !important;
      color: CanvasText !important;
      box-shadow: none !important;
    }
  }
}
