<aside class="sidebar">
    <div class="sidebar-header">
        <i class="fas fa-building"></i>
        <span>ADMIN<br><small style="font-weight:400;color:#bfc5c9;">Kementrian PKP</small></span>
    </div>
    <nav class="sidebar-nav">
        <ul>
            <li><a href="/admin/dashboard"><i class="fas fa-home"></i> Beranda</a></li>

            <!-- Admin Manajemen Dropdown - Only for Superadmin -->
            <?php
                $user = session('auth.user');
                $isSuperadmin = $user && strtolower($user['role'] ?? '') === 'superadmin';
            ?>

            <?php if($isSuperadmin): ?>
                <li class="sidebar-dropdown">
                    <a href="#" class="dropdown-toggle"><i class="fas fa-users"></i> Admin Manajemen <i
                            class="fas" style="margin-left:auto;"></i></a>
                    <ul class="sidebar-submenu">
                        <li><a href="<?php echo e(route('admin.kelolaAdmin')); ?>"
                                class="<?php echo e(request()->is('admin/kelola-admin*') ? 'active' : ''); ?>"><i
                                    class="fas fa-user-plus"></i> Registrasi Admin</a></li>
                        <li><a href="<?php echo e(route('admin.manajemenAdmin')); ?>"
                                class="<?php echo e(request()->is('admin/manajemen-admin*') ? 'active' : ''); ?>"><i
                                    class="fas fa-users-cog"></i> Manajemen Admin</a></li>
                    </ul>
                </li>
            <?php endif; ?>

            <!-- Konten Dropdown -->
            <li class="sidebar-dropdown">
                <a href="#" class="dropdown-toggle"><i class="fas fa-folder-open"></i> Konten <i class="fas"
                        style="margin-left:auto;"></i></a>
                <ul class="sidebar-submenu">
                    <li><a href="/admin/berita" class="<?php echo e(request()->is('admin/berita*') ? 'active' : ''); ?>"><i
                                class="fas fa-newspaper"></i> Berita</a></li>
                    <li><a href="/admin/video" class="<?php echo e(request()->is('admin/video*') ? 'active' : ''); ?>"><i
                                class="fas fa-video"></i> Video</a></li>
                    <li><a href="/admin/infografis" class="<?php echo e(request()->is('admin/infografis*') ? 'active' : ''); ?>"><i
                                class="fas fa-image"></i> Infografis</a></li>
                    <li><a href="/admin/banner" class="<?php echo e(request()->is('admin/banner*') ? 'active' : ''); ?>"><i
                                class="fas fa-image"></i> Banner</a></li>
                </ul>
            </li>

            <!-- Design Dropdown -->
            <li class="sidebar-dropdown">
                <a href="#" class="dropdown-toggle"><i class="fas fa-paint-brush"></i> Design <i class="fas"
                        style="margin-left:auto;"></i></a>
                <ul class="sidebar-submenu">
                    <li><a href="/admin/bankdesign"><i class="fas fa-concierge-bell"></i> Bank Design</a></li>
                    <li><a href="/admin/design-prototype"><i class="fas fa-project-diagram"></i> Design Prototype</a>
                    </li>
                </ul>
            </li>

            <!-- Konten Dropdown -->
            <li class="sidebar-dropdown">
                <a href="#" class="dropdown-toggle"><i class="fas fa-folder-open"></i> Arsip <i class="fas"
                        style="margin-left:auto;"></i></a>
                <ul class="sidebar-submenu">
                    <li><a href="/admin/arsip" class="<?php echo e(request()->is('admin/arsip*') ? 'active' : ''); ?>"><i
                                class="fas fa-newspaper"></i> Arsip</a></li>
                </ul>
                <ul class="sidebar-submenu">
                    <li><a href="/admin/peraturan" class="<?php echo e(request()->is('admin/peraturan*') ? 'active' : ''); ?>"><i
                                class="fas fa-file-alt"></i> Peraturan</a></li>
                </ul>
            </li>

            <!-- Layanan Dropdown -->
            <li class="sidebar-dropdown">
                <a href="#" class="dropdown-toggle"><i class="fas fa-concierge-bell"></i> Layanan <i
                        class="fas" style="margin-left:auto;"></i></a>
                                <ul class="sidebar-submenu">
                    <li><a href="/admin/feedback" class="<?php echo e(request()->is('admin/feedback*') ? 'active' : ''); ?>"><i
                                class="fas fa-comment-dots"></i> Feedback</a></li>
                </ul>
                                <ul class="sidebar-submenu">
                    <li><a href="/admin/laporanbug" class="<?php echo e(request()->is('admin/laporanbug*') ? 'active' : ''); ?>"><i
                                class="fas fa-bug"></i> Laporan Bug</a></li>
                </ul>
            </li>

            <!-- Statistik & Data Dropdown - Hide for DIY and Jateng -->
            <?php
                $daerah = strtolower(env('DAERAH', ''));
                $isDiyOrJateng = $daerah === 'diy' || $daerah === 'jateng';
            ?>

            <?php if(!$isDiyOrJateng): ?>
                <li class="sidebar-dropdown">
                    <a href="#" class="dropdown-toggle"><i class="fas fa-chart-bar"></i> Data <i class="fas"
                            style="margin-left:auto;"></i></a>
                    <ul class="sidebar-submenu">
                        <li><a href="/admin/sebaran-rusun"
                                class="<?php echo e(request()->is('admin/sebaran-rusun*') ? 'active' : ''); ?>"><i
                                    class= "fas fa-building"></i> Sebaran Rusun</a>
                        </li>
                        
                    </ul>
                </li>
            <?php endif; ?>

            <!-- Pengaturan Dropdown -->
            <li class="sidebar-dropdown">
                <a href="#" class="dropdown-toggle"><i class="fas fa-cog"></i> Pengaturan <i class="fas"
                        style="margin-left:auto;"></i></a>
                <ul class="sidebar-submenu">
                    <li><a href="/admin/pengaturan-situs"
                            class="<?php echo e(request()->is('admin/pengaturan-situs*') ? 'active' : ''); ?>"><i
                                class="fas fa-browser"></i> Pengaturan Situs</a></li>
                    
                    
                </ul>
            </li>
        </ul>
    </nav>

    <style>
        /* Fixed sidebar styling - make it stay visible on scroll */
        .sidebar {
            position: fixed !important;
            top: 0 !important;
            left: 0 !important;
            width: 260px !important;
            height: 100vh !important;
            overflow-y: auto !important;
            background: #23272b !important;
            color: #fff !important;
            display: flex !important;
            flex-direction: column !important;
            padding: 24px 0 0 0 !important;
            border-right: 1px solid #e5e7eb !important;
            z-index: 1000 !important;
        }

        /* Scrollbar styling for sidebar */
        .sidebar::-webkit-scrollbar {
            width: 6px;
        }

        .sidebar::-webkit-scrollbar-track {
            background: #1a1d21;
        }

        .sidebar::-webkit-scrollbar-thumb {
            background: #22c1b6;
            border-radius: 3px;
        }

        .sidebar::-webkit-scrollbar-thumb:hover {
            background: #1da89c;
        }

        /* Ensure sidebar footer stays at bottom */
        .sidebar-footer {
            margin-top: auto !important;
            padding: 16px 24px !important;
            border-top: 1px solid #2d3238 !important;
            background: #1e2226 !important;
            display: flex !important;
            align-items: center !important;
            gap: 12px !important;
        }

        .sidebar-footer .avatar {
            width: 42px !important;
            height: 42px !important;
            border-radius: 50% !important;
            background: linear-gradient(135deg, #667eea 0%, #22c1b6 100%) !important;
            display: flex !important;
            align-items: center !important;
            justify-content: center !important;
            font-weight: 700 !important;
            font-size: 1rem !important;
            color: #fff !important;
        }

        .sidebar-footer .user-info {
            flex: 1 !important;
            overflow: hidden !important;
        }

        .sidebar-footer .user-info span {
            display: block !important;
            font-weight: 600 !important;
            color: #fff !important;
            font-size: 0.95rem !important;
            white-space: nowrap !important;
            overflow: hidden !important;
            text-overflow: ellipsis !important;
        }

        .sidebar-footer .user-info small {
            display: block !important;
            color: #9ca3af !important;
            font-size: 0.8rem !important;
            white-space: nowrap !important;
            overflow: hidden !important;
            text-overflow: ellipsis !important;
        }

        .btn-logout {
            background: #ef4444 !important;
            color: #fff !important;
            border: none !important;
            border-radius: 8px !important;
            width: 40px !important;
            height: 40px !important;
            display: flex !important;
            align-items: center !important;
            justify-content: center !important;
            cursor: pointer !important;
            transition: all 0.3s ease !important;
            font-size: 1.1rem !important;
        }

        .btn-logout:hover {
            background: #dc2626 !important;
            transform: translateY(-2px) !important;
            box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4) !important;
        }

        .btn-logout:active {
            transform: translateY(0) !important;
        }

        /* Sidebar dropdown styles */
        .sidebar-dropdown>.dropdown-toggle {
            cursor: pointer;
            display: flex;
            align-items: center;
            width: 100%;
            padding: 10px 28px;
            color: #bfc5c9;
            text-decoration: none;
            border-radius: 8px 0 0 8px;
            font-size: 1rem;
            transition: background 0.2s, color 0.2s;
        }

        .sidebar-dropdown>.dropdown-toggle.active,
        .sidebar-dropdown>.dropdown-toggle:hover {
            background: #22c1b6;
            color: #fff;
        }

        .sidebar-submenu {
            display: none;
            flex-direction: column;
            background: #23272b;
            padding-left: 0;
            margin: 0;
            border-radius: 0 0 8px 8px;
            box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
        }

        .sidebar-dropdown.open>.sidebar-submenu {
            display: flex;
        }

        .sidebar-submenu li a {
            padding: 10px 48px;
            color: #bfc5c9;
            font-size: 0.98rem;
            border-radius: 0;
            display: flex;
            align-items: center;
            gap: 10px;
            transition: background 0.2s, color 0.2s;
        }

        .sidebar-submenu li a.active,
        .sidebar-submenu li a:hover {
            background: #22c1b6;
            color: #fff;
        }

        /* Push main content to the right to avoid overlap with fixed sidebar */
        .admin-dashboard {
            margin-left: 260px !important;
        }

        .main {
            margin-left: 0 !important;
        }
    </style>
    <script>
        document.addEventListener('DOMContentLoaded', function() {
            document.querySelectorAll('.sidebar-dropdown > .dropdown-toggle').forEach(function(toggle) {
                toggle.addEventListener('click', function(e) {
                    e.preventDefault();
                    var parent = this.parentElement;
                    parent.classList.toggle('open');
                });
            });
        });
    </script>
    <div class="sidebar-footer">
        <?php
            $user = session('auth.user');
            $username = $user['username'] ?? 'Admin';
            $email = $user['email'] ?? 'admin@kementrianpkp.go.id';
            $initials = strtoupper(substr($username, 0, 2));
        ?>
        <div class="avatar"><?php echo e($initials); ?></div>
        <div class="user-info">
            <span><?php echo e($username); ?></span>
            <small><?php echo e($email); ?></small>
        </div>
        <form action="<?php echo e(route('logout')); ?>" method="POST" style="margin: 0;">
            <?php echo csrf_field(); ?>
            <button type="submit" class="btn-logout" title="Logout">
                <i class="fas fa-sign-out-alt"></i>
            </button>
        </form>
    </div>
</aside>
<?php /**PATH D:\laravel\krs-jawa3-template\krs-jawa3-web-template\resources\views/admin/components/sidebar.blade.php ENDPATH**/ ?>