<div class="p-6">
    <h3 class="text-lg font-semibold text-t1 mb-5">Create Webhook</h3>

    <div class="space-y-4">
        <div>
            <label class="block text-xs font-medium text-t2 mb-1.5">Endpoint URL *</label>
            <input wire:model="url" type="url" placeholder="https://example.com/webhook"
                class="block w-full px-3 py-2.5 bg-s2 border border-white/[.06] rounded-lg text-sm text-t1 placeholder-t3 focus:outline-none focus:ring-1 focus:ring-blue/50 focus:border-blue/50">
            @error('url') <p class="mt-1 text-xs text-red">{{ $message }}</p> @enderror
        </div>

        <div>
            <label class="block text-xs font-medium text-t2 mb-1.5">Secret (optional)</label>
            <input wire:model="secret" type="text" placeholder="Used to sign payloads"
                class="block w-full px-3 py-2.5 bg-s2 border border-white/[.06] rounded-lg text-sm text-t1 placeholder-t3 focus:outline-none focus:ring-1 focus:ring-blue/50 focus:border-blue/50 font-mono">
        </div>

        <div>
            <label class="block text-xs font-medium text-t2 mb-2">Events *</label>
            <div class="space-y-2">
                @foreach($availableEvents as $event => $label)
                    <label class="flex items-center gap-2.5 cursor-pointer">
                        <input type="checkbox" wire:model="selectedEvents" value="{{ $event }}"
                            class="w-4 h-4 rounded border-white/[.2] bg-s2 text-blue focus:ring-blue/50 focus:ring-offset-0">
                        <span class="text-sm text-t1">{{ $label }}</span>
                        <span class="text-xs text-t3 font-mono">{{ $event }}</span>
                    </label>
                @endforeach
            </div>
            @error('selectedEvents') <p class="mt-1 text-xs text-red">{{ $message }}</p> @enderror
        </div>
    </div>

    <div class="flex gap-3 mt-6">
        <button wire:click="save"
            class="flex-1 px-4 py-2.5 bg-accent-gradient text-white text-sm font-medium rounded-lg hover:opacity-90 transition-opacity">
            Create Webhook
        </button>
        <button wire:click="closeModal"
            class="px-4 py-2.5 bg-s2 text-t2 text-sm font-medium rounded-lg hover:text-t1 transition-colors border border-white/[.06]">
            Cancel
        </button>
    </div>
</div>
