<div class="card border-0 shadow-sm mb-3">
    <div class="card-body">
        <div class="row g-3">
            <div class="col-md-4"><div class="text-muted small">{{ __('recruitment.offer_letters.fields.candidate') }}</div><div class="fw-semibold">{{ $offer->candidate?->full_name ?? '—' }}</div></div>
            <div class="col-md-4"><div class="text-muted small">{{ __('recruitment.offer_letters.fields.application') }}</div><div>{{ $offer->application?->reference_code ?? '—' }}</div></div>
            <div class="col-md-4"><div class="text-muted small">{{ __('recruitment.offer_letters.fields.vacancy') }}</div><div>{{ $offer->vacancy?->title ?? '—' }}</div></div>
            <div class="col-md-4"><div class="text-muted small">{{ __('recruitment.offer_letters.fields.department') }}</div><div>{{ $offer->department?->name ?? '—' }}</div></div>
            <div class="col-md-4"><div class="text-muted small">{{ __('recruitment.offer_letters.fields.position') }}</div><div>{{ $offer->position?->name ?? '—' }}</div></div>
            <div class="col-md-4"><div class="text-muted small">{{ __('recruitment.offer_letters.fields.employment_type') }}</div><div>{{ __('recruitment.offer_letters.employment_type.'.$offer->employment_type) }}</div></div>
            <div class="col-md-4"><div class="text-muted small">{{ __('recruitment.offer_letters.fields.employment_status') }}</div><div>{{ $offer->employmentStatus?->name ?? '—' }}</div></div>
            <div class="col-md-4"><div class="text-muted small">{{ __('recruitment.offer_letters.fields.start_date') }}</div><div>{{ $offer->start_date?->format('Y-m-d') }}</div></div>
            <div class="col-md-4"><div class="text-muted small">{{ __('recruitment.offer_letters.fields.probation_period') }}</div><div>{{ $offer->probation_period_days ?? '—' }}</div></div>
            <div class="col-md-4"><div class="text-muted small">{{ __('recruitment.offer_letters.fields.salary') }}</div><div>{{ number_format((float) $offer->salary, 2) }} {{ $offer->currency }}</div></div>
            <div class="col-md-4"><div class="text-muted small">{{ __('recruitment.offer_letters.fields.working_hours') }}</div><div>{{ $offer->working_hours ?? '—' }}</div></div>
            <div class="col-md-4"><div class="text-muted small">{{ __('recruitment.offer_letters.fields.expires_at') }}</div><div>{{ $offer->expires_at?->format('Y-m-d H:i') ?? '—' }}</div></div>
            <div class="col-md-4"><div class="text-muted small">{{ __('recruitment.offer_letters.fields.acceptance_deadline') }}</div><div>{{ $offer->acceptance_deadline_at?->format('Y-m-d H:i') ?? '—' }}</div></div>
            <div class="col-md-6"><div class="text-muted small">{{ __('recruitment.offer_letters.fields.allowances') }}</div><div>{{ $offer->allowances ?: '—' }}</div></div>
            <div class="col-md-6"><div class="text-muted small">{{ __('recruitment.offer_letters.fields.benefits') }}</div><div>{{ $offer->benefits ?: '—' }}</div></div>
            <div class="col-12"><div class="text-muted small">{{ __('recruitment.offer_letters.fields.notes') }}</div><div>{{ $offer->notes ?: '—' }}</div></div>
        </div>
    </div>
</div>

<div class="card border-0 shadow-sm">
    <div class="card-body">
        <div class="d-flex justify-content-between align-items-center mb-3">
            <h2 class="h6 mb-0">{{ __('recruitment.offer_letters.fields.attachments') }}</h2>
            @can('update', $offer)
                @if ($offer->status === 'draft')
                    <form method="POST" action="{{ route('hr.recruitment.offer-letters.attachments.store', $offer) }}" enctype="multipart/form-data" class="d-flex gap-2">
                        @csrf
                        <input type="file" name="attachment" class="form-control form-control-sm" required>
                        <x-ui.buttons.secondary size="sm" type="submit">{{ __('recruitment.offer_letters.actions.upload') }}</x-ui.buttons.secondary>
                    </form>
                @endif
            @endcan
        </div>
        <ul class="list-unstyled mb-0">
            @forelse ($offer->attachments as $file)
                <li class="d-flex justify-content-between align-items-center py-2 border-bottom">
                    <a href="{{ route('hr.recruitment.offer-letters.attachments.download', $file) }}">{{ $file->original_name }}</a>
                    @can('update', $offer)
                        @if ($offer->status === 'draft')
                            <form method="POST" action="{{ route('hr.recruitment.offer-letters.attachments.destroy', $file) }}">
                                @csrf @method('DELETE')
                                <x-ui.buttons.danger outline size="sm" type="submit">{{ __('common.delete') }}</x-ui.buttons.danger>
                            </form>
                        @endif
                    @endcan
                </li>
            @empty
                <li class="text-muted">{{ __('recruitment.offer_letters.no_attachments') }}</li>
            @endforelse
        </ul>
    </div>
</div>
