// static/adminpanel/admin.js
(function(){
  // enable tooltips if needed
  if (window.bootstrap){
    document.querySelectorAll('[data-bs-toggle="tooltip"]').forEach(function(el){
      new bootstrap.Tooltip(el);
    });
  }
  // Close offcanvas on nav click (mobile)
  var sidebar = document.getElementById('adminSidebar');
  if (sidebar){
    sidebar.querySelectorAll('.list-group-item').forEach(function(a){
      a.addEventListener('click', function(){
        var oc = bootstrap.Offcanvas.getInstance(sidebar);
        if(oc) oc.hide();
      });
    });
  }
})();
