<div>
    @if($client->claim()->exists())
        @php($claim = $client->claim)

        <div>
            <!-- Horizontal Tabs -->
            <ul class="nav nav-tabs">
                @foreach($tabs as $key => $tab)
                    <li class="nav-item">
                        <button
                                wire:click="setTab('{{ $key }}')"
                                class="nav-link px-3 {{ $activeTab === $key ? 'active fw-bold text-primary' : 'text-muted' }}"
                                style="{{ $activeTab === $key ? 'border-top: 3px solid #0d6efd; background: white;' : '' }}"
                        >
                            <i class="bi {{ $tab['icon'] }} me-2"></i>
                            {{ $tab['label'] }}
                        </button>
                    </li>
                @endforeach
            </ul>

            @switch($activeTab)
                @case('personal-details')
                    <livewire:claim.application.personal-details :claim="$claim" wire:key="tab-personal-details"/>
                    @break

                @case('care-settings')
                    <livewire:claim.application.care-setting-manager :claim="$claim" wire:key="tab-care-settings"/>
                    @break

                @case('contact-preferences')
                    <livewire:claim.application.contact :client="$client" wire:key="tab-contact"/>
                    @break

                @case('confirm-identity')
                    <livewire:claim.application.confirm-identity :client="$client" wire:key="tab-confirm-identity"/>
                    @break

                @case('beneficiary')
                    <livewire:claim.application.beneficiary :claim="$claim" wire:key="tab-beneficiary"/>
                    @break

                @case('terminal-illness')
                    <livewire:claim.application.terminal-illness :claim="$claim" wire:key="tab-terminal"/>
                    @break

                @case('redress-type')
                    <livewire:claim.application.redress-type :claim="$claim" wire:key="tab-redress-type"/>
                    @break

                @case('bank-details')
                    <livewire:claim.application.bank-detail :claim="$claim" wire:key="tab-bank"/>
                    @break

                @case('impact-factors')
                    <livewire:claim.application.impact-factors :claim="$claim" wire:key="tab-impact"/>
                    @break

                @case('further-information')
                    <livewire:claim.application.further-information :claim="$claim" wire:key="tab-fi"/>
                    @break
                @case('provisional-value')
                    <livewire:claim.application.provisional-value :claim="$claim" wire:key="tab-provisional-value"/>
                    @break
            @endswitch
        </div>

    @else
        <div class="card border-0 shadow-sm">
            <div class="card-body">
                <h4 class="fw-bold mb-3 d-flex justify-content-between align-items-center">
                    Claim Info
                    @can('claims.create')
                    <a wire:navigate href="{{ route('claims.create', $client) }}" class="btn btn-sm btn-primary">
                        <i class="mdi mdi-plus"></i> Create Claim
                    </a>
                    @endcan
                </h4>
                <div class="text-center p-5 text-muted">
                    <i class="mdi mdi-account-details text-secondary opacity-25" style="font-size: 64px;"></i>
                    <p class="mt-3 fw-bold">No claim found for this client.</p>
                    <p class="small">Click the plus button above to start a new application.</p>
                </div>
            </div>
        </div>
    @endif
</div>