<aside class="w-64 bg-blue-900 text-white flex flex-col shadow-xl flex-shrink-0" id="sidebar">
    <div class="flex items-center gap-3 px-6 py-5 border-b border-blue-800">
        <?php if(!empty($branding['logo_url'])): ?>
            <img src="<?php echo e($branding['logo_url']); ?>" alt="<?php echo e($branding['site_name']); ?>" class="h-10 w-auto max-w-28 object-contain rounded-lg bg-white p-1" />
        <?php else: ?>
            <div class="w-9 h-9 bg-white rounded-lg flex items-center justify-center">
                <span class="text-blue-900 font-black text-lg"><?php echo e($branding['initial'] ?? 'G'); ?></span>
            </div>
        <?php endif; ?>
        <div>
            <p class="font-bold text-sm leading-tight"><?php echo e($branding['site_name'] ?? 'GPS Migration'); ?></p>
            <p class="text-blue-300 text-xs">Admin Panel</p>
        </div>
    </div>

    <div class="px-6 py-3 border-b border-blue-800">
        <p class="text-xs text-blue-300">Logged in as</p>
        <p class="text-sm font-semibold truncate"><?php echo e(auth()->user()->name); ?></p>
        <span class="inline-block mt-1 text-xs bg-blue-700 rounded px-2 py-0.5 uppercase tracking-wide font-medium">
            <?php echo e(auth()->user()->role); ?>

        </span>
    </div>

    <nav class="flex-1 px-3 py-4 space-y-2 overflow-y-auto text-sm">
        <?php
            $item = function (string $route, string $icon, string $label) {
                $active = request()->routeIs($route . '*');

                return '<a href="' . route($route) . '"
                    class="flex items-center gap-3 px-3 py-2.5 rounded-lg font-medium transition '
                    . ($active ? 'bg-blue-700 text-white' : 'text-blue-100 hover:bg-blue-700')
                    . '">
                    <span class="w-5 text-center">' . $icon . '</span><span>' . $label . '</span>
                </a>';
            };

            $sub = function (string $route, string $label) {
                $active = request()->routeIs($route . '*');

                return '<a href="' . route($route) . '"
                    class="block ml-8 px-3 py-2 rounded-md text-sm transition '
                    . ($active ? 'bg-blue-700 text-white font-semibold' : 'text-blue-200 hover:bg-blue-800 hover:text-white')
                    . '">' . $label . '</a>';
            };

            $contentOpen = request()->routeIs('admin.home.*')
                || request()->routeIs('admin.countries.page.*')
                || request()->routeIs('admin.country-sections.*')
                || request()->routeIs('admin.sections.*')
                || request()->routeIs('admin.pages.*')
                || request()->routeIs('admin.services.*')
                || request()->routeIs('admin.success-stories.*')
                || request()->routeIs('admin.partner-institutions.*')
                || request()->routeIs('admin.countries.*')
                || request()->routeIs('admin.events.*')
                || request()->routeIs('admin.student-reviews.*')
                || request()->routeIs('admin.faqs.*')
                || request()->routeIs('admin.visa-stories.*')
                || request()->routeIs('admin.our-partners.*');

            $countriesOpen = request()->routeIs('admin.countries.*')
                || request()->routeIs('admin.countries.page.*')
                || request()->routeIs('admin.country-sections.*');

            $uiOpen = request()->routeIs('admin.ui.*');
            $blogOpen = request()->routeIs('admin.blog-categories.*') || request()->routeIs('admin.blog-articles.*');
            $leadsOpen = request()->routeIs('admin.leads.*') || request()->routeIs('admin.contact-submissions.*');
            $teamOpen = request()->routeIs('admin.employees.*');
            $settingsOpen = request()->routeIs('admin.settings.*');
        ?>

        <?php echo $item('admin.dashboard', 'H', 'Dashboard'); ?>


        <details class="group" <?php echo e($leadsOpen ? 'open' : ''); ?>>
            <summary class="list-none cursor-pointer px-3 py-2.5 rounded-lg text-blue-100 hover:bg-blue-700 font-semibold flex items-center justify-between">
                <span class="flex items-center gap-3">
                    <span class="w-5 text-center">L</span>
                    <span>Lead Center</span>
                    <?php if(($panelUnreadLeadCount ?? 0) > 0): ?>
                        <span class="inline-flex min-w-[1.35rem] items-center justify-center rounded-full bg-red-500 px-1.5 py-0.5 text-[10px] font-bold text-white">
                            <?php echo e(($panelUnreadLeadCount ?? 0) > 9 ? '9+' : $panelUnreadLeadCount); ?>

                        </span>
                    <?php endif; ?>
                </span>
                <span class="text-xs group-open:rotate-180 transition">v</span>
            </summary>
            <div class="mt-1 space-y-1">
                <?php echo $sub('admin.leads.index', 'All Leads'); ?>

                <?php echo $sub('admin.contact-submissions.index', 'Contact Requests'); ?>

            </div>
        </details>

        <?php if(auth()->user()->isOwner() || auth()->user()->isAdmin()): ?>
            <details class="group" <?php echo e($teamOpen ? 'open' : ''); ?>>
                <summary class="list-none cursor-pointer px-3 py-2.5 rounded-lg text-blue-100 hover:bg-blue-700 font-semibold flex items-center justify-between">
                    <span class="flex items-center gap-3"><span class="w-5 text-center">U</span>Users & Team</span>
                    <span class="text-xs group-open:rotate-180 transition">v</span>
                </summary>
                <div class="mt-1 space-y-1">
                    <?php echo $sub('admin.employees.index', 'Team Members'); ?>

                </div>
            </details>
        <?php endif; ?>

        <details class="group" <?php echo e($contentOpen ? 'open' : ''); ?>>
            <summary class="list-none cursor-pointer px-3 py-2.5 rounded-lg text-blue-100 hover:bg-blue-700 font-semibold flex items-center justify-between">
                <span class="flex items-center gap-3"><span class="w-5 text-center">W</span>Website Content</span>
                <span class="text-xs group-open:rotate-180 transition">v</span>
            </summary>
            <div class="mt-1 space-y-1">
                <?php echo $sub('admin.home.edit', 'Home CMS'); ?>

                <?php echo $sub('admin.sections.index', 'Sections'); ?>

                <?php echo $sub('admin.pages.index', 'Pages'); ?>

                <details class="group/countries" <?php echo e($countriesOpen ? 'open' : ''); ?>>
                    <summary class="list-none cursor-pointer ml-8 px-3 py-2 rounded-md text-sm text-blue-200 hover:bg-blue-800 hover:text-white font-semibold flex items-center justify-between transition">
                        <span>Countries</span>
                        <span class="text-xs group-open/countries:rotate-180 transition">v</span>
                    </summary>
                    <div class="mt-0.5 space-y-0.5">
                        <?php
                            $cs = function(string $route, string $label) {
                                $active = request()->routeIs($route . '*');
                                return '<a href="' . route($route) . '" class="block ml-14 px-3 py-1.5 rounded-md text-xs transition '
                                    . ($active ? 'bg-blue-700 text-white font-semibold' : 'text-blue-300 hover:bg-blue-800 hover:text-white')
                                    . '">' . $label . '</a>';
                            };
                        ?>
                        <?php echo $cs('admin.countries.index', 'All Countries'); ?>                       
                        <?php echo $cs('admin.country-sections.edit', 'Country view Section'); ?>

                    </div>
                </details>
                <?php echo $sub('admin.countries.page.edit', 'Countries List Page'); ?>

                <?php echo $sub('admin.services.edit', 'Services Page CMS'); ?>

                <?php echo $sub('admin.success-stories.edit', 'Success Stories CMS'); ?>

                <?php echo $sub('admin.partner-institutions.index', 'Partner Institutions'); ?>

                <?php echo $sub('admin.our-partners.index', 'Our Partners'); ?>

                <?php echo $sub('admin.visa-stories.index', 'Visa Success Stories'); ?>

                <?php echo $sub('admin.student-reviews.index', 'Student Video Reviews'); ?>

                <?php echo $sub('admin.faqs.index', 'FAQs'); ?>

            </div>
        </details>

        <details class="group" <?php echo e($uiOpen ? 'open' : ''); ?>>
            <summary class="list-none cursor-pointer px-3 py-2.5 rounded-lg text-blue-100 hover:bg-blue-700 font-semibold flex items-center justify-between">
                <span class="flex items-center gap-3"><span class="w-5 text-center">D</span>Design & Layout</span>
                <span class="text-xs group-open:rotate-180 transition">v</span>
            </summary>
            <div class="mt-1 space-y-1">
                <?php echo $sub('admin.ui.sections', 'UI Sections Map'); ?>

            </div>
        </details>

        <details class="group" <?php echo e(request()->routeIs('admin.events.*') || request()->routeIs('admin.event-registrations.*') ? 'open' : ''); ?>>
            <summary class="list-none cursor-pointer px-3 py-2.5 rounded-lg text-blue-100 hover:bg-blue-700 font-semibold flex items-center justify-between">
                <span class="flex items-center gap-3"><span class="w-5 text-center">E</span>Events</span>
                <span class="text-xs group-open:rotate-180 transition">v</span>
            </summary>
            <div class="mt-1 space-y-1">
                <?php echo $sub('admin.events.index', 'All Events'); ?>

                <?php echo $sub('admin.event-registrations.index', 'Registrations'); ?>

            </div>
        </details>

        <details class="group" <?php echo e($blogOpen ? 'open' : ''); ?>>
            <summary class="list-none cursor-pointer px-3 py-2.5 rounded-lg text-blue-100 hover:bg-blue-700 font-semibold flex items-center justify-between">
                <span class="flex items-center gap-3">
                    <span class="w-5 text-center">B</span>
                    <span>Blog</span>
                    <?php if(($panelUnreadBlogCount ?? 0) > 0): ?>
                        <span class="inline-flex min-w-[1.35rem] items-center justify-center rounded-full bg-red-500 px-1.5 py-0.5 text-[10px] font-bold text-white">
                            <?php echo e(($panelUnreadBlogCount ?? 0) > 9 ? '9+' : $panelUnreadBlogCount); ?>

                        </span>
                    <?php endif; ?>
                </span>
                <span class="text-xs group-open:rotate-180 transition">v</span>
            </summary>
            <div class="mt-1 space-y-1">
                <?php echo $sub('admin.blog-articles.index', 'All Blogs'); ?>

                <?php echo $sub('admin.blog-categories.index', 'Blog Category'); ?>

            </div>
        </details>

        <?php if(auth()->user()->isOwner() || auth()->user()->isAdmin()): ?>
            <details class="group" <?php echo e($settingsOpen ? 'open' : ''); ?>>
                <summary class="list-none cursor-pointer px-3 py-2.5 rounded-lg text-blue-100 hover:bg-blue-700 font-semibold flex items-center justify-between">
                    <span class="flex items-center gap-3"><span class="w-5 text-center">S</span>Settings</span>
                    <span class="text-xs group-open:rotate-180 transition">v</span>
                </summary>
                <div class="mt-1 space-y-1">
                    <?php echo $sub('admin.settings.general.edit', 'General Settings'); ?>

                </div>
            </details>
        <?php endif; ?>
    </nav>

    <div class="p-4 border-t border-blue-800 space-y-2">
        <a href="<?php echo e(url('/')); ?>" target="_blank"
           class="flex items-center gap-2 text-sm text-blue-300 hover:text-white transition px-3 py-2 rounded-lg hover:bg-blue-700">
            View Website
        </a>
        <form method="POST" action="<?php echo e(route('logout')); ?>">
            <?php echo csrf_field(); ?>
            <button type="submit"
                    class="w-full flex items-center gap-2 px-3 py-2 text-sm text-blue-200 hover:text-white hover:bg-blue-700 rounded-lg transition">
                Sign Out
            </button>
        </form>
    </div>
</aside>
<?php /**PATH C:\xampp\htdocs\gps-migration\resources\views\admin\partials\sidebar.blade.php ENDPATH**/ ?>