@if ($paginator->hasPages())
    <nav>
        <ul class="flex items-center justify-center space-x-1 mt-6">
            {{-- Previous Page Link --}}
            @if ($paginator->onFirstPage())
                <li>
                    <span class="px-3 py-2 border border-gray-300 rounded-lg text-sm opacity-50 cursor-not-allowed">&laquo;</span>
                </li>
            @else
                <li>
                    <a class="px-3 py-2 border border-gray-300 rounded-lg hover:bg-gray-50 text-sm" href="{{ $paginator->previousPageUrl() }}">&laquo;</a>
                </li>
            @endif

            {{-- Pagination Elements --}}
            @foreach ($elements as $element)
                {{-- Array Of Links --}}
                @if (is_array($element))
                    @foreach ($element as $page => $url)
                        @if ($page == $paginator->currentPage())
                            <li>
                                <span class="px-3 py-2 border border-green-600 rounded-lg text-sm bg-green-600 text-white">{{ $page }}</span>
                            </li>
                        @else
                            <li>
                                <a class="px-3 py-2 border border-gray-300 rounded-lg hover:bg-gray-50 text-sm" href="{{ $url }}">{{ $page }}</a>
                            </li>
                        @endif
                    @endforeach
                @endif
            @endforeach

            {{-- Next Page Link --}}
            @if ($paginator->hasMorePages())
                <li>
                    <a class="px-3 py-2 border border-gray-300 rounded-lg hover:bg-gray-50 text-sm" href="{{ $paginator->nextPageUrl() }}">&raquo;</a>
                </li>
            @else
                <li>
                    <span class="px-3 py-2 border border-gray-300 rounded-lg text-sm opacity-50 cursor-not-allowed">&raquo;</span>
                </li>
            @endif
        </ul>
    </nav>
@endif
