<div>
    @if($client->claim()->exists())
        <div class="row g-4">
            <!-- Main Info Column (Left) -->
            <div class="col-md-8">
                <div class="row g-4">
                    <!-- Case Details -->
                    <div class="col-md-6">
                        <div class="card shadow-sm h-100 border-0">
                            <div class="card-body">
                                <div class="d-flex align-items-center justify-content-between mb-3">
                                    <h5 class="text-muted fw-bold mb-0">Case Details</h5>

                                    <a href="{{ route('ha-claims.edit', $client) }}" class="btn btn-primary btn-sm">
                                        <i class="mdi mdi-pencil"></i>
                                    </a>
                                </div>

                                <div class="mb-2">
                                    <label class="text-muted extra-small d-block mb-0">APP Number</label>
                                    <span class="fw-bold text-dark">{{ $client->claim->case_number ?? 'Not Assigned' }}</span>
                                </div>
                                <div class="mb-2">
                                    <label class="text-muted extra-small d-block mb-0">Case Worker</label>
                                    <span class="fw-medium text-dark">{{ $client->claim->worker_name ?? 'Unassigned' }}</span>
                                </div>
                                <div>
                                    <label class="text-muted extra-small d-block mb-0">Redress Type</label>
                                    <span class="text-dark small">{{ $client->claim->redress_type ?? 'N/A' }}</span>
                                </div>

                                <livewire:tag.tag-assigner :model="$client->claim"/>

                                <x-client.handler-list :client="$client"/>
                            </div>
                        </div>
                    </div>

                    <!-- Care Settings -->
                    <div class="col-md-6">
                        <div class="card shadow-sm h-100 border-0">
                            <div class="card-body">
                                <div class="d-flex align-items-center justify-content-between mb-3">
                                    <h5 class="text-muted fw-bold mb-0">Care Settings</h5>
                                </div>

                                <div class="care-settings-list" style="overflow-y: auto;">
                                    @forelse($client->claim->careSettings as $setting)
                                        <a href="{{ route('institutions.show', $setting->institution) }}" class="mb-2 pb-1 border-bottom border-light last-child-border-0">
                                            <div class="fw-bold text-dark extra-small">{{ $setting->institution->display_name }}</div>
                                            <div class="text-muted extra-small italic">
                                                {{ $setting->dates }}
                                            </div>
                                        </a>
                                    @empty
                                        <p class="text-muted small italic">No care settings recorded.</p>
                                    @endforelse
                                </div>
                            </div>
                        </div>
                    </div>

                    <!-- DSAR Status (Full Width of left column) -->
                    <div class="col-12">
                        <livewire:note-manager :owner="$client"/>
                    </div>
                </div>
                <!-- Secondary Management Modules -->
                <div class="row">
                    <div class="col-12">
                        <livewire:client.previous-name-manager :client="$client"/>
                    </div>
                    <div class="col-12">
                        <livewire:address-book :owner="$client"/>
                    </div>
                </div>
            </div>

            <!-- Sidebar Column (Right - Key Dates) -->
            <div class="col-md-4">
                <livewire:claim.key-dates-manager :claim="$client->claim"/>
            </div>
        </div>
    @else
        <div class="card shadow-sm border-0">
            <div class="card-body text-center py-5">
                <i class="mdi mdi-account-details-outline text-muted" style="font-size: 48px;"></i>
                <h5 class="text-dark">No Active Claim</h5>
                <p class="text-muted">A claim has not been initialized for this client yet.</p>
                <a href="{{ route('ha-claims.create', $client) }}" class="btn btn-primary mt-2">
                    Initialize Claim
                </a>
            </div>
        </div>
    @endif


</div>