<x-app-layout>
    <x-slot name="header">
        <h2 class="font-semibold text-xl text-[#d4af37] leading-tight">تعديل الموديل: {{ $model->name }}</h2>
    </x-slot>
    <div class="py-12">
        <div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
            <div class="bg-[#111] border border-gray-800 rounded-2xl p-8 max-w-md mx-auto">
                <form action="{{ route('admin.models.update', $model->id) }}" method="POST" class="space-y-6">
                    @csrf @method('PUT')
                    <div>
                        <label class="block text-sm text-gray-400 mb-2">الماركة</label>
                        <select name="brand_id" required class="w-full bg-black border-gray-800 rounded-lg px-4 py-2.5 text-white focus:border-[#d4af37] outline-none">
                            <option value="">اختر الماركة</option>
                            @foreach($brands as $brand)
                                <option value="{{ $brand->id }}" {{ $model->brand_id == $brand->id ? 'selected' : '' }}>{{ $brand->name }}</option>
                            @endforeach
                        </select>
                        <x-input-error :messages="$errors->get('brand_id')" class="mt-2" />
                    </div>
                    <div>
                        <label class="block text-sm text-gray-400 mb-2">اسم الموديل</label>
                        <input type="text" name="name" value="{{ old('name', $model->name) }}" required class="w-full bg-black border-gray-800 rounded-lg px-4 py-2.5 text-white focus:border-[#d4af37] outline-none">
                        <x-input-error :messages="$errors->get('name')" class="mt-2" />
                    </div>
                    <button type="submit" class="w-full bg-[#d4af37] text-black py-2.5 rounded-lg font-bold">تحديث الموديل</button>
                </form>
            </div>
        </div>
    </div>
</x-app-layout>
