@extends('layouts.frontend')

@section('title', 'Registrasi Member Baru')

@section('content')
<div class="max-w-xl mx-auto bg-white border border-gray-200 rounded-2xl shadow-sm p-8 my-4">
    <div class="text-center mb-6">
        <h2 class="text-2xl font-bold text-gray-900">Pendaftaran Member Baru</h2>
        <p class="text-sm text-gray-500 mt-1">Dapatkan keuntungan poin loyalitas disetiap pembelanjaan sembako</p>
    </div>

    @if($errors->any())
    <div class="mb-4 bg-red-50 border border-red-200 text-red-800 text-sm p-3 rounded-lg font-medium">
        Mohon periksa kembali form inputan Anda!
    </div>
    @endif

    <form action="{{ url('/register') }}" method="POST" class="space-y-4">
        @csrf
        <div>
            <label class="block text-sm font-semibold text-gray-700 mb-1">Nama Lengkap</label>
            <input type="text" name="nama" value="{{ old('nama') }}" required placeholder="Masukkan nama lengkap Anda" class="w-full px-4 py-2.5 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-600 focus:border-transparent outline-none text-sm">
            @error('nama') <p class="text-xs text-red-600 mt-1">{{ $message }}</p> @enderror
        </div>

        <div>
            <label class="block text-sm font-semibold text-gray-700 mb-1">Alamat Email Aktif</label>
            <input type="email" name="email" value="{{ old('email') }}" required placeholder="contoh@email.com" class="w-full px-4 py-2.5 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-600 focus:border-transparent outline-none text-sm">
            @error('email') <p class="text-xs text-red-600 mt-1">{{ $message }}</p> @enderror
        </div>

        <div class="grid grid-cols-2 gap-4">
            <div>
                <label class="block text-sm font-semibold text-gray-700 mb-1">Kata Sandi</label>
                <input type="password" name="password" required placeholder="Min 6 karakter" class="w-full px-4 py-2.5 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-600 focus:border-transparent outline-none text-sm">
                @error('password') <p class="text-xs text-red-600 mt-1">{{ $message }}</p> @enderror
            </div>
            <div>
                <label class="block text-sm font-semibold text-gray-700 mb-1">Konfirmasi Sandi</label>
                <input type="password" name="password_confirmation" required placeholder="Ulangi kata sandi" class="w-full px-4 py-2.5 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-600 focus:border-transparent outline-none text-sm">
            </div>
        </div>

        <div>
            <label class="block text-sm font-semibold text-gray-700 mb-1">Nomor HP / WhatsApp</label>
            <input type="text" name="no_hp" value="{{ old('no_hp') }}" required placeholder="Contoh: 08123456789" class="w-full px-4 py-2.5 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-600 focus:border-transparent outline-none text-sm">
            @error('no_hp') <p class="text-xs text-red-600 mt-1">{{ $message }}</p> @enderror
        </div>

        <div>
            <label class="block text-sm font-semibold text-gray-700 mb-1">Alamat Rumah Lengkap</label>
            <textarea name="alamat" rows="3" required placeholder="Tuliskan alamat pengiriman logistik sembako Anda secara jelas" class="w-full px-4 py-2.5 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-600 focus:border-transparent outline-none text-sm resize-none">{{ old('alamat') }}</textarea>
            @error('alamat') <p class="text-xs text-red-600 mt-1">{{ $message }}</p> @enderror
        </div>

        <button type="submit" class="w-full bg-blue-600 text-white py-2.5 rounded-lg hover:bg-blue-700 transition font-semibold text-sm shadow-sm mt-2">
            Selesai & Daftarkan Akun
        </button>
    </form>

    <div class="text-center mt-6 pt-4 border-t border-gray-100 text-sm text-gray-600">
        Sudah terdaftar jadi member? <a href="{{ url('/login') }}" class="text-blue-600 font-semibold hover:underline">Masuk di sini</a>
    </div>
</div>
@endsection