<x-filament-widgets::widget>
    <x-filament::section :heading="__('Disk Usage')" icon="heroicon-o-server-stack">
        @php $disk = $this->getData(); @endphp

        <div class="flex flex-col gap-4">
            @forelse(($disk['partitions'] ?? []) as $partition)
                <div class="flex flex-col gap-4 sm:flex-row sm:items-start">
                    <x-filament::icon
                        icon="heroicon-o-server-stack"
                        class="h-8 w-8 shrink-0 text-gray-400"
                    />

                    <div class="min-w-0 flex-1">
                        <p class="font-medium text-gray-900 dark:text-white">{{ $partition['mount'] ?? '/' }}</p>

                        @php $pct = $partition['usage_percent'] ?? 0; @endphp
                        <div class="mt-2 h-3 w-full overflow-hidden rounded-full bg-gray-200 dark:bg-gray-800">
                            <div class="h-full rounded-full bg-gray-400" style="width: {{ $pct }}%;"></div>
                        </div>

                        <p class="mt-2 text-sm text-gray-500 dark:text-gray-400">
                            {{ $partition['used_human'] ?? '0 B' }} {{ __('used of') }} {{ $partition['total_human'] ?? '0 B' }}
                        </p>
                    </div>
                </div>
            @empty
                <p class="text-sm text-gray-500 dark:text-gray-400">{{ __('No disk data available') }}</p>
            @endforelse
        </div>
    </x-filament::section>
</x-filament-widgets::widget>
