/* =========================================================
   BudApproach – Product Badges v0.1.0
   Sale + Featured badge hierarchy
   ========================================================= */

body .product-grid-item,
body li.product {
    position: relative;
}

/* ---------------------------------------------------------
   Native WooCommerce/WoodMart sale badge
   --------------------------------------------------------- */

body .product-grid-item .onsale,
body li.product .onsale {
    z-index: 14 !important;
    top: 12px !important;
    right: auto !important;
    bottom: auto !important;
    left: 12px !important;

    display: inline-flex !important;
    align-items: center;
    justify-content: center;

    width: auto !important;
    min-width: 0 !important;
    height: auto !important;
    min-height: 28px;

    margin: 0 !important;
    padding: 6px 10px !important;

    border: 0 !important;
    border-radius: 999px !important;
    box-shadow: 0 6px 14px rgba(214, 40, 40, 0.26);

    background: #d62828 !important;
    color: #ffffff !important;

    font-size: 12px !important;
    font-weight: 700 !important;
    line-height: 1 !important;
    letter-spacing: 0.35px;
    text-transform: uppercase;
}

/* ---------------------------------------------------------
   Featured badge
   --------------------------------------------------------- */

body .product-grid-item .ba-featured-badge,
body li.product .ba-featured-badge {
    position: absolute;
    z-index: 13;
    top: 12px;
    left: 12px;

    display: inline-flex;
    align-items: center;
    gap: 6px;

    min-height: 30px;
    padding: 7px 12px;

    border: 1px solid rgba(244, 197, 66, 0.48);
    border-radius: 999px;
    box-shadow:
        0 7px 18px rgba(24, 61, 50, 0.28),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);

    background:
        linear-gradient(
            135deg,
            var(--ba-color-brand, #183d32) 0%,
            #2d5a49 100%
        );

    color: #fff7dd;

    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0.45px;
    text-transform: uppercase;

    pointer-events: none;
}

/*
 * A product with both Sale and Featured receives a vertical badge stack.
 * :has() is supported by the current Edge/Chrome runtime used in LocalWP.
 */
body .product-grid-item:has(.onsale) .ba-featured-badge,
body li.product:has(.onsale) .ba-featured-badge {
    top: 48px;
}

body .ba-featured-badge__icon {
    color: var(--ba-color-accent, #f4c542);
    font-size: 13px;
    line-height: 1;
}

body .ba-featured-badge__text {
    display: inline-block;
}

/* Single Product page */
body.single-product
    .summary
    > .ba-featured-badge {
    position: static;

    margin: 0 0 12px;
}

/* ---------------------------------------------------------
   Responsive
   --------------------------------------------------------- */

@media (max-width: 767px) {
    body .product-grid-item .onsale,
    body li.product .onsale {
        top: 8px !important;
        left: 8px !important;

        min-height: 26px;
        padding: 5px 9px !important;

        font-size: 11px !important;
    }

    body .product-grid-item .ba-featured-badge,
    body li.product .ba-featured-badge {
        top: 8px;
        left: 8px;

        min-height: 26px;
        gap: 5px;

        padding: 5px 9px;

        font-size: 11px;
    }

    body .product-grid-item:has(.onsale) .ba-featured-badge,
    body li.product:has(.onsale) .ba-featured-badge {
        top: 42px;
    }

    body .ba-featured-badge__icon {
        font-size: 12px;
    }
}