<x-filament-widgets::widget>
    @php
        $health = $this->getHealthData();
    @endphp

    <div @class([
        'flex items-center gap-3 rounded-xl border px-4 py-3',
        'border-green-300 bg-green-50 dark:border-green-700 dark:bg-green-950/30' => $health['level'] === 'healthy',
        'border-yellow-300 bg-yellow-50 dark:border-yellow-700 dark:bg-yellow-950/30' => $health['level'] === 'warning',
        'border-red-300 bg-red-50 dark:border-red-700 dark:bg-red-950/30' => $health['level'] === 'critical',
    ])>
        <x-filament::icon
            :icon="$health['icon']"
            @class([
                'h-8 w-8',
                'text-green-600 dark:text-green-400' => $health['level'] === 'healthy',
                'text-yellow-600 dark:text-yellow-400' => $health['level'] === 'warning',
                'text-red-600 dark:text-red-400' => $health['level'] === 'critical',
            ])
        />
        <div class="flex-1">
            <div @class([
                'text-sm font-semibold',
                'text-green-800 dark:text-green-200' => $health['level'] === 'healthy',
                'text-yellow-800 dark:text-yellow-200' => $health['level'] === 'warning',
                'text-red-800 dark:text-red-200' => $health['level'] === 'critical',
            ])>
                {{ $health['label'] }}
            </div>
            @if ($health['level'] !== 'healthy')
                <div class="mt-0.5 text-xs text-gray-600 dark:text-gray-400">
                    {{ $health['failed'] }} failed &middot; {{ $health['stuck'] }} stuck (last 24h)
                </div>
            @else
                <div class="mt-0.5 text-xs text-gray-500 dark:text-gray-400">
                    No failures or stuck runs in the last 24 hours
                </div>
            @endif
        </div>
    </div>
</x-filament-widgets::widget>
