<div class="flex flex-col gap-6">
    @if(empty($code))
        <x-auth-header :title="__('Invitation Required')" :description="__('An invitation is required to create an account')" />
        
        <div class="text-center">
            <p class="text-sm text-zinc-600 dark:text-zinc-400 mb-4">{{ __('Registration is by invitation only. Please contact an administrator to receive an invitation.') }}</p>
            <flux:link :href="route('login')" wire:navigate class="text-sm">{{ __('Return to login') }}</flux:link>
        </div>
    @elseif(!empty($code) && $invitation === null)
        <x-auth-header :title="__('Invalid Invitation')" :description="__('This invitation link is not valid')" />
        
        <div class="text-center">
            <p class="text-sm text-zinc-600 dark:text-zinc-400 mb-4">{{ __('The invitation link you used is invalid or has expired. Please contact an administrator for a new invitation.') }}</p>
            <flux:link :href="route('login')" wire:navigate class="text-sm">{{ __('Return to login') }}</flux:link>
        </div>
    @elseif($invitationAccepted)
        <x-auth-header :title="__('Invitation Already Used')" :description="__('This invitation has already been accepted')" />
        
        <div class="text-center">
            <p class="text-sm text-zinc-600 dark:text-zinc-400 mb-4">{{ __('This invitation code has already been used to create an account.') }}</p>
            <flux:link :href="route('login')" wire:navigate class="text-sm">{{ __('Return to login') }}</flux:link>
        </div>
    @else
        <x-auth-header :title="__('Create an account')" :description="__('Enter your details below to create your account')" />

        <!-- Session Status -->
        <x-auth-session-status class="text-center" :status="session('status')" />

        @error('general')
            <div class="text-red-600 text-sm text-center">{{ $message }}</div>
        @enderror

        <form wire:submit="register" class="flex flex-col gap-6">
        <!-- Name -->
        <flux:input
            wire:model="name"
            :label="__('Name')"
            type="text"
            required
            autofocus
            autocomplete="name"
            :placeholder="__('Full name')"
        />

        <!-- Email Address -->
        <flux:input
            wire:model="email"
            :label="__('Email address')"
            type="email"
            required
            autocomplete="email"
            placeholder="email@example.com"
            :disabled="$invitation !== null"
        />

        <!-- Password -->
        <flux:input
            wire:model="password"
            :label="__('Password')"
            type="password"
            required
            autocomplete="new-password"
            :placeholder="__('Password')"
            viewable
        />

        <!-- Confirm Password -->
        <flux:input
            wire:model="password_confirmation"
            :label="__('Confirm password')"
            type="password"
            required
            autocomplete="new-password"
            :placeholder="__('Confirm password')"
            viewable
        />

        <div class="flex items-center justify-end">
            <flux:button type="submit" variant="primary" class="w-full">
                {{ __('Create account') }}
            </flux:button>
        </div>
    </form>

        <div class="space-x-1 rtl:space-x-reverse text-center text-sm text-zinc-600 dark:text-zinc-400">
            <span>{{ __('Already have an account?') }}</span>
            <flux:link :href="route('login')" wire:navigate>{{ __('Log in') }}</flux:link>
        </div>
    @endif
</div>
