/* Pi Alfa product labels: deliberately scoped so Astra, Elementor and WooCommerce layouts keep their spacing. */
.woocommerce span.onsale,
.woocommerce ul.products li.product .onsale,
.woocommerce-page span.onsale,
.elementor-widget-woocommerce-products .onsale,
.elementor-widget-loop-grid .onsale,
.wc-block-components-product-sale-badge {
    display: none !important;
}

.woocommerce ul.products li.product,
.woocommerce-page ul.products li.product,
.woocommerce div.product,
.woocommerce-page div.product,
.elementor-widget-woocommerce-products .product,
.elementor-widget-loop-grid .product {
    position: relative;
}

.pialfa-badges {
    position: absolute;
    z-index: 8;
    top: 8px;
    left: 8px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    pointer-events: none;
}

/* The loop hook normally runs inside the product link; keep badges in the image corner. */
.woocommerce ul.products li.product > a:first-child > .pialfa-badges,
.woocommerce-page ul.products li.product > a:first-child > .pialfa-badges,
.elementor-widget-woocommerce-products .product > a:first-child > .pialfa-badges,
.elementor-widget-loop-grid .product > a:first-child > .pialfa-badges {
    top: 8px;
    left: 8px;
}

.pialfa-badge {
    box-sizing: border-box;
    display: inline-flex;
    width: 22px;
    height: 22px;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px solid #F9C041;
    border-radius: 50%;
    background: #fff;
    color: #F9C041;
    box-shadow: 0 1px 4px rgba(31, 34, 32, .18);
    font-family: inherit;
    font-size: 8px;
    font-weight: 700;
    line-height: 1;
    text-align: center;
}

.pialfa-badge-discount {
    width: auto;
    min-width: 22px;
    max-width: 58px;
    height: 22px;
    padding: 0 5px;
    border-radius: 999px;
    color: #1f2220;
    font-size: 10px;
    font-weight: 700;
    white-space: nowrap;
}

.pialfa-badge-custom {
    width: auto;
    min-width: 22px;
    max-width: 92px;
    height: 22px;
    padding: 0 5px;
    border-radius: 999px;
    color: #1f2220;
    font-size: 8px;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.pialfa-flag-svg {
    display: block;
    width: 16px;
    height: 11px;
    border-radius: 1px;
}

.pialfa-icon-svg {
    display: block;
    width: 15px;
    height: 15px;
    color: #F9C041;
}

/* Single product gallery: the summary is the stable containing block across Astra/Elementor. */
.woocommerce div.product > .pialfa-badges,
.woocommerce-page div.product > .pialfa-badges {
    top: 12px;
    left: 12px;
}

@media (max-width: 544px) {
    .pialfa-badges {
        top: 6px;
        left: 6px;
        gap: 4px;
    }
    .pialfa-badge {
        width: 20px;
        height: 20px;
    }
    .pialfa-badge-discount,
    .pialfa-badge-custom {
        min-width: 20px;
        height: 20px;
    }
    .pialfa-badge-discount {
        font-size: 10px;
    }
    .pialfa-flag-svg {
        width: 15px;
        height: 10px;
    }
    .pialfa-icon-svg {
        width: 14px;
        height: 14px;
    }
}

/* Gallery image fallback used by the standard WooCommerce and Elementor image widgets. */
.woocommerce .woocommerce-product-gallery__image,
.woocommerce-page .woocommerce-product-gallery__image,
.woocommerce .elementor-widget-woocommerce-product-images,
.woocommerce-page .elementor-widget-woocommerce-product-images {
    position: relative;
}

.woocommerce .woocommerce-product-gallery__image > .pialfa-badges,
.woocommerce-page .woocommerce-product-gallery__image > .pialfa-badges,
.woocommerce .elementor-widget-woocommerce-product-images > .pialfa-badges,
.woocommerce-page .elementor-widget-woocommerce-product-images > .pialfa-badges {
    top: 8px;
    left: 8px;
}
