<nav x-data="{ open: false }" class="border-b border-zinc-200 bg-white dark:border-zinc-800 dark:bg-zinc-900">
    <div class="mx-auto max-w-7xl px-5 sm:px-6 lg:px-8">
        <div class="flex h-16 justify-between">
            <div class="flex items-center">
                <a href="{{ route('dashboard') }}" class="flex items-center gap-3">
                    @include('partials.website-brand', [
                        'class' => 'text-xl font-extrabold tracking-normal text-zinc-950 dark:text-white',
                        'imageClass' => 'h-9 max-w-36 object-contain',
                    ])
                </a>

                <div class="hidden space-x-2 sm:ms-10 sm:flex">
                    <a href="{{ route('dashboard') }}" class="rounded-md px-3 py-2 text-sm font-bold {{ request()->routeIs('dashboard') ? 'bg-emerald-50 text-emerald-800 dark:bg-emerald-950 dark:text-emerald-200' : 'text-zinc-600 hover:bg-zinc-100 hover:text-zinc-950 dark:text-zinc-300 dark:hover:bg-zinc-800 dark:hover:text-white' }}">Dashboard</a>
                    <a href="{{ route('links.index') }}" class="rounded-md px-3 py-2 text-sm font-bold {{ request()->routeIs('links.*') ? 'bg-emerald-50 text-emerald-800 dark:bg-emerald-950 dark:text-emerald-200' : 'text-zinc-600 hover:bg-zinc-100 hover:text-zinc-950 dark:text-zinc-300 dark:hover:bg-zinc-800 dark:hover:text-white' }}">Links</a>
                </div>
            </div>

            <div class="hidden items-center gap-3 sm:flex">
                <a href="{{ route('links.create') }}" class="rounded-md bg-emerald-600 px-4 py-2 text-sm font-extrabold text-white shadow-sm shadow-emerald-900/20 hover:bg-emerald-700">New link</a>
                <x-dropdown align="right" width="48">
                    <x-slot name="trigger">
                        <button class="inline-flex items-center gap-2 rounded-md border border-zinc-200 bg-white px-3 py-2 text-sm font-bold text-zinc-700 transition hover:bg-zinc-50 hover:text-zinc-950 focus:outline-none dark:border-zinc-700 dark:bg-zinc-900 dark:text-zinc-200 dark:hover:bg-zinc-800 dark:hover:text-white">
                            <span class="grid h-7 w-7 place-items-center rounded-md bg-rose-100 text-xs font-extrabold text-rose-800 dark:bg-rose-950 dark:text-rose-200">{{ Str::of(Auth::user()->name)->substr(0, 1)->upper() }}</span>
                            <span>{{ Auth::user()->name }}</span>
                            <svg class="h-4 w-4 fill-current" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20">
                                <path fill-rule="evenodd" d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z" clip-rule="evenodd" />
                            </svg>
                        </button>
                    </x-slot>

                    <x-slot name="content">
                        <x-dropdown-link :href="route('profile.edit')">
                            {{ __('Profile') }}
                        </x-dropdown-link>

                        <form method="POST" action="{{ route('logout') }}">
                            @csrf
                            <x-dropdown-link :href="route('logout')" onclick="event.preventDefault(); this.closest('form').submit();">
                                {{ __('Log Out') }}
                            </x-dropdown-link>
                        </form>
                    </x-slot>
                </x-dropdown>
            </div>

            <div class="-me-2 flex items-center sm:hidden">
                <button @click="open = ! open" class="inline-flex items-center justify-center rounded-md p-2 text-zinc-500 transition hover:bg-zinc-100 hover:text-zinc-900 focus:outline-none dark:text-zinc-300 dark:hover:bg-zinc-800 dark:hover:text-white">
                    <svg class="h-6 w-6" stroke="currentColor" fill="none" viewBox="0 0 24 24">
                        <path :class="{'hidden': open, 'inline-flex': ! open }" class="inline-flex" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16M4 18h16" />
                        <path :class="{'hidden': ! open, 'inline-flex': open }" class="hidden" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12" />
                    </svg>
                </button>
            </div>
        </div>
    </div>

    <div :class="{'block': open, 'hidden': ! open}" class="hidden border-t border-zinc-200 bg-white sm:hidden dark:border-zinc-800 dark:bg-zinc-900">
        <div class="space-y-1 px-4 py-3">
            <a href="{{ route('dashboard') }}" class="block rounded-md px-3 py-2 text-sm font-bold {{ request()->routeIs('dashboard') ? 'bg-emerald-50 text-emerald-800 dark:bg-emerald-950 dark:text-emerald-200' : 'text-zinc-700 dark:text-zinc-200' }}">Dashboard</a>
            <a href="{{ route('links.index') }}" class="block rounded-md px-3 py-2 text-sm font-bold {{ request()->routeIs('links.*') ? 'bg-emerald-50 text-emerald-800 dark:bg-emerald-950 dark:text-emerald-200' : 'text-zinc-700 dark:text-zinc-200' }}">Links</a>
            <a href="{{ route('links.create') }}" class="block rounded-md px-3 py-2 text-sm font-bold text-emerald-700 dark:text-emerald-300">New link</a>
        </div>

        <div class="border-t border-zinc-200 px-4 py-4 dark:border-zinc-800">
            <div class="font-bold text-zinc-950 dark:text-white">{{ Auth::user()->name }}</div>
            <div class="text-sm font-semibold text-zinc-500">{{ Auth::user()->email }}</div>
            <div class="mt-3 space-y-1">
                <a href="{{ route('profile.edit') }}" class="block rounded-md px-3 py-2 text-sm font-bold text-zinc-700 dark:text-zinc-200">Profile</a>
                <form method="POST" action="{{ route('logout') }}">
                    @csrf
                    <a href="{{ route('logout') }}" onclick="event.preventDefault(); this.closest('form').submit();" class="block rounded-md px-3 py-2 text-sm font-bold text-zinc-700 dark:text-zinc-200">Log out</a>
                </form>
            </div>
        </div>
    </div>
</nav>
