<form action="{{ $menu ? route('admin.menus.update', $menu) : route('admin.menus.store') }}" method="POST">
    @csrf
    @if($menu) @method('PUT') @endif
    <div class="mb-3">
        <label class="form-label">Label <span class="text-danger">*</span></label>
        <input type="text" name="label" class="form-control" value="{{ old('label', $menu->label ?? '') }}" required>
    </div>
    <div class="mb-3">
        <label class="form-label">URL</label>
        <input type="text" name="url" class="form-control" value="{{ old('url', $menu->url ?? '') }}" placeholder="e.g. /about">
    </div>
    <div class="mb-3">
        <label class="form-label">Or Route Name</label>
        <input type="text" name="route" class="form-control" value="{{ old('route', $menu->route ?? '') }}" placeholder="e.g. pages.show">
        <div class="form-text">Use a URL OR a named route (route takes priority over URL).</div>
    </div>
    <div class="mb-3">
        <label class="form-label">Sort Order</label>
        <input type="number" name="sort_order" class="form-control" value="{{ old('sort_order', $menu->sort_order ?? 0) }}" min="0">
    </div>
    <div class="form-check mb-3">
        <input type="checkbox" class="form-check-input" id="is_active" name="is_active" value="1" {{ old('is_active', $menu->is_active ?? true) ? 'checked' : '' }}>
        <label class="form-check-label" for="is_active">Active</label>
    </div>
    <button type="submit" class="btn btn-primary">{{ $menu ? 'Update' : 'Create' }} Menu Item</button>
    <a href="{{ route('admin.menus.index') }}" class="btn btn-outline-secondary">Cancel</a>
</form>
