@php
    $address = $employee->address;
@endphp

<div class="row g-4">
    <div class="col-lg-6">
        <h6 class="text-muted text-uppercase small mb-3">{{ __('employees.sections.personal') }}</h6>
        <dl class="row mb-0">
            <dt class="col-sm-5">{{ __('employees.fields.full_name') }}</dt>
            <dd class="col-sm-7">{{ $employee->full_name }}</dd>
            <dt class="col-sm-5">{{ __('employees.fields.arabic_name') }}</dt>
            <dd class="col-sm-7">{{ $employee->arabic_name ?: '—' }}</dd>
            <dt class="col-sm-5">{{ __('employees.fields.gender') }}</dt>
            <dd class="col-sm-7">{{ $employee->gender ? __('employees.gender.'.$employee->gender) : '—' }}</dd>
            <dt class="col-sm-5">{{ __('employees.fields.date_of_birth') }}</dt>
            <dd class="col-sm-7">{{ $employee->date_of_birth?->format('Y-m-d') ?: '—' }}</dd>
            <dt class="col-sm-5">{{ __('employees.fields.marital_status') }}</dt>
            <dd class="col-sm-7">{{ $employee->marital_status ? __('employees.marital.'.$employee->marital_status) : '—' }}</dd>
            <dt class="col-sm-5">{{ __('employees.fields.nationality') }}</dt>
            <dd class="col-sm-7">{{ $employee->nationality ?: '—' }}</dd>
        </dl>
    </div>
    <div class="col-lg-6">
        <h6 class="text-muted text-uppercase small mb-3">{{ __('employees.sections.contact') }}</h6>
        <dl class="row mb-0">
            <dt class="col-sm-5">{{ __('employees.fields.phone_1') }}</dt>
            <dd class="col-sm-7">{{ $employee->phone_1 }}</dd>
            <dt class="col-sm-5">{{ __('employees.fields.phone_2') }}</dt>
            <dd class="col-sm-7">{{ $employee->phone_2 ?: '—' }}</dd>
            <dt class="col-sm-5">{{ __('employees.fields.email') }}</dt>
            <dd class="col-sm-7">{{ $employee->email ?: '—' }}</dd>
            <dt class="col-sm-5">{{ __('employees.fields.company_email') }}</dt>
            <dd class="col-sm-7">{{ $employee->company_email ?: '—' }}</dd>
            <dt class="col-sm-5">{{ __('employees.fields.address_heading') }}</dt>
            <dd class="col-sm-7">
                {{ collect([
                    $address?->getAttribute('street'),
                    $address?->getAttribute('building_number'),
                    $address?->getAttribute('city'),
                    $address?->getAttribute('state'),
                    $address?->getAttribute('country'),
                ])->filter()->implode(', ') ?: '—' }}
            </dd>
        </dl>
    </div>
    <div class="col-12">
        <h6 class="text-muted text-uppercase small mb-3">{{ __('employees.sections.employment') }}</h6>
        <dl class="row mb-0">
            <dt class="col-sm-3">{{ __('employees.fields.department') }}</dt>
            <dd class="col-sm-3">{{ $employee->department?->name ?? '—' }}</dd>
            <dt class="col-sm-3">{{ __('employees.fields.position') }}</dt>
            <dd class="col-sm-3">{{ $employee->position?->title ?? '—' }}</dd>
            <dt class="col-sm-3">{{ __('employees.fields.manager') }}</dt>
            <dd class="col-sm-3">{{ $employee->manager?->full_name ?? '—' }}</dd>
            <dt class="col-sm-3">{{ __('employees.fields.employment_status') }}</dt>
            <dd class="col-sm-3">{{ $employee->employmentStatus?->name ?? '—' }}</dd>
            <dt class="col-sm-3">{{ __('employees.fields.hire_date') }}</dt>
            <dd class="col-sm-3">{{ $employee->hire_date?->format('Y-m-d') }}</dd>
            <dt class="col-sm-3">{{ __('employees.fields.probation_end_date') }}</dt>
            <dd class="col-sm-3">{{ $employee->probation_end_date?->format('Y-m-d') ?: '—' }}</dd>
            <dt class="col-sm-3">{{ __('employees.fields.confirmation_date') }}</dt>
            <dd class="col-sm-3">{{ $employee->confirmation_date?->format('Y-m-d') ?: '—' }}</dd>
            <dt class="col-sm-3">{{ __('employees.fields.status') }}</dt>
            <dd class="col-sm-3">
                <x-ui.operational.status-badge
                    :label="$employee->is_active ? __('employees.status.active') : __('employees.status.inactive')"
                    :variant="$employee->is_active ? 'success' : 'neutral'"
                />
            </dd>
        </dl>
    </div>
    @if ($tabData !== null && $tabData->isNotEmpty())
        <div class="col-12">
            <h6 class="text-muted text-uppercase small mb-3">{{ __('employees.sections.contracts') }}</h6>
            <ul class="list-unstyled mb-0">
                @foreach ($tabData as $contract)
                    <li class="mb-1">
                        {{ __('contracts.types.'.$contract->contract_type) }}
                        — {{ $contract->start_date?->format('Y-m-d') }}
                        @if ($contract->end_date)
                            → {{ $contract->end_date->format('Y-m-d') }}
                        @endif
                    </li>
                @endforeach
            </ul>
        </div>
    @endif
</div>
