<nav id="sidebar" class="sidebar-wrapper">
    <div class="sidebar-header">
        <div class="d-flex align-items-center">
                    
           
           <img src="images/logo.png" alt="<?php echo htmlspecialchars($settings['sitname']); ?>" class="sidebar-logo">
        </div>
        <button type="button" class="close-sidebar-btn" id="closeSidebar">
            <i class="mdi mdi-close"></i>
        </button>
    </div>

    <div class="sidebar-content">
        <div class="nav-section">
            <p class="section-title">Main Menu</p>
            <ul class="nav flex-column">
                <?php $current_page = basename($_SERVER['PHP_SELF']); ?>
                <li class="nav-item">
                    <a href="customer_account_summary.php" class="nav-link <?php echo ($current_page == 'customer_account_summary.php') ? 'active' : ''; ?>">
                        <div class="icon-box"><i class="mdi mdi-view-dashboard"></i></div>
                        <span>Dashboard</span>
                    </a>
                </li>
                <li class="nav-item">
                    <a href="customer_transfer.php" class="nav-link <?php echo ($current_page == 'customer_transfer.php') ? 'active' : ''; ?>">
                        <div class="icon-box"><i class="mdi mdi-bank-transfer"></i></div>
                        <span>Transfer Funds</span>
                    </a>
                </li>
                <li class="nav-item">
                    <a href="customer_mini_statement.php" class="nav-link <?php echo ($current_page == 'customer_mini_statement.php') ? 'active' : ''; ?>">
                        <div class="icon-box"><i class="mdi mdi-history"></i></div>
                        <span>Transactions</span>
                    </a>
                </li>
            </ul>
        </div>

        <div class="nav-section">
            <p class="section-title">Security & Support</p>
            <ul class="nav flex-column">
                <li class="nav-item">
                    <a href="customer_personal_details.php" class="nav-link <?php echo ($current_page == 'customer_personal_details.php') ? 'active' : ''; ?>">
                        <div class="icon-box"><i class="mdi mdi-shield-account-outline"></i></div>
                        <span>Security Settings</span>
                    </a>
                </li>
                <li class="nav-item">
                    <a href="customer_logout.php" class="nav-link logout-link">
                        <div class="icon-box"><i class="mdi mdi-power"></i></div>
                        <span>Secure Logout</span>
                    </a>
                </li>
            </ul>
        </div>
    </div>
</nav>

<div id="sidebarOverlay"></div>

<style>
/* FORCE WHITE BACKGROUND */
.sidebar-wrapper {
    position: fixed;
    top: 0;
    left: -300px; /* Start hidden */
    width: 280px;
    height: 100vh;
    background-color: #ffffff !important; /* Force White */
    z-index: 9999; /* Sit above everything */
    display: flex;
    flex-direction: column;
    border-right: 1px solid #edf2f7;
    transition: all 0.3s ease-in-out;
}

/* Show Sidebar */
.sidebar-wrapper.active {
    left: 0;
    box-shadow: 10px 0 30px rgba(0,0,0,0.1);
}

.sidebar-header {
    padding: 25px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #ffffff;
}

.sidebar-logo { height: 32px; }

.close-sidebar-btn {
    border: none;
    background: #f1f5f9;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

/* Navigation Styles */
.sidebar-content { flex: 1; padding: 10px 15px; background: #ffffff; }
.section-title { font-size: 11px; font-weight: 700; color: #94a3b8; text-transform: uppercase; padding: 15px; }

.nav-link {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    margin-bottom: 5px;
    border-radius: 12px;
    color: #64748b;
    text-decoration: none !important;
}

.nav-link.active {
    background: #1565d8 !important;
    color: #ffffff !important;
}

.icon-box { width: 35px; font-size: 20px; }

/* Overlay Background */
#sidebarOverlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.3);
    z-index: 9998;
    display: none;
}
#sidebarOverlay.active { display: block; }

/* Hide desktop scrollbar but allow scrolling */
.sidebar-content::-webkit-scrollbar { display: none; }
</style>

<script>
document.addEventListener("DOMContentLoaded", function() {
    const sidebar = document.getElementById("sidebar");
    const overlay = document.getElementById("sidebarOverlay");
    const closeBtn = document.getElementById("closeSidebar");
    
    // Look for your menu button in the top navbar
    const openBtn = document.getElementById("openSidebar") || document.querySelector(".navbar-toggler");

    // Close Function
    function hideSidebar() {
        sidebar.classList.remove("active");
        overlay.classList.remove("active");
    }

    // Open Function
    function showSidebar() {
        sidebar.classList.add("active");
        overlay.classList.add("active");
    }

    if (openBtn) openBtn.addEventListener("click", showSidebar);
    if (closeBtn) closeBtn.addEventListener("click", hideSidebar);
    if (overlay) overlay.addEventListener("click", hideSidebar);
});
</script>
