
<div class="topbar">
    <div class="topbar-left">
        <button id="sidebar-toggle" class="menu-toggle-btn" aria-label="Toggle Menu">
            <svg fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
                <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2.5" d="M4 6h16M4 12h16M4 18h16"></path>
            </svg>
        </button>

        <div class="topbar-title-block">
            <?php if(!empty($pageTitle)): ?>
                <h1 class="dashboard-title"><?php echo e($pageTitle); ?></h1>
            <?php endif; ?>
            <?php if(!empty($pageSubtitle)): ?>
                <p class="dashboard-subtitle"><?php echo e($pageSubtitle); ?></p>
            <?php endif; ?>
        </div>
    </div>

    <div class="topbar-right">

        <?php if(isset($rightContent)): ?>
            <?php echo $rightContent; ?>

        <?php endif; ?>

        <a href="<?php echo e(route('user.profile.index')); ?>" class="user-profile" style="text-decoration: none;">
            <div class="avatar-frame">
                <?php if(isset($user) && file_exists(public_path('images/avatar.png'))): ?>
                    <img src="<?php echo e(asset('images/avatar.png')); ?>" alt="User Avatar" class="avatar-img">
                <?php elseif(isset($user)): ?>
                    <?php echo e(strtoupper(substr($user->name, 0, 2))); ?>

                <?php endif; ?>
            </div>
            <?php if(isset($user)): ?>
                <div class="user-info">
                    <span class="user-fullname"><?php echo e($user->name); ?></span>
                    <span class="user-role-label"><?php echo e($user->role); ?></span>
                </div>
            <?php endif; ?>
        </a>
    </div>
</div>

<script>
    (function() {
        document.addEventListener('DOMContentLoaded', function () {
            const sidebar        = document.getElementById('dashboard-sidebar');
            const sidebarToggle  = document.getElementById('sidebar-toggle');
            const sidebarClose   = document.getElementById('sidebar-close');
            const sidebarBackdrop = document.getElementById('sidebar-backdrop');

            function toggleSidebar() {
                if (sidebar)         sidebar.classList.toggle('active');
                if (sidebarBackdrop) sidebarBackdrop.classList.toggle('active');
            }

            if (sidebarToggle)   sidebarToggle.addEventListener('click', toggleSidebar);
            if (sidebarClose)    sidebarClose.addEventListener('click', toggleSidebar);
            if (sidebarBackdrop) sidebarBackdrop.addEventListener('click', toggleSidebar);
        });
    })();
</script>
<?php /**PATH D:\New\New\admin-panel\resources\views/user/sidebar/topbar.blade.php ENDPATH**/ ?>