@props(['dealer' => null])

<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <meta name="csrf-token" content="{{ csrf_token() }}">

        <title>{{ config('app.name', 'Laravel') }}</title>
        @php
            $explicitDealerFavicon = null;
            if (isset($dealer) && $dealer?->favicon_path) {
                $base = asset('storage/'.$dealer->favicon_path);
                $version = $dealer->updated_at?->valueOf();
                $explicitDealerFavicon = $version ? ($base.'?v='.$version) : $base;
            }
        @endphp
        <link rel="icon" href="{{ $explicitDealerFavicon ?? ($dealerFaviconUrl ?? asset('favicon.ico')) }}">

        <!-- Fonts -->
        <link rel="preconnect" href="https://fonts.bunny.net">
        <link href="https://fonts.bunny.net/css?family=figtree:400,500,600&display=swap" rel="stylesheet" />

        <!-- Scripts -->
        @vite(['resources/css/app.css', 'resources/js/app.js'])
    </head>
    <body class="font-sans text-gray-900 antialiased" style="{{ $dealerBrandingCssVars ?? '' }}">
    <div
        class="min-h-screen flex items-center justify-center px-4 relative overflow-hidden"
        style="
        background-image: url('{{ isset($dealer) ? $dealer->loginBackgroundUrl() : asset('images/login-bg.svg') }}');
        background-repeat: no-repeat;
        background-position: center;
        background-size: cover;
        "
    >
        <div class="absolute inset-0 bg-black/50"></div>

        <div class="relative z-10 w-full max-w-md">
        <div class="bg-neutral-100 rounded-xl shadow-2xl p-6 sm:p-8">
            {{ $slot }}
        </div>
        </div>
    </div>
    </body>
</html>
