@extends('app')

@section('title', 'S\'inscrire - (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">S'inscrire</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('register.store') }}" method="POST" class="space-y-4">
                @csrf
                <div>
                    <label for="Pseudo" class="block text-sm font-bold mb-2 text-gray-700">Pseudo</label>
                    <input 
                        type="text" 
                        id="Pseudo" 
                        name="Pseudo" 
                        required 
                        value="{{ old('Pseudo') }}"
                        maxlength="100"
                        class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-niagara outline-none @error('Pseudo') border-red-500 @enderror">
                    @error('Pseudo')
                        <p class="text-red-600 text-xs mt-1">{{ $message }}</p>
                    @enderror
                </div>
                
                <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 
                        minlength="8"
                        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>
                
                <div>
                    <label for="MotDePasse_confirmation" class="block text-sm font-bold mb-2 text-gray-700">Confirmer le mot de passe</label>
                    <input 
                        type="password" 
                        id="MotDePasse_confirmation" 
                        name="MotDePasse_confirmation" 
                        required 
                        minlength="8"
                        class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-niagara outline-none">
                </div>
                
                <button type="submit" class="w-full py-3 gradient-niagara text-white font-bold rounded-lg hover:shadow-lg transition-smooth duration-200">
                    S'inscrire
                </button>
            </form>
            
            <p class="text-center mt-6 text-gray-600">
                Déjà inscrit? <a href="{{ route('login') }}" class="text-niagara font-bold hover:underline">Se connecter</a>
            </p>
        </div>
    </section>
@endsection
