@php
    $navSections = [
        [
            'items' => [
                ['label' => 'Dashboard', 'route' => 'admin.dashboard', 'pattern' => 'admin.dashboard'],
            ],
        ],
        [
            'label' => 'Classes',
            'items' => [
                ['label' => 'Class Types', 'route' => 'admin.class-types.index', 'pattern' => 'admin.class-types.*'],
                ['label' => 'Class Sessions', 'route' => 'admin.class-sessions.index', 'pattern' => 'admin.class-sessions.*'],
                ['label' => 'Schedule Settings', 'route' => 'admin.schedule-settings.edit', 'pattern' => 'admin.schedule-settings.*'],
            ],
        ],
        [
            'label' => 'People',
            'items' => [
                ['label' => 'Coaches', 'route' => 'admin.coaches.index', 'pattern' => 'admin.coaches.*'],
            ],
        ],
        [
            'label' => 'Membership',
            'items' => [
                ['label' => 'Membership Tiers', 'route' => 'admin.membership-tiers.index', 'pattern' => 'admin.membership-tiers.*'],
                ['label' => 'Class Packs', 'route' => 'admin.class-packs.index', 'pattern' => 'admin.class-packs.*'],
            ],
        ],
        [
            'label' => 'Site Content',
            'items' => [
                ['label' => 'Testimonials', 'route' => 'admin.testimonials.index', 'pattern' => 'admin.testimonials.*'],
                ['label' => 'Gallery Sections', 'route' => 'admin.gallery-sections.index', 'pattern' => 'admin.gallery-sections.*'],
                ['label' => 'Gallery Images', 'route' => 'admin.gallery-images.index', 'pattern' => 'admin.gallery-images.*'],
                ['label' => 'FAQs', 'route' => 'admin.faqs.index', 'pattern' => 'admin.faqs.*'],
                ['label' => 'Content Blocks', 'route' => 'admin.content-blocks.index', 'pattern' => 'admin.content-blocks.*'],
            ],
        ],
        [
            'items' => [
                ['label' => 'Contact Submissions', 'route' => 'admin.contact-submissions.index', 'pattern' => 'admin.contact-submissions.*'],
            ],
        ],
    ];
@endphp

<aside class="w-[210px] min-w-[210px] bg-ink-3 flex flex-col h-screen overflow-y-auto">
    <div class="flex items-center gap-2.5 px-4 py-4 border-b border-white/10">
        <div class="w-8 h-8 bg-brass rounded-md flex items-center justify-center shrink-0">
            <span class="font-display font-bold text-sm text-white leading-none">HB</span>
        </div>
        <div class="min-w-0">
            <span class="text-white font-display font-bold text-sm tracking-wide block leading-tight">HEAD BANGERS</span>
            <span class="text-gray-500 text-[10px] uppercase tracking-wider">Admin</span>
        </div>
    </div>

    <nav class="flex-1 px-2 py-3 space-y-0.5">
        @foreach ($navSections as $section)
            @if (! empty($section['label']))
                <div class="admin-sidebar-section">{{ $section['label'] }}</div>
            @endif
            @foreach ($section['items'] as $item)
                <a
                    href="{{ route($item['route']) }}"
                    @class(['admin-sidebar-link', 'active' => request()->routeIs($item['pattern'])])
                >
                    {{ $item['label'] }}
                </a>
            @endforeach
        @endforeach
    </nav>

    <div class="px-2 pb-4 border-t border-white/10 pt-3">
        <form method="POST" action="{{ route('logout') }}">
            @csrf
            <button type="submit" class="admin-sidebar-link w-full text-left">
                <svg class="w-4 h-4 shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                    <path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.8" d="M17 16l4-4m0 0l-4-4m4 4H7m6 4v1a3 3 0 01-3 3H6a3 3 0 01-3-3V7a3 3 0 013-3h4a3 3 0 013 3v1"/>
                </svg>
                Log Out
            </button>
        </form>
    </div>
</aside>
