const sidebar=document.getElementById("sidebar");
const overlay=document.getElementById("overlay");
const menu=document.getElementById("menuToggle");

if(menu){
menu.onclick=function(){
sidebar.classList.toggle("show");
overlay.classList.toggle("show");
}
}

if(overlay){
overlay.onclick=function(){
sidebar.classList.remove("show");
overlay.classList.remove("show");
}
}

/* =========================
   PAYMENT METHOD SELECT
========================= */

document.querySelectorAll(".paymentBtn").forEach(btn=>{
    btn.addEventListener("click",function(){

        document.querySelectorAll(".paymentBtn").forEach(b=>{
            b.classList.remove("active","btn-success");
        });

        this.classList.add("active","btn-success");

        let method = this.getAttribute("data-method");
        let input = document.getElementById("payment_method");

        if(input){
            input.value = method;
        }

    });
});