/* ===============================
   GLOBAL LAYOUT SCRIPT
   Sidebar + Overlay
================================ */

function toggleSidebar() {
    const sidebar = document.querySelector('.sidebar');
    const overlay = document.getElementById('overlay');

    if (!sidebar || !overlay) return;

    sidebar.classList.toggle('show');
    overlay.classList.toggle('show');
}

/* ===============================
   AUTO CLOSE ON RESIZE (OPTIONAL)
================================ */
window.addEventListener('resize', () => {
    if (window.innerWidth > 768) {
        document.querySelector('.sidebar')?.classList.remove('show');
        document.getElementById('overlay')?.classList.remove('show');
    }
});
