<x-layouts.auth title="Masuk Admin">

<div class="min-h-screen flex">

    {{-- Kiri: Branding panel (hidden di mobile) --}}
    <div class="hidden lg:flex lg:w-1/2 bg-gradient-to-br from-orange-500 to-orange-600 flex-col justify-between p-12">
        <div>
            <div class="flex items-center gap-3">
                <div class="w-10 h-10 bg-white/20 rounded-xl flex items-center justify-center">
                    <span class="text-white font-bold text-lg">TB</span>
                </div>
                <span class="text-white font-bold text-xl">Titipin Ba Be</span>
            </div>
        </div>

        <div>
            <h1 class="text-white text-4xl font-bold leading-tight mb-4">
                Panel<br />Pengelola Toko
            </h1>
            <p class="text-orange-100 text-lg leading-relaxed">
                Kelola produk, pesanan, dan pembayaran<br />
                Desa Budiharja dari satu tempat.
            </p>
        </div>

        <div class="text-orange-200 text-sm">
            © {{ date('Y') }} Titipin Ba Be · Desa Budiharja
        </div>
    </div>

    {{-- Kanan: Form login --}}
    <div class="flex-1 flex items-center justify-center px-6 py-12 bg-white">
        <div class="w-full max-w-md">

            {{-- Mobile logo --}}
            <div class="flex items-center gap-3 mb-8 lg:hidden">
                <div class="w-10 h-10 bg-orange-500 rounded-xl flex items-center justify-center">
                    <span class="text-white font-bold text-lg">TB</span>
                </div>
                <span class="font-bold text-xl text-slate-800">Titipin Ba Be</span>
            </div>

            <h2 class="text-2xl font-bold text-slate-800 mb-1">Selamat datang</h2>
            <p class="text-slate-500 mb-8">Masuk ke panel admin untuk melanjutkan.</p>

            {{-- Flash error --}}
            @if (session('error'))
                <div class="mb-4 p-3 bg-red-50 border border-red-200 rounded-lg flex items-center gap-2 text-sm text-red-700">
                    <svg class="w-4 h-4 shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24" stroke-width="2">
                        <path stroke-linecap="round" stroke-linejoin="round"
                              d="M10 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2m7-2a9 9 0 11-18 0 9 9 0 0118 0z"/>
                    </svg>
                    {{ session('error') }}
                </div>
            @endif

            <form method="POST" action="{{ route('admin.login.post') }}" class="space-y-5">
                @csrf

                {{-- Email --}}
                <div>
                    <label for="email" class="block text-sm font-medium text-slate-700 mb-1.5">
                        Email
                    </label>
                    <input id="email"
                           type="email"
                           name="email"
                           value="{{ old('email') }}"
                           placeholder="admin@titipinbabe.com"
                           autofocus
                           autocomplete="email"
                           class="w-full h-11 px-4 bg-white border border-slate-300 rounded-lg text-sm
                                  text-slate-800 placeholder:text-slate-400
                                  focus:outline-none focus:ring-2 focus:ring-orange-500 focus:border-orange-500
                                  transition-colors" />
                    @error('email')
                        <p class="mt-1.5 text-xs text-red-600">{{ $message }}</p>
                    @enderror
                </div>

                {{-- Password --}}
                <div>
                    <label for="password" class="block text-sm font-medium text-slate-700 mb-1.5">
                        Password
                    </label>
                    <input id="password"
                           type="password"
                           name="password"
                           placeholder="••••••••"
                           autocomplete="current-password"
                           class="w-full h-11 px-4 bg-white border border-slate-300 rounded-lg text-sm
                                  text-slate-800 placeholder:text-slate-400
                                  focus:outline-none focus:ring-2 focus:ring-orange-500 focus:border-orange-500
                                  transition-colors" />
                    @error('password')
                        <p class="mt-1.5 text-xs text-red-600">{{ $message }}</p>
                    @enderror
                </div>

                {{-- Remember --}}
                <div class="flex items-center gap-2">
                    <input id="remember" type="checkbox" name="remember"
                           class="w-4 h-4 rounded border-slate-300 text-orange-500
                                  focus:ring-orange-500 accent-orange-500" />
                    <label for="remember" class="text-sm text-slate-600 cursor-pointer">
                        Ingat saya
                    </label>
                </div>

                {{-- Submit --}}
                <button type="submit"
                    class="w-full h-11 bg-orange-500 hover:bg-orange-600 active:bg-orange-700
                           text-white text-sm font-semibold rounded-lg
                           focus:outline-none focus:ring-2 focus:ring-orange-500 focus:ring-offset-2
                           transition-colors">
                    Masuk
                </button>

            </form>

        </div>
    </div>

</div>

</x-layouts.auth>
