<x-layouts.admin title="Payment Methods | Admin Suite" activePage="admin-payment-methods">
<div class="space-y-8">
    <div class="flex justify-between items-end">
        <div>
            <h2 class="font-serif text-3xl text-on-surface">Payment Methods</h2>
            <p class="text-on-surface-variant text-sm mt-1">Manage deposit payment methods available to users.</p>
        </div>
        <a href="{{ route('admin.payment-methods.create') }}" class="bg-gradient-to-r from-primary to-primary-container text-on-primary px-6 py-2.5 rounded-md text-sm font-label font-medium flex items-center gap-2">
            <span class="material-symbols-outlined text-sm">add</span>
            Add Method
        </a>
    </div>

    <div class="bg-surface-container-lowest overflow-x-auto">
        <table class="w-full text-left border-collapse min-w-[600px]">
            <thead>
                <tr class="bg-surface-container-low text-on-surface-variant uppercase text-[10px] tracking-widest font-bold">
                    <th class="px-6 py-4">Name</th>
                    <th class="px-6 py-4">Type</th>
                    <th class="px-6 py-4">Instructions</th>
                    <th class="px-6 py-4">Status</th>
                    <th class="px-6 py-4 text-right">Actions</th>
                </tr>
            </thead>
            <tbody class="divide-y divide-surface-container">
                @forelse($paymentMethods as $method)
                <tr class="hover:bg-surface-container-low transition-colors group">
                    <td class="px-6 py-5">
                        <div class="flex items-center gap-3">
                            <span class="material-symbols-outlined text-secondary">
                                @switch($method->type->value)
                                    @case('bank_transfer') account_balance @break
                                    @case('crypto') currency_bitcoin @break
                                    @case('mobile_money') phone_android @break
                                    @case('card') credit_card @break
                                    @default payments
                                @endswitch
                            </span>
                            <span class="text-sm font-semibold">{{ $method->name }}</span>
                        </div>
                    </td>
                    <td class="px-6 py-5 text-xs uppercase font-bold text-on-surface-variant">{{ str_replace('_', ' ', $method->type->value) }}</td>
                    <td class="px-6 py-5 text-xs text-on-surface-variant max-w-xs truncate">{{ Str::limit($method->instructions, 60) }}</td>
                    <td class="px-6 py-5">
                        <span class="inline-flex items-center px-2 py-1 rounded-full text-[10px] font-bold uppercase tracking-tighter
                            {{ $method->is_active ? 'bg-secondary-container text-secondary' : 'bg-surface-container text-on-surface-variant' }}
                        ">{{ $method->is_active ? 'Active' : 'Inactive' }}</span>
                    </td>
                    <td class="px-6 py-5 text-right">
                        <div class="flex justify-end gap-2">
                            <a href="{{ route('admin.payment-methods.edit', $method) }}" class="p-2 hover:bg-surface-container-highest text-on-surface-variant rounded-sm" title="Edit">
                                <span class="material-symbols-outlined text-lg">edit</span>
                            </a>
                            <form method="POST" action="{{ route('admin.payment-methods.destroy', $method) }}" onsubmit="return confirm('Delete this payment method?')">
                                @csrf
                                @method('DELETE')
                                <button type="submit" class="p-2 hover:bg-error-container text-on-surface-variant hover:text-error rounded-sm" title="Delete">
                                    <span class="material-symbols-outlined text-lg">delete</span>
                                </button>
                            </form>
                        </div>
                    </td>
                </tr>
                @empty
                <tr>
                    <td colspan="5" class="px-6 py-12 text-center text-on-surface-variant text-sm">No payment methods configured.</td>
                </tr>
                @endforelse
            </tbody>
        </table>
    </div>

    <div class="mt-6">
        {{ $paymentMethods->links() }}
    </div>
</div>
</x-layouts.admin>
