<style>
    body.dark-mode { background-color: #101924; color: #d5d7db; }
</style>

<?php
function maskNumber($number, $showLast = 5) {
    $numberStr = (string)$number;
    $maskLength = strlen($numberStr) - $showLast;
    return str_repeat('*', $maskLength) . substr($numberStr, -$showLast);
}
$maskedNumber = maskNumber($row['account_num'], 5);
$account_num = $row['account_num'];

// Format initials
$initials = strtoupper(substr($row['firstname'], 0, 1) . substr($row['lastname'], 0, 1));
?>
<div class="nk-sidebar-element">
    <div class="nk-sidebar-body" data-simplebar>
        <div class="nk-sidebar-content">

            <!-- Sidebar Brand -->
            <div class="nk-sidebar-brand-wrapper">
                <!-- <a href="dashboard" class="nk-sidebar-brand-link">
                    <img src="../logo.png" alt="<?= htmlspecialchars(getSetting('site_name', 'Deutsche Bank Holdings Delaware')) ?>" class="nk-sidebar-brand-logo">
                </a> -->
            </div>

            <!-- Balance Card -->
            <div class="nk-sidebar-widget d-none d-xl-block">
                <div class="sidebar-balance-card">
                    <div class="sidebar-balance-label">Checking Account</div>
                    <div class="sidebar-balance-number"><?=$maskedNumber?></div>
                    <div class="sidebar-balance-divider"></div>
                    <div class="sidebar-balance-amount">
                        <span class="sidebar-balance-value"><?=formatCurrency($row['checking_balance'], $row['usercurrency'])?></span>
                    </div>
                </div>
            </div>

            <!-- Quick Actions -->
            <div class="nk-sidebar-widget d-none d-xl-block">
                <div class="sidebar-quick-actions">
                    <a href="transfer" class="sidebar-quick-btn">
                        <em class="icon ni ni-wallet-out"></em><span>Transfer</span>
                    </a>
                    <a href="pay-bills" class="sidebar-quick-btn">
                        <em class="icon ni ni-cc-secure"></em><span>Pay Bills</span>
                    </a>
                </div>
            </div>

            <!-- Mobile Profile -->
            <div class="nk-sidebar-widget nk-sidebar-widget-full d-xl-none pt-0">
                <a class="nk-profile-toggle toggle-expand" data-target="sidebarProfile" href="#">
                    <div class="user-card-wrap">
                        <div class="user-card">
                            <div class="user-avatar"><span><?=$initials?></span></div>
                            <div class="user-info">
                                <span class="lead-text"><?=$row['firstname']?> <?=$row['lastname']?></span>
                                <span class="sub-text"><?=$maskedNumber?></span>
                            </div>
                            <div class="user-action"><em class="icon ni ni-chevron-down"></em></div>
                        </div>
                    </div>
                </a>
                <div class="nk-profile-content toggle-expand-content" data-content="sidebarProfile">
                    <div class="user-account-info between-center">
                        <div class="user-account-main">
                            <h6 class="overline-title-alt">Checking Account</h6>
                            <div class="user-balance"><?=formatCurrency($row['checking_balance'], $row['usercurrency'])?></div>
                        </div>
                    </div>
                    <ul class="link-list">
                        <li><a href="profile"><em class="icon ni ni-user-alt"></em><span>View Profile</span></a></li>
                        <li><a href="account-setting"><em class="icon ni ni-setting-alt"></em><span>Account Setting</span></a></li>
                        <li><a href="activity-logs"><em class="icon ni ni-activity-alt"></em><span>Login Activity</span></a></li>
                        <li><a href="logout"><em class="icon ni ni-signout"></em><span>Sign out</span></a></li>
                    </ul>
                </div>
            </div>

            <!-- Navigation -->
            <div class="nk-sidebar-menu">
                <ul class="nk-menu">

                    <li class="nk-menu-heading"><h6 class="overline-title">Overview</h6></li>
                    <li class="nk-menu-item">
                        <a href="dashboard" class="nk-menu-link">
                            <span class="nk-menu-icon"><em class="icon ni ni-dashboard"></em></span>
                            <span class="nk-menu-text">Dashboard</span>
                        </a>
                    </li>
                    <li class="nk-menu-item">
                        <a href="summary" class="nk-menu-link">
                            <span class="nk-menu-icon"><em class="icon ni ni-report-profit"></em></span>
                            <span class="nk-menu-text">Account Summary</span>
                        </a>
                    </li>

                    <li class="nk-menu-heading"><h6 class="overline-title">Banking</h6></li>
                    <li class="nk-menu-item">
                        <a href="transfer" class="nk-menu-link">
                            <span class="nk-menu-icon"><em class="icon ni ni-wallet-out"></em></span>
                            <span class="nk-menu-text">Transfer</span>
                        </a>
                    </li>
                    <li class="nk-menu-item">
                        <a href="wire" class="nk-menu-link">
                            <span class="nk-menu-icon"><em class="icon ni ni-money"></em></span>
                            <span class="nk-menu-text">Cross-border Transfer</span>
                        </a>
                    </li>
                    <li class="nk-menu-item">
                        <a href="check-deposit" class="nk-menu-link">
                            <span class="nk-menu-icon"><em class="icon ni ni-wallet-in"></em></span>
                            <span class="nk-menu-text">Deposit Check</span>
                        </a>
                    </li>
                    <li class="nk-menu-item">
                        <a href="pay-bills" class="nk-menu-link">
                            <span class="nk-menu-icon"><em class="icon ni ni-cc-secure"></em></span>
                            <span class="nk-menu-text">Pay Bills</span>
                        </a>
                    </li>
                    <li class="nk-menu-item">
                        <a href="virtual-card" class="nk-menu-link">
                            <span class="nk-menu-icon"><em class="icon ni ni-cc-alt2-fill"></em></span>
                            <span class="nk-menu-text">Virtual Cards</span>
                        </a>
                    </li>
                    <li class="nk-menu-item">
                        <a href="loan" class="nk-menu-link">
                            <span class="nk-menu-icon"><em class="icon ni ni-invest"></em></span>
                            <span class="nk-menu-text">Loan / Credit</span>
                        </a>
                    </li>
                    <li class="nk-menu-item">
                        <a href="crypto" class="nk-menu-link">
                            <span class="nk-menu-icon"><em class="icon ni ni-coins"></em></span>
                            <span class="nk-menu-text">Digital Assets</span>
                        </a>
                    </li>

                    <li class="nk-menu-heading"><h6 class="overline-title">Account</h6></li>
                    <li class="nk-menu-item">
                        <a href="account-setting" class="nk-menu-link">
                            <span class="nk-menu-icon"><em class="icon ni ni-setting-alt-fill"></em></span>
                            <span class="nk-menu-text">Settings</span>
                        </a>
                    </li>

                    <li class="nk-menu-heading"><h6 class="overline-title">Support</h6></li>
                    <li class="nk-menu-item">
                        <a href="contact" class="nk-menu-link">
                            <span class="nk-menu-icon"><em class="icon ni ni-help-alt"></em></span>
                            <span class="nk-menu-text">Support</span>
                        </a>
                    </li>

                </ul>
            </div>

            <!-- Footer -->
            <div class="nk-sidebar-footer">
                <div id="google_translate_element"></div>
            </div>

        </div>
    </div>
</div>

<!-- sidebar @e -->
</div>
<!-- wrap @s -->
<div class="nk-wrap ">

<!-- Header -->
<div class="nk-header nk-header-fluid nk-header-fixed is-light">
    <div class="container-fluid">
        <div class="nk-header-wrap">
            <div class="nk-menu-trigger d-xl-none ml-n1">
                <a href="#" class="nk-nav-toggle nk-quick-nav-icon" data-target="sidebarMenu"><em class="icon ni ni-menu"></em></a>
            </div>
            <!-- <div class="nk-header-brand d-xl-none">
                <a href="dashboard" class="logo-link">
                    <img class="logo-light logo-img" src="../logo.png" alt="logo">
                </a>
            </div> -->
            <div class="nk-header-tools">
                <ul class="nk-quick-nav">
                    <li>
                        <a href="#" class="nk-quick-nav-icon" title="Notifications">
                            <em class="icon ni ni-bell"></em>
                        </a>
                    </li>
                    <li class="dropdown user-dropdown">
                        <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                            <div class="user-toggle">
                                <div class="user-avatar sm"><span><?=$initials?></span></div>
                                <div class="user-info d-none d-md-block">
                                    <div class="user-name dropdown-indicator"><?=$row['firstname']?> <?=$row['lastname']?></div>
                                </div>
                            </div>
                        </a>
                        <div class="dropdown-menu dropdown-menu-md dropdown-menu-right dropdown-menu-s1">
                            <div class="dropdown-inner user-card-wrap bg-lighter d-none d-md-block">
                                <div class="user-card">
                                    <div class="user-avatar"><span><?=$initials?></span></div>
                                    <div class="user-info">
                                        <span class="lead-text"><?=$row['firstname']?> <?=$row['lastname']?></span>
                                        <span class="sub-text"><?=$maskedNumber?></span>
                                    </div>
                                </div>
                            </div>
                            <div class="dropdown-inner user-account-info">
                                <h6 class="overline-title-alt">Checking Account</h6>
                                <div class="user-balance"><?=formatCurrency($row['checking_balance'], $row['usercurrency'])?></div>
                                <a href="transfer" class="link"><span>Transfer Funds</span> <em class="icon ni ni-wallet-out"></em></a>
                            </div>
                            <div class="dropdown-inner">
                                <ul class="link-list">
                                    <li><a href="profile"><em class="icon ni ni-user-alt"></em><span>View Profile</span></a></li>
                                    <li><a href="account-setting"><em class="icon ni ni-setting-alt"></em><span>Account Setting</span></a></li>
                                    <li><a href="password-reset"><em class="icon ni ni-security"></em><span>Reset Password</span></a></li>
                                    <li><a href="activity-logs"><em class="icon ni ni-activity-alt"></em><span>Login Activity</span></a></li>
                                    <li><a class="dark-switch" href="#"><em class="icon ni ni-moon"></em><span>Dark Mode</span></a></li>
                                </ul>
                            </div>
                            <div class="dropdown-inner">
                                <ul class="link-list">
                                    <li><a href="logout"><em class="icon ni ni-signout"></em><span>Sign out</span></a></li>
                                </ul>
                            </div>
                        </div>
                    </li>
                </ul>
            </div>
        </div>
    </div>
</div>

