@php
    $showBottomNav = auth()->check()
        && (int) (auth()->user()->usertype ?? 0) === 4
        && !request()->routeIs('examslive');

    $isFrontRoute = fn (...$patterns) => request()->routeIs(...$patterns);
    $bottomNavItems = [
        [
            'route' => 'competitionlist',
            'label' => 'Home',
            'icon' => 'fa-home',
            'active' => $isFrontRoute('competitionlist', 'contestdetails', 'competitionjoin', 'examstart'),
        ],
        [
            'route' => 'scholershipresult',
            'label' => 'Results',
            'icon' => 'fa-trophy',
            'active' => $isFrontRoute('scholershipresult', 'myexamresultdetails', 'examsresultt', 'examsanswersheet', 'scoringresult'),
        ],
        [
            'route' => 'walletrecharge',
            'label' => 'Wallet',
            'icon' => 'fa-credit-card',
            'active' => $isFrontRoute('walletrecharge', 'walletamount', 'wallethistory', 'userwithdraw', 'withdrawhistory'),
        ],
        [
            'route' => 'gamehistory',
            'label' => 'History',
            'icon' => 'fa-history',
            'active' => $isFrontRoute('gamehistory'),
        ],
        [
            'route' => 'editprofile',
            'label' => 'Profile',
            'icon' => 'fa-user',
            'active' => $isFrontRoute('editprofile', 'profileimg', 'mobileotp', 'emailvarification', 'userpasswordchange'),
        ],
    ];
@endphp

@if ($showBottomNav)
    <nav class="jel-bottom-nav" aria-label="Student quick navigation">
        @foreach ($bottomNavItems as $item)
            <a href="{{ route($item['route']) }}" class="{{ $item['active'] ? 'active' : '' }}">
                <i class="fa {{ $item['icon'] }}"></i>
                <span class="jel-bottom-nav__label">{{ $item['label'] }}</span>
            </a>
        @endforeach
    </nav>
@endif
