@extends('layouts.app')

@section('title', 'Login Admin')

@section('content')
<div class="min-h-screen bg-gradient-to-br from-slate-900 to-slate-800 flex items-center justify-center py-12 px-4 sm:px-6 lg:px-8">
    <div class="max-w-md w-full space-y-8">
        <div>
            <div class="mx-auto h-12 w-12 flex items-center justify-center rounded-full bg-red-500">
                <span class="text-2xl">🔐</span>
            </div>
            <h2 class="mt-6 text-center text-3xl font-extrabold text-white">
                Login Admin
            </h2>
            <p class="mt-2 text-center text-sm text-slate-300">
                Portal Administrasi Toko Adenium
            </p>
        </div>

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

            <div class="rounded-md shadow-sm -space-y-px">
                <!-- Email -->
                <div>
                    <label for="email" class="sr-only">Alamat Email</label>
                    <input id="email" name="email" type="email" autocomplete="email" required
                           class="appearance-none rounded-none relative block w-full px-3 py-2 border border-slate-600 placeholder-slate-500 text-gray-900 rounded-t-md focus:outline-none focus:ring-red-500 focus:border-red-500 focus:z-10 sm:text-sm @error('email') border-red-500 @enderror"
                           placeholder="Email Admin" value="{{ old('email') }}">
                </div>

                <!-- Password -->
                <div>
                    <label for="password" class="sr-only">Password</label>
                    <input id="password" name="password" type="password" autocomplete="current-password" required
                           class="appearance-none rounded-none relative block w-full px-3 py-2 border border-slate-600 placeholder-slate-500 text-gray-900 rounded-b-md focus:outline-none focus:ring-red-500 focus:border-red-500 focus:z-10 sm:text-sm"
                           placeholder="Password">
                </div>
            </div>

            @if ($errors->any())
                <div class="rounded-md bg-red-50 p-4">
                    <div class="flex">
                        <div class="ml-3">
                            <h3 class="text-sm font-medium text-red-800">
                                Terjadi kesalahan:
                            </h3>
                            <div class="mt-2 text-sm text-red-700">
                                <ul role="list" class="list-disc pl-5 space-y-1">
                                    @foreach ($errors->all() as $error)
                                        <li>{{ $error }}</li>
                                    @endforeach
                                </ul>
                            </div>
                        </div>
                    </div>
                </div>
            @endif

            <div>
                <button type="submit"
                        class="group relative w-full flex justify-center py-2 px-4 border border-transparent text-sm font-medium rounded-md text-white bg-red-600 hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-red-500">
                    Login
                </button>
            </div>

            <div class="text-center">
                <p class="text-sm text-slate-300">
                    <a href="{{ route('home') }}" class="font-medium text-red-400 hover:text-red-300">
                        Kembali ke halaman utama
                    </a>
                </p>
            </div>
        </form>
    </div>
</div>
@endsection
