<x-app-layout>
    <x-slot name="header">
        <div class="d-flex justify-content-between align-items-center">
            <h2 class="h4 mb-0">Backup Database</h2>
            <form action="{{ route('super-admin.backup.store') }}" method="POST">
                @csrf
                <button class="btn btn-primary btn-sm">Buat Backup Sekarang</button>
            </form>
        </div>
    </x-slot>

    <div class="card">
        <div class="table-responsive">
            <table class="table table-sm mb-0">
                <thead>
                    <tr>
                        <th>Nama File</th>
                        <th>Ukuran</th>
                        <th>Dibuat</th>
                        <th class="text-end">Aksi</th>
                    </tr>
                </thead>
                <tbody>
                    @forelse ($backups as $backup)
                        <tr>
                            <td>{{ $backup['name'] }}</td>
                            <td>{{ number_format($backup['size'] / 1024, 1) }} KB</td>
                            <td>{{ $backup['created_at'] }}</td>
                            <td class="text-end">
                                <a href="{{ route('super-admin.backup.download', $backup['name']) }}" class="btn btn-sm btn-outline-secondary">Download</a>
                            </td>
                        </tr>
                    @empty
                        <tr><td colspan="4" class="text-center text-muted py-4">Belum ada backup.</td></tr>
                    @endforelse
                </tbody>
            </table>
        </div>
    </div>
</x-app-layout>
