<!-- Impersonation Banner -->
@if(session('impersonator_id'))
    <div class="bg-red-600 text-white">
        <div class="max-w-3xl mx-auto px-4">
            <div class="flex items-center justify-between py-2 text-sm">
                <span><strong>ADMIN MODE:</strong> viewing as {{ Auth::user()->name }} ({{ Auth::user()->email }})</span>
                <form method="POST" action="{{ route('admin.users.stop-impersonating') }}" class="inline">
                    @csrf
                    <button type="submit" class="underline">Stop</button>
                </form>
            </div>
        </div>
    </div>
@endif

<nav class="bg-white dark:bg-gray-900 border-b border-gray-200 dark:border-gray-700 fixed top-0 left-0 right-0 z-50">
    <div class="max-w-3xl mx-auto px-4">
        <div class="flex flex-wrap items-baseline justify-between gap-x-4 gap-y-1 h-20 content-center">
            <a href="{{ route('items.index') }}" class="font-semibold text-black dark:text-gray-100 hover:underline">
                {{ strtolower(config('app.name')) }}
            </a>

            <div class="flex flex-wrap items-baseline gap-x-4 gap-y-1 text-sm">
                <a href="{{ route('items.index') }}" class="text-gray-700 dark:text-gray-300 hover:underline">for sale</a>
                <a href="{{ route('deals.index') }}" class="text-gray-700 dark:text-gray-300 hover:underline">deals</a>
                @auth
                    <a href="{{ route('my-items.create') }}" class="text-gray-700 dark:text-gray-300 hover:underline">sell</a>
                    <a href="{{ route('messages.index') }}" class="text-gray-700 dark:text-gray-300 hover:underline">
                        messages{{ ($unreadMessagesCount ?? 0) > 0 ? ' (' . $unreadMessagesCount . ')' : '' }}
                    </a>
                    <a href="{{ route('dashboard') }}" class="text-gray-700 dark:text-gray-300 hover:underline">account</a>
                    @if(Auth::user()->is_admin)
                        <a href="{{ route('admin.dashboard') }}" class="text-gray-700 dark:text-gray-300 hover:underline">admin</a>
                    @endif
                @else
                    <a href="{{ route('login') }}" class="text-gray-700 dark:text-gray-300 hover:underline">sign in</a>
                    <a href="{{ route('register') }}" class="text-gray-700 dark:text-gray-300 hover:underline">join</a>
                @endauth
                <a href="{{ request()->fullUrlWithQuery(['ui' => 'classic']) }}" class="text-gray-400 dark:text-gray-500 hover:underline" title="Switch to the full interface with photos">photo view</a>
            </div>
        </div>
    </div>
</nav>
