@extends('app')

@section('title', 'Connexion - (RE)Sources Relationnelles')

@section('content')
    <section class="container mx-auto px-4 py-16">
        <div class="max-w-md mx-auto bg-white rounded-xl border border-gray-200 p-8">
            <h1 class="text-2xl font-bold mb-6 text-center text-niagara">Connexion</h1>
            
            @if ($errors->any())
                <div class="mb-4 p-4 bg-red-50 border border-red-200 rounded-lg">
                    @foreach ($errors->all() as $error)
                        <p class="text-red-700 text-sm">{{ $error }}</p>
                    @endforeach
                </div>
            @endif
            
            <form action="{{ route('login.store') }}" method="POST" class="space-y-4">
                @csrf
                <div>
                    <label for="Email" class="block text-sm font-bold mb-2 text-gray-700">Email</label>
                    <input 
                        type="email" 
                        id="Email" 
                        name="Email" 
                        required 
                        value="{{ old('Email') }}"
                        class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-niagara outline-none @error('Email') border-red-500 @enderror">
                    @error('Email')
                        <p class="text-red-600 text-xs mt-1">{{ $message }}</p>
                    @enderror
                </div>
                
                <div>
                    <label for="MotDePasse" class="block text-sm font-bold mb-2 text-gray-700">Mot de passe</label>
                    <input 
                        type="password" 
                        id="MotDePasse" 
                        name="MotDePasse" 
                        required 
                        class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-niagara outline-none @error('MotDePasse') border-red-500 @enderror">
                    @error('MotDePasse')
                        <p class="text-red-600 text-xs mt-1">{{ $message }}</p>
                    @enderror
                </div>
                
                <button type="submit" class="w-full py-3 gradient-niagara text-white font-bold rounded-lg hover:shadow-lg transition-smooth duration-200">
                    Se connecter
                </button>
            </form>
            
            <p class="text-center mt-6 text-gray-600">
                Pas encore inscrit? <a href="{{ route('register') }}" class="text-niagara font-bold hover:underline">S'inscrire</a>
            </p>
        </div>
    </section>
@endsection
