// main.js - global scripts for KonserTix
document.addEventListener('DOMContentLoaded', function(){
  // AOS init
  if(window.AOS) AOS.init({duration:600,once:true});

  // sidebar toggle
  document.querySelectorAll('[data-toggle="sidebar"]').forEach(btn=>{
    btn.addEventListener('click', ()=>{
      document.querySelector('.sidebar')?.classList.toggle('open');
    });
  });

  // global confirm via SweetAlert2 (if available)
  window.confirmAction = function(message, cb){
    if(window.Swal){
      Swal.fire({title:message,icon:'warning',showCancelButton:true}).then(r=>{if(r.isConfirmed) cb()});
    } else {
      if(confirm(message)) cb();
    }
  }
});
