<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}" class="dark">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="csrf-token" content="{{ csrf_token() }}">
    <title>{{ isset($title) ? $title . ' — ' : '' }}PES 2026 League</title>
    <meta name="description" content="Competitive PES 2026 PS2 platform — matchmaking, rankings, tournaments.">

    <!-- Fonts -->
    <link rel="preconnect" href="https://fonts.googleapis.com">
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>

    @vite(['resources/css/app.css', 'resources/js/app.js'])
    @stack('styles')
</head>
<body class="bg-surface-900 min-h-screen scrollbar-thin">

    <!-- Background grid -->
    <div class="fixed inset-0 bg-grid opacity-50 pointer-events-none"></div>
    <!-- Top glow -->
    <div class="fixed top-0 left-1/2 -translate-x-1/2 w-[600px] h-[1px] bg-gradient-to-r from-transparent via-brand-500/60 to-transparent pointer-events-none"></div>

    <!-- Navbar -->
    @include('layouts.navbar')

    <!-- Sidebar + Content -->
    <div class="flex min-h-[calc(100vh-4rem)]">
        @auth
            @include('layouts.sidebar')
        @endauth

        <main class="flex-1 @auth ml-0 lg:ml-64 @endauth">
            <div class="px-4 sm:px-6 lg:px-8 py-6">
                @if (session('success'))
                    <div x-data="{ show: true }" x-show="show" x-transition
                         class="mb-4 flex items-center gap-3 bg-emerald-900/40 border border-emerald-500/30 text-emerald-400 px-4 py-3 rounded-xl text-sm">
                        <svg class="w-4 h-4 shrink-0" fill="currentColor" viewBox="0 0 20 20"><path fill-rule="evenodd" d="M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z" clip-rule="evenodd"/></svg>
                        {{ session('success') }}
                        <button @click="show=false" class="ml-auto text-emerald-600 hover:text-emerald-400">✕</button>
                    </div>
                @endif
                @if (session('error'))
                    <div x-data="{ show: true }" x-show="show" x-transition
                         class="mb-4 flex items-center gap-3 bg-red-900/40 border border-red-500/30 text-red-400 px-4 py-3 rounded-xl text-sm">
                        <svg class="w-4 h-4 shrink-0" fill="currentColor" viewBox="0 0 20 20"><path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z" clip-rule="evenodd"/></svg>
                        {{ session('error') }}
                        <button @click="show=false" class="ml-auto text-red-600 hover:text-red-400">✕</button>
                    </div>
                @endif

                {{ $slot }}
            </div>
        </main>
    </div>

    @stack('scripts')
</body>
</html>
