(function(){
var qualityTabs=document.getElementById('quality-tabs');
if(qualityTabs){
qualityTabs.addEventListener('click',function(e){
var btn=e.target.closest('[data-action="select-quality"]');
if(btn)selectQuality(btn);
});
}
var typeTabs=document.getElementById('type-tabs');
if(typeTabs){
typeTabs.addEventListener('click',function(e){
var btn=e.target.closest('[data-action="select-type"]');
if(btn)selectType(btn);
});
}
var sizeTabs=document.getElementById('size-tabs');
if(sizeTabs){
sizeTabs.addEventListener('click',function(e){
var btn=e.target.closest('[data-action="select-size"]');
if(btn)selectSize(btn);
});
}
var qtySection=document.querySelector('.sf-qty-stepper');
if(qtySection){
qtySection.addEventListener('click',function(e){
var btn=e.target.closest('[data-action="adjust-qty"]');
if(btn)adjustQty(parseInt(btn.getAttribute('data-dir')));
});
}
var addBtn=document.getElementById('add-to-cart-btn');
if(addBtn)addBtn.addEventListener('click',function(){addToCart();});
var buyBtn=document.querySelector('[data-action="buy-now"]');
if(buyBtn)buyBtn.addEventListener('click',function(){buyNow();});
})();
