@extends('layouts.app')

@section('title', 'Company Policies')
@section('heading', 'Company Policies')

@section('content')
    <x-card>
        <p class="mb-6 text-slate-600">Published policies for all employees.</p>
        <div class="grid gap-4 sm:grid-cols-2">
            @forelse($policies as $policy)
                <a href="{{ route('company-policies.show', $policy) }}" class="rounded-xl border border-slate-200 p-5 transition hover:border-slate-400 hover:bg-slate-50">
                    <div class="flex items-start justify-between gap-2">
                        <h3 class="text-base font-semibold text-slate-900">{{ $policy->name }}</h3>
                        @if(in_array($policy->id, $acknowledgedIds ?? [], true))
                            <span class="rounded bg-emerald-100 px-2 py-0.5 text-xs font-medium text-emerald-800">Acknowledged</span>
                        @endif
                    </div>
                    @if($policy->description)
                        <p class="mt-2 text-sm text-slate-500">{{ $policy->description }}</p>
                    @endif
                </a>
            @empty
                <p class="text-sm text-slate-500">No active policies published yet.</p>
            @endforelse
        </div>
    </x-card>
@endsection
