<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">Key Dates</h5>
        </div>

        <div class="mt-3">
            @foreach($keyDates as $type)
                <div class="mb-3 p-2 rounded-3 {{ isset($dates[$type->id]) && !empty($dates[$type->id]) ? 'bg-soft-light' : 'bg-soft-danger border border-danger-subtle border-dashed' }}">
                    <div class="d-flex justify-content-between align-items-center mb-1">
                        <label class="small fw-bold mb-0 {{ isset($dates[$type->id]) && !empty($dates[$type->id]) ? 'text-dark' : 'text-danger' }}">
                            {{ $type->display_name }}
                        </label>
                    </div>

                    <div class="input-group input-group-sm">
                        <input
                                type="date"
                                class="form-control form-control-sm border-0 shadow-none bg-transparent"
                                wire:model="dates.{{ $type->id }}"
                                wire:change="updateDate({{ $type->id }})"
                        >
                        @if(isset($dates[$type->id]) && !empty($dates[$type->id]))
                            <span class="input-group-text bg-transparent border-0 text-success">
                                <i class="mdi mdi-check-circle"></i>
                            </span>
                        @endif
                    </div>
                </div>
            @endforeach
        </div>

        @if($keyDates->isEmpty())
            <div class="text-center py-3 text-muted">
                <p class="small italic mb-0">No date types configured in system.</p>
            </div>
        @endif
    </div>
</div>