<x-app-layout>
    <x-slot name="header">
        <div class="flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between">
            <div>
                <p class="text-sm font-semibold uppercase tracking-wide text-blue-600 dark:text-blue-300">Admin</p>
                <h2 class="text-2xl font-bold text-slate-950 dark:text-white">Symbol Settings</h2>
            </div>
            <a href="{{ route('admin.trading-symbols.create') }}" class="rounded-lg bg-blue-600 px-4 py-2 text-sm font-bold text-white transition hover:-translate-y-0.5 hover:bg-blue-700 dark:bg-blue-500 dark:hover:bg-blue-400">Add Symbol</a>
        </div>
    </x-slot>

    <div class="overflow-hidden rounded-lg border border-blue-100 bg-white shadow-sm dark:border-blue-900/50 dark:bg-slate-900">
        <div class="overflow-x-auto">
            <table class="min-w-full divide-y divide-blue-100 dark:divide-blue-900/50">
                <thead class="bg-blue-50/70 dark:bg-blue-950/30">
                    <tr>
                        <th class="px-4 py-3 text-left text-xs font-bold uppercase text-blue-700 dark:text-blue-300">Symbol</th>
                        <th class="px-4 py-3 text-left text-xs font-bold uppercase text-blue-700 dark:text-blue-300">Category</th>
                        <th class="px-4 py-3 text-left text-xs font-bold uppercase text-blue-700 dark:text-blue-300">Contract</th>
                        <th class="px-4 py-3 text-left text-xs font-bold uppercase text-blue-700 dark:text-blue-300">Pip Size</th>
                        <th class="px-4 py-3 text-left text-xs font-bold uppercase text-blue-700 dark:text-blue-300">Status</th>
                        <th class="px-4 py-3 text-right text-xs font-bold uppercase text-blue-700 dark:text-blue-300">Actions</th>
                    </tr>
                </thead>
                <tbody class="divide-y divide-blue-100 dark:divide-blue-900/50">
                    @forelse ($symbols as $symbol)
                        <tr>
                            <td class="px-4 py-4">
                                <p class="font-bold text-slate-950 dark:text-white">{{ $symbol->symbol }}</p>
                                <p class="text-sm text-slate-500 dark:text-slate-400">{{ $symbol->display_name }}</p>
                            </td>
                            <td class="px-4 py-4 text-sm capitalize text-slate-600 dark:text-slate-300">{{ $symbol->category }}</td>
                            <td class="px-4 py-4 text-sm text-slate-600 dark:text-slate-300">{{ number_format((float) $symbol->contract_size, 4) }}</td>
                            <td class="px-4 py-4 text-sm text-slate-600 dark:text-slate-300">{{ rtrim(rtrim(number_format((float) $symbol->pip_size, 6), '0'), '.') }}</td>
                            <td class="px-4 py-4">
                                <span class="rounded-full px-3 py-1 text-xs font-bold {{ $symbol->is_active ? 'bg-emerald-100 text-emerald-700 dark:bg-emerald-950 dark:text-emerald-200' : 'bg-slate-100 text-slate-700 dark:bg-slate-800 dark:text-slate-200' }}">{{ $symbol->is_active ? 'Active' : 'Inactive' }}</span>
                            </td>
                            <td class="px-4 py-4">
                                <div class="flex justify-end gap-2">
                                    <a href="{{ route('admin.trading-symbols.show', $symbol) }}" class="text-sm font-bold text-blue-700 dark:text-blue-300">View</a>
                                    <a href="{{ route('admin.trading-symbols.edit', $symbol) }}" class="text-sm font-bold text-slate-600 dark:text-slate-300">Edit</a>
                                </div>
                            </td>
                        </tr>
                    @empty
                        <tr>
                            <td colspan="6" class="px-4 py-10 text-center text-slate-500 dark:text-slate-400">No trading symbols found.</td>
                        </tr>
                    @endforelse
                </tbody>
            </table>
        </div>
    </div>

    <div class="mt-6">{{ $symbols->links() }}</div>
</x-app-layout>
