@php
    /** @var \App\Models\Dealer|null $dealer */
    $loginAccent = isset($dealer) ? $dealer->loginEffectiveAccentColor() : 'var(--dealer-accent-color)';
@endphp

<x-guest-layout :dealer="$dealer">
    <div class="mb-4 text-sm text-gray-600">
        {{ __('Forgot your password? No problem. Just let us know your email address and we will email you a password reset link that will allow you to choose a new one.') }}
    </div>

    <!-- Session Status -->
    <x-auth-session-status class="mb-4" :status="session('status')" />

    <form
        method="POST"
        action="{{ isset($dealer) ? route('dealer.password.email', ['code' => $dealer->code]) : route('password.email') }}"
    >
        @csrf

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

        <div class="flex items-center justify-between mt-4">
            <a
                href="{{ isset($dealer) ? route('dealer.login.show', ['code' => $dealer->code]) : route('login') }}"
                class="text-sm text-gray-600 hover:text-gray-900 rounded-md focus:outline-none focus:ring-2 focus:ring-offset-2"
                style="--tw-ring-color: {{ $loginAccent }};"
            >
                Back to login
            </a>
            <button
                type="submit"
                class="inline-flex items-center px-4 py-2 rounded-md text-sm font-semibold text-white shadow-sm focus:outline-none focus:ring-2 focus:ring-offset-2"
                style="
                    background-color: {{ $loginAccent }};
                    border-color: {{ $loginAccent }};
                    --tw-ring-color: {{ $loginAccent }};
                "
            >
                {{ __('Email Password Reset Link') }}
            </button>
        </div>
    </form>
</x-guest-layout>
