    </div><!-- /admin-content -->

    <!-- Admin Footer -->
    <footer class="admin-footer">
        <div>
            &copy; <?= date('Y') ?> <?= e($siteName) ?> — অ্যাডমিন প্যানেল
            &nbsp;|&nbsp;
            <a href="<?= BASE_URL ?>/index.php" target="_blank">সাইট দেখুন</a>
            <a href="<?= BASE_URL ?>/logout.php">লগআউট</a>
        </div>
    </footer>

</div><!-- /admin-main -->
</div><!-- /admin-wrapper -->

<script>
// ── Sidebar toggle (mobile) ──────────────────────────────
const sidebar  = document.getElementById('adminSidebar');
const overlay  = document.getElementById('sidebarOverlay');
const toggleBtn = document.getElementById('sidebarToggle');

function openSidebar() {
    sidebar.classList.add('open');
    overlay.classList.add('open');
    document.body.style.overflow = 'hidden';
}
function closeSidebar() {
    sidebar.classList.remove('open');
    overlay.classList.remove('open');
    document.body.style.overflow = '';
}

toggleBtn.addEventListener('click', () => {
    sidebar.classList.contains('open') ? closeSidebar() : openSidebar();
});
overlay.addEventListener('click', closeSidebar);

// Close on nav link click (mobile)
sidebar.querySelectorAll('.sidebar-link').forEach(link => {
    link.addEventListener('click', () => {
        if (window.innerWidth <= 900) closeSidebar();
    });
});

// ── Set page title in topbar ──────────────────────────────
const heading = document.querySelector('.admin-content h2, .admin-content h1');
if (heading) {
    document.getElementById('pageTitle').textContent = heading.textContent.trim();
}

// ── Confirm-delete ────────────────────────────────────────
document.querySelectorAll('[data-confirm]').forEach(el => {
    el.addEventListener('click', function(e) {
        if (!confirm(this.dataset.confirm || 'আপনি কি নিশ্চিত?')) e.preventDefault();
    });
});

// ── Auto-hide alerts ──────────────────────────────────────
setTimeout(() => {
    document.querySelectorAll('.alert').forEach(a => {
        a.style.transition = 'opacity .5s';
        a.style.opacity = '0';
        setTimeout(() => a.remove(), 500);
    });
}, 5000);
</script>
</body>
</html>
