@extends('layouts.admin')
@section('title', 'New Member — JAM Admin')
@section('page-title', 'Create Member')

@section('content')
<div class="max-w-2xl">
    <div class="flex items-center gap-3 mb-6">
        <a href="{{ route('admin.members.index') }}" class="text-white/30 hover:text-white transition-colors">
            <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 19l-7-7 7-7"/></svg>
        </a>
        <h2 class="text-2xl font-semibold" style="font-family: 'Playfair Display', serif;">New Member</h2>
    </div>

    @if($errors->any())
    <div class="bg-red-900/20 border border-red-800/50 rounded-xl p-4 mb-6">
        @foreach($errors->all() as $error)
        <p class="text-red-400 text-sm">{{ $error }}</p>
        @endforeach
    </div>
    @endif

    <form method="POST" action="{{ route('admin.members.store') }}" class="bg-[#111111] border border-[#1e1e1e] rounded-xl p-8 space-y-6">
        @csrf
        <div class="grid grid-cols-2 gap-6">
            <div>
                <label class="block text-xs tracking-widest uppercase text-white/40 mb-2">First Name</label>
                <input type="text" name="first_name" value="{{ old('first_name') }}" required
                       class="w-full bg-[#1a1a1a] border border-[#2a2a2a] focus:border-[#D4B84A] rounded-lg px-4 py-3 text-sm text-white outline-none transition-colors">
            </div>
            <div>
                <label class="block text-xs tracking-widest uppercase text-white/40 mb-2">Last Name</label>
                <input type="text" name="last_name" value="{{ old('last_name') }}" required
                       class="w-full bg-[#1a1a1a] border border-[#2a2a2a] focus:border-[#D4B84A] rounded-lg px-4 py-3 text-sm text-white outline-none transition-colors">
            </div>
        </div>
        <div>
            <label class="block text-xs tracking-widest uppercase text-white/40 mb-2">Date of Birth</label>
            <input type="date" name="dob" value="{{ old('dob') }}" required
                   class="w-full bg-[#1a1a1a] border border-[#2a2a2a] focus:border-[#D4B84A] rounded-lg px-4 py-3 text-sm text-white outline-none transition-colors"
                   style="color-scheme: dark;">
            <p class="text-white/25 text-xs mt-1">Member must be 18 years or older.</p>
        </div>
        <div>
            <label class="block text-xs tracking-widest uppercase text-white/40 mb-2">Email Address</label>
            <input type="email" name="email" value="{{ old('email') }}" required
                   class="w-full bg-[#1a1a1a] border border-[#2a2a2a] focus:border-[#D4B84A] rounded-lg px-4 py-3 text-sm text-white outline-none transition-colors">
        </div>
        <div>
            <label class="block text-xs tracking-widest uppercase text-white/40 mb-2">Phone (optional)</label>
            <input type="tel" name="phone" value="{{ old('phone') }}" placeholder="+61 4XX XXX XXX"
                   class="w-full bg-[#1a1a1a] border border-[#2a2a2a] focus:border-[#D4B84A] rounded-lg px-4 py-3 text-sm text-white outline-none transition-colors placeholder-white/20">
        </div>
        <div>
            <label class="block text-xs tracking-widest uppercase text-white/40 mb-2">Temporary Password</label>
            <input type="text" name="password" required placeholder="Member can change after first login"
                   class="w-full bg-[#1a1a1a] border border-[#2a2a2a] focus:border-[#D4B84A] rounded-lg px-4 py-3 text-sm text-white outline-none transition-colors placeholder-white/20">
            <p class="text-white/25 text-xs mt-1">Min. 8 characters. Share this with the member securely.</p>
        </div>
        <div class="flex justify-end gap-3 pt-2 border-t border-[#1e1e1e]">
            <a href="{{ route('admin.members.index') }}"
               class="px-6 py-3 rounded-full border border-[#2a2a2a] text-white/50 hover:text-white text-sm transition-colors">
                Cancel
            </a>
            <button type="submit"
                    class="px-6 py-3 rounded-full bg-[#D4B84A] hover:bg-[#E8D080] text-black font-semibold text-sm transition-colors">
                Create Member
            </button>
        </div>
    </form>
</div>
@endsection
