<section>
    <header>
        <h2 class="text-lg font-extrabold text-zinc-950 dark:text-white">
            {{ __('Profile Information') }}
        </h2>

        <p class="mt-1 text-sm font-semibold text-zinc-600 dark:text-zinc-300">
            {{ __("Update your account's profile information and email address.") }}
        </p>
    </header>

    <form id="send-verification" method="post" action="{{ route('verification.send') }}">
        @csrf
    </form>

    <form method="post" action="{{ route('profile.update') }}" class="mt-6 space-y-6">
        @csrf
        @method('patch')

        <div>
            <x-input-label for="name" :value="__('Name')" />
            <x-text-input id="name" name="name" type="text" class="mt-1 block w-full" :value="old('name', $user->name)" required autofocus autocomplete="name" />
            <x-input-error class="mt-2" :messages="$errors->get('name')" />
        </div>

        <div>
            <x-input-label for="email" :value="__('Email')" />
            <x-text-input id="email" name="email" type="email" class="mt-1 block w-full" :value="old('email', $user->email)" required autocomplete="username" />
            <x-input-error class="mt-2" :messages="$errors->get('email')" />

            @if ($user instanceof \Illuminate\Contracts\Auth\MustVerifyEmail && ! $user->hasVerifiedEmail())
                <div>
                    <p class="mt-2 text-sm text-zinc-800 dark:text-zinc-200">
                        {{ __('Your email address is unverified.') }}

                        <button form="send-verification" class="rounded-md text-sm font-bold text-emerald-700 underline hover:text-emerald-900 focus:outline-none focus:ring-2 focus:ring-emerald-500 focus:ring-offset-2 dark:text-emerald-300 dark:hover:text-emerald-100 dark:focus:ring-offset-zinc-900">
                            {{ __('Click here to re-send the verification code.') }}
                        </button>
                    </p>

                    @if (session('status') === 'verification-code-sent')
                        <p class="mt-2 font-medium text-sm text-green-600 dark:text-green-400">
                            {{ __('A new verification code has been sent to your email address.') }}
                        </p>
                    @endif

                    @if (session('status') === 'verification-code-send-failed')
                        <p class="mt-2 text-sm font-semibold text-amber-700 dark:text-amber-300">
                            {{ session('verification_send_error', __('We could not email the verification code. Please check your mailer settings and try again.')) }}
                        </p>
                    @endif
                </div>
            @endif
        </div>

        <div class="flex items-center gap-4">
            <x-primary-button>{{ __('Save') }}</x-primary-button>

            @if (session('status') === 'profile-updated')
                <p
                    x-data="{ show: true }"
                    x-show="show"
                    x-transition
                    x-init="setTimeout(() => show = false, 2000)"
                    class="text-sm font-semibold text-zinc-600 dark:text-zinc-300"
                >{{ __('Saved.') }}</p>
            @endif
        </div>
    </form>
</section>
