<?php
    use App\Models\Work;
    use App\Models\ServiceCategory;

    // only for existence check
    $hasProjects = Work::exists();
?>

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <title>EggFirst · Internal Console</title>

    <!-- ✅ Tailwind CDN (Official) -->
    <script src="https://cdn.tailwindcss.com"></script>

    <?php echo app('Illuminate\Foundation\Vite')(['resources/css/app.css', 'resources/js/app.js']); ?>

    <?php echo \Livewire\Mechanisms\FrontendAssets\FrontendAssets::styles(); ?>


    <!-- Lucide Icons -->
    <script src="https://unpkg.com/lucide@latest"></script>
</head>




<body class="bg-[#f6f3ef] text-gray-800">

    <div class="flex min-h-screen">


        <!-- ================= SIDEBAR (FIXED) ================= -->
        <aside
            class="fixed top-0 left-0 h-screen w-[280px]
           bg-white
           border-r border-gray-200
           flex flex-col
           shadow-[8px_0_30px_-20px_rgba(0,0,0,0.15)]
           z-40">


            <!-- ================= BRAND ================= -->
            <div class="px-6 py-6 flex items-center gap-4 border-b relative">
                <div class="absolute inset-x-0 top-0 h-px bg-gray-200/60"></div>

                <div class="w-10 h-10 rounded-xl bg-[#f38121]/10 flex items-center justify-center">
                    <i data-lucide="grid" class="w-5 h-5 text-[#f38121]"></i>
                </div>

                <div class="leading-tight">
                    <h1 class="font-semibold text-gray-900 text-[15px] tracking-tight">
                        EggFirst
                    </h1>
                    <p class="text-[11px] text-gray-400 tracking-wide">
                        Admin Console
                    </p>
                </div>
            </div>

            <?php
                $is = fn($path) => request()->is($path);
                $isRoute = fn($name) => request()->routeIs($name);
                $active = 'bg-[#f38121]/10 text-[#f38121] font-medium';
                $inactive = 'text-gray-600 hover:bg-gray-100 hover:text-gray-900';
            ?>

            <!-- ================= NAV ================= -->
            <nav class="flex-1 px-3 py-6 space-y-7 text-sm overflow-y-auto">

                <!-- OVERVIEW -->
                <div>
                    <p class="px-4 mb-3 text-[10px] uppercase tracking-[0.35em] text-gray-400">
                        Overview
                    </p>

                    <a href="<?php echo e(route('admin.dashboard')); ?>"
                        class="relative flex items-center gap-3 px-4 py-3 rounded-xl transition
               <?php echo e($is('console/dashboard') ? $active : $inactive); ?>">
                        <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($is('console/dashboard')): ?>
                            <span
                                class="absolute left-0 top-1/2 -translate-y-1/2
                                 w-[3px] h-6 bg-[#f38121] rounded-full"></span>
                        <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                        <i data-lucide="home" class="w-4 h-4"></i>
                        <span>Dashboard</span>
                    </a>
                </div>

                <!-- MENUS -->
                <div>
                    <p class="px-4 mb-3 text-[10px] uppercase tracking-[0.35em] text-gray-400">
                        Navigation
                    </p>

                    <a href="<?php echo e(route('admin.menus.list')); ?>"
                        class="flex items-center gap-3 px-4 py-3 rounded-xl transition
                   <?php echo e(request()->routeIs('admin.menus.*') ? $active : $inactive); ?>">
                        <i data-lucide="menu" class="w-4 h-4"></i>
                        <span>Menus</span>
                    </a>

                </div>


                <!-- WORK -->
                <div>
                    <p class="px-4 mb-3 text-[10px] uppercase tracking-[0.35em] text-gray-400">
                        Work
                    </p>

                    <div class="space-y-1">
                        <a href="<?php echo e(route('admin.projects')); ?>"
                            class="flex items-center gap-3 px-4 py-3 rounded-xl transition
                    <?php echo e($is('console/projects') ? $active : $inactive); ?>">
                            <i data-lucide="folder" class="w-4 h-4"></i>
                            <span>Projects</span>
                        </a>

                        <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($hasProjects): ?>
                            <a href="<?php echo e(route('admin.projects.details.view')); ?>"
                                class="flex items-center gap-3 px-4 py-3 rounded-xl transition
                        <?php echo e(request()->routeIs('admin.projects.details*') ? $active : $inactive); ?>">
                                <i data-lucide="file-text" class="w-4 h-4"></i>
                                <span>Project Details</span>
                            </a>
                        <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                    </div>
                </div>
                

                <!-- SERVICES -->
                <div>
                    <p class="px-4 mb-3 text-[10px] uppercase tracking-[0.35em] text-gray-400">
                        Services
                    </p>

                    <div class="space-y-1">
                        
                   
                    <!-- Services OverView Page -->
<a href="<?php echo e(route('admin.services.page.list')); ?>"
   class="flex items-center gap-3 px-4 py-3 rounded-xl transition
   <?php echo e($isRoute('admin.services.page.list') ? $active : $inactive); ?>">
    <i data-lucide="list" class="w-4 h-4"></i>
    <span>Services Page CMS</span>
</a>

                        
                        <a href="<?php echo e(route('admin.services')); ?>"
                            class="flex items-center gap-3 px-4 py-3 rounded-xl transition
                   <?php echo e($isRoute('admin.services') ? $active : $inactive); ?>">
                            <i data-lucide="layers" class="w-4 h-4"></i>
                            <span>Service Categories</span>
                        </a>

                        <?php
                            $defaultCategory = ServiceCategory::where('status', 1)->orderBy('position')->first();
                        ?>

                        <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($defaultCategory): ?>
                            <a href="<?php echo e(route('admin.services.category.view', $defaultCategory->slug)); ?>"
                                class="flex items-center gap-3 px-4 py-3 rounded-xl transition
                       <?php echo e($isRoute('admin.services.category.view*') ? $active : $inactive); ?>">
                                <i data-lucide="folder-open" class="w-4 h-4"></i>
                                <span>View Services</span>
                            </a>
                        <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                    </div>
                </div>

                <!-- BLOGS -->
                <div>
                    <p class="px-4 mb-3 text-[10px] uppercase tracking-[0.35em] text-gray-400">
                        Content
                    </p>

                    <div class="space-y-1">
                        <a href="/console/blogs"
                            class="flex items-center gap-3 px-4 py-3 rounded-xl transition
                    <?php echo e($is('console/blogs*') ? $active : $inactive); ?>">
                            <i data-lucide="file-text" class="w-4 h-4"></i>
                            <span>Blogs</span>
                        </a>
                        
                        <!-- CONTACT LEADS -->
                    <a href="/console/contact-leads"
                        class="flex items-center gap-3 px-4 py-3 rounded-xl transition
                        <?php echo e($is('console/contact-leads*') ? $active : $inactive); ?>">
                        <i data-lucide="inbox" class="w-4 h-4"></i>
                        <span>Contact Leads</span>
                    </a>
                    
                    
                        <!-- CAREERS -->
                    <a href="/console/job-openings"
                            class="flex items-center gap-3 px-4 py-3 rounded-xl transition
                       <?php echo e($is('console/job-openings*') ? $active : $inactive); ?>">
                            <i data-lucide="briefcase" class="w-4 h-4"></i>
                            <span>Job Openings</span>
                    </a>    
                        
                        
                        
                    </div>
                </div>


                <!-- SETTINGS -->
                <div>
                    <p class="px-4 mb-3 text-[10px] uppercase tracking-[0.35em] text-gray-400">
                        Settings
                    </p>

                    <div class="space-y-1">
                        <a href="/console/users"
                            class="flex items-center gap-3 px-4 py-3 rounded-xl transition
                   <?php echo e($is('console/users') ? $active : $inactive); ?>">
                            <i data-lucide="users" class="w-4 h-4"></i>
                            <span>Admin Users</span>
                        </a>

                        <a href="/console/settings"
                            class="flex items-center gap-3 px-4 py-3 rounded-xl transition
                   <?php echo e($is('console/settings') ? $active : $inactive); ?>">
                            <i data-lucide="settings" class="w-4 h-4"></i>
                            <span>System Settings</span>
                        </a>
                    </div>
                </div>

            </nav>

            <!-- ================= USER + LOGOUT ================= -->
            <div class="px-6 py-5 border-t relative space-y-4">



                <!-- LOGOUT -->
                <form method="POST" action="<?php echo e(route('admin.logout')); ?>">
                    <?php echo csrf_field(); ?>

                    <button type="submit" onclick="return confirm('Are you sure you want to logout?')"
                        class="w-full flex items-center gap-3 px-4 py-3 rounded-xl
               text-red-600 hover:bg-red-50 transition">
                        <i data-lucide="log-out" class="w-4 h-4"></i>
                        <span>Logout</span>
                    </button>
                </form>

            </div>

        </aside>




        <!-- ================= MAIN ================= -->
        <div class="flex-1 flex flex-col">
            <header class="h-[72px] bg-white border-b border-gray-100 px-10 flex items-center">
                <h2 class="text-xl font-semibold text-gray-900">Dashboard</h2>
            </header>

            <main class="p-5">
                <?php echo e($slot); ?>

            </main>
        </div>

    </div>

    <?php echo \Livewire\Mechanisms\FrontendAssets\FrontendAssets::scripts(); ?>

    <script>
        lucide.createIcons();
    </script>
   <script src="https://cdnjs.cloudflare.com/ajax/libs/tinymce/6.7.2/tinymce.min.js" referrerpolicy="no-referrer"></script>

   <script>
document.addEventListener('livewire:init', function () {

    tinymce.init({
        selector: '#editor',
        height: 350,
        menubar: false,
        plugins: 'lists link table code',
        toolbar: 'undo redo | bold italic underline | bullist numlist | link table | code',
        content_style: `
            body { font-family: Inter, sans-serif; font-size:14px; }
            ul { list-style: disc; padding-left: 20px; }
            ol { list-style: decimal; padding-left: 20px; }
        `,
        setup: function (editor) {
            editor.on('init change keyup', function () {
                const componentEl = editor.targetElm.closest('[wire\\:id]');
                const componentId = componentEl?.getAttribute('wire:id');
                if (componentId) {
                    Livewire.find(componentId).set('content', editor.getContent());
                }
            });
        }
    });

});
</script>




</body>

</html>
<?php /**PATH /home/eggfirst/public_html/video.eggfirst.com/resources/views/layouts/admin.blade.php ENDPATH**/ ?>