function addDamageBadge() {
    document.querySelectorAll('.product-entry').forEach(product => {

        const promotionBadge = product.querySelector('.promotion-badge');
        const freeShippingBadge = product.querySelector('.free-shipping-badge');

        if (!promotionBadge || !freeShippingBadge) return;

        // لازم يكون فيه "ضرر جزئي"
        if (!promotionBadge.textContent.includes('ضرر جزئي')) return;

        // منع التكرار
        if (product.querySelector('.partial-damage-badge')) return;

        // إضافة البادج بشكل inline عشان يفضل جنب بعض
        promotionBadge.insertAdjacentHTML(
            'afterend',
            `
            <span class="partial-damage-badge" style="
                color:#ea580c;
                font-weight:700;
                display:inline;
                margin-right:6px;
            ">
                | ضرر جزئي
            </span>
            `
        );

        // نخلي الحاوية نفسها inline عشان ما تكسرش السطر
        if (freeShippingBadge) {
            freeShippingBadge.style.display = 'inline-flex';
            freeShippingBadge.style.alignItems = 'center';
        }
    });
}

// تشغيل أول مرة
addDamageBadge();

// متابعة أي تغييرات في الصفحة (أفضل من setInterval)
const observer = new MutationObserver(() => {
    addDamageBadge();
});

observer.observe(document.body, {
    childList: true,
    subtree: true
});