<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Select Branch | Restaurant OS</title>
    @vite(['resources/css/app.css', 'resources/js/app.js'])
</head>
<body class="bg-zinc-50 font-sans antialiased flex items-center justify-center min-h-screen p-4 relative overflow-hidden">
    <!-- Restaurant Aesthetic Background -->
    <div class="absolute inset-0 opacity-40 pointer-events-none" style="background-image: radial-gradient(circle at 2px 2px, #f59e0b 1px, transparent 0); background-size: 32px 32px;"></div>
    
    <div class="w-full max-w-[400px] relative z-10">
        <div class="bg-white border border-zinc-200 rounded-sm shadow-xl overflow-hidden">
            <div class="p-8">
                <div class="mb-10 text-center">
                    <h1 class="text-xl font-bold text-zinc-900 tracking-tight">SELECT WORKSPACE</h1>
                    <p class="text-[10px] text-zinc-400 uppercase tracking-widest mt-2 font-bold">Choose a branch to continue</p>
                </div>

                <form action="{{ route('portal.branches.update') }}" method="POST" class="space-y-3">
                    @csrf
                    <div class="grid grid-cols-1 gap-3">
                        @foreach($branches as $branch)
                            <label class="relative flex items-center p-4 rounded-sm border border-zinc-200 bg-zinc-50 hover:border-amber-500/50 hover:bg-amber-50 transition-all cursor-pointer group">
                                <input type="radio" name="branch_id" value="{{ $branch->id }}" class="sr-only peer" required>
                                <div class="w-10 h-10 rounded-sm bg-white border border-zinc-200 group-hover:border-amber-200 flex items-center justify-center text-zinc-400 group-hover:text-amber-600 transition-colors mr-4 font-bold text-lg shadow-sm">
                                    {{ substr($branch->name, 0, 1) }}
                                </div>
                                <div class="flex-1">
                                    <p class="text-sm font-bold text-zinc-700 group-hover:text-zinc-900 transition-colors">{{ $branch->name }}</p>
                                    <p class="text-[10px] text-zinc-400 font-medium uppercase tracking-tight">{{ $branch->address ?? 'Main Location' }}</p>
                                </div>
                                <div class="opacity-0 group-hover:opacity-100 transition-opacity">
                                    <svg class="w-4 h-4 text-amber-500" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7"></path></svg>
                                </div>
                                <!-- Radio indicator -->
                                <div class="absolute inset-0 border-2 border-amber-500 rounded-sm opacity-0 peer-checked:opacity-100 pointer-events-none transition-opacity"></div>
                            </label>
                        @endforeach
                    </div>

                    <button type="submit" class="w-full py-3 bg-zinc-900 hover:bg-black text-white text-[11px] font-bold uppercase tracking-widest rounded-sm shadow-md transition-all active:scale-[0.98] mt-6">
                        Open Dashboard
                    </button>
                </form>
            </div>
            
            <div class="p-5 bg-zinc-50 text-center border-t border-zinc-100">
                <form action="{{ route('portal.logout') }}" method="POST">
                    @csrf
                    <button type="submit" class="text-[9px] text-zinc-400 hover:text-red-600 font-bold uppercase tracking-widest transition-colors">
                        Sign out of account
                    </button>
                </form>
            </div>
        </div>
    </div>
</body>
</html>
