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

    @if (app()->environment('local') && config('poskn.dev_admin_email') && config('poskn.dev_admin_password'))
        <div class="mb-6 rounded-lg border border-amber-500/40 bg-amber-500/10 p-4 text-sm text-amber-100 dark:text-amber-200">
            <p class="font-semibold text-amber-200 dark:text-amber-100">{{ __('Modo prueba — credenciales de administrador') }}</p>
            <p class="mt-1 text-xs text-amber-200/80 dark:text-amber-200/70">{{ __('Solo visible con APP_ENV=local. En producción no se muestra.') }}</p>
            <dl class="mt-3 space-y-2 font-mono text-xs sm:text-sm">
                <div class="flex flex-col gap-1 sm:flex-row sm:items-center sm:justify-between">
                    <dt class="shrink-0 text-amber-200/90">{{ __('Correo') }}</dt>
                    <dd class="flex min-w-0 flex-1 items-center gap-2 sm:justify-end">
                        <code class="max-w-full truncate rounded bg-black/30 px-2 py-1 text-amber-50">{{ config('poskn.dev_admin_email') }}</code>
                        <button type="button"
                            class="shrink-0 rounded bg-amber-600/80 px-2 py-1 text-xs font-medium text-white hover:bg-amber-600"
                            onclick="navigator.clipboard.writeText(@js(config('poskn.dev_admin_email')))">
                            {{ __('Copiar') }}
                        </button>
                    </dd>
                </div>
                <div class="flex flex-col gap-1 sm:flex-row sm:items-center sm:justify-between">
                    <dt class="shrink-0 text-amber-200/90">{{ __('Contraseña') }}</dt>
                    <dd class="flex min-w-0 flex-1 items-center gap-2 sm:justify-end">
                        <code class="max-w-full truncate rounded bg-black/30 px-2 py-1 text-amber-50">{{ config('poskn.dev_admin_password') }}</code>
                        <button type="button"
                            class="shrink-0 rounded bg-amber-600/80 px-2 py-1 text-xs font-medium text-white hover:bg-amber-600"
                            onclick="navigator.clipboard.writeText(@js(config('poskn.dev_admin_password')))">
                            {{ __('Copiar') }}
                        </button>
                    </dd>
                </div>
            </dl>
        </div>
    @endif

    <form method="POST" action="{{ route('login') }}">
        @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 autocomplete="username" />
            <x-input-error :messages="$errors->get('email')" class="mt-2" />
        </div>

        <!-- Password -->
        <div class="mt-4">
            <x-input-label for="password" :value="__('Password')" />

            <x-text-input id="password" class="block mt-1 w-full"
                            type="password"
                            name="password"
                            required autocomplete="current-password" />

            <x-input-error :messages="$errors->get('password')" class="mt-2" />
        </div>

        <!-- Remember Me -->
        <div class="block mt-4">
            <label for="remember_me" class="inline-flex items-center">
                <input id="remember_me" type="checkbox" class="rounded dark:bg-gray-900 border-gray-300 dark:border-gray-700 text-indigo-600 shadow-sm focus:ring-indigo-500 dark:focus:ring-indigo-600 dark:focus:ring-offset-gray-800" name="remember">
                <span class="ms-2 text-sm text-gray-600 dark:text-gray-400">{{ __('Remember me') }}</span>
            </label>
        </div>

        <div class="flex items-center justify-end mt-4">
            @if (Route::has('password.request'))
                <a class="underline text-sm text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-100 rounded-md focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 dark:focus:ring-offset-gray-800" href="{{ route('password.request') }}">
                    {{ __('Forgot your password?') }}
                </a>
            @endif

            <x-primary-button class="ms-3">
                {{ __('Log in') }}
            </x-primary-button>
        </div>
    </form>
</x-guest-layout>
