@component('layouts.app', ['title' => 'Login'])
    <div class="min-h-dvh flex items-center justify-center p-6">
        <div class="w-full max-w-md rounded-2xl bg-card p-6 ring-1 ring-border">
            <div class="text-center">
                <div class="mx-auto flex items-center justify-center gap-2">
                    <div class="grid h-12 w-12 place-items-center rounded-xl bg-primary text-primary-foreground shadow-sm">
                        <svg class="h-7 w-7" viewBox="0 0 24 24" fill="none" aria-hidden="true">
                            <path d="M12 2l7 4v6c0 5-3 9-7 10-4-1-7-5-7-10V6l7-4Z" stroke="currentColor" stroke-width="2" stroke-linejoin="round"/>
                        </svg>
                    </div>
                    <span class="text-2xl font-bold tracking-tight">PatchBook</span>
                </div>

                <h1 class="mt-4 text-2xl font-bold tracking-tight">Welcome back</h1>
                <p class="mt-2 text-sm text-muted-foreground">Log in to your crew and continue earning patches.</p>
            </div>

            <div class="mt-6">
                <a href="{{ route('workos.redirect') }}" class="btn-outline w-full text-base">
                    <span class="inline-flex items-center justify-center gap-2">
                        <svg class="h-5 w-5" viewBox="0 0 24 24" aria-hidden="true">
                            <path fill="currentColor" d="M21.35 11.1H12v2.9h5.35c-.25 1.45-1.65 4.25-5.35 4.25-3.2 0-5.8-2.65-5.8-5.9s2.6-5.9 5.8-5.9c1.85 0 3.1.8 3.8 1.5l2.6-2.5C16.8 3.95 14.6 3 12 3 6.9 3 2.75 7.15 2.75 12.35S6.9 21.7 12 21.7c5.6 0 9.3-3.95 9.3-9.5 0-.65-.1-1.1-.2-1.1Z"/>
                        </svg>
                        <span>Continue with Google</span>
                    </span>
                </a>

                <div class="my-6 flex items-center gap-3">
                    <hr class="flex-1 border-border" />
                    <span class="text-xs text-muted-foreground">or</span>
                    <hr class="flex-1 border-border" />
                </div>

                <form method="POST" action="{{ route('login') }}" class="space-y-4">
                    @csrf

                    <div>
                        <label for="email" class="block text-sm font-medium">Email</label>
                        <input
                            id="email"
                            name="email"
                            type="email"
                            value="{{ old('email') }}"
                            required
                            autofocus
                            autocomplete="email"
                            class="mt-1 w-full rounded-xl bg-background px-4 py-3 text-sm ring-1 ring-border focus:outline-none focus:ring-2 focus:ring-ring/30"
                        />
                        @error('email')
                        <p class="mt-1 text-xs text-destructive">{{ $message }}</p>
                        @enderror
                    </div>

                    <div>
                        <label for="password" class="block text-sm font-medium">Password</label>
                        <input
                            id="password"
                            name="password"
                            type="password"
                            required
                            autocomplete="current-password"
                            class="mt-1 w-full rounded-xl bg-background px-4 py-3 text-sm ring-1 ring-border focus:outline-none focus:ring-2 focus:ring-ring/30"
                        />
                        @error('password')
                        <p class="mt-1 text-xs text-destructive">{{ $message }}</p>
                        @enderror
                    </div>

                    <div class="flex items-center justify-between">
                        <label class="inline-flex items-center gap-2 text-sm text-muted-foreground">
                            <input
                                type="checkbox"
                                name="remember"
                                class="h-4 w-4 rounded border-border text-primary focus:ring-ring/30"
                            />
                            Remember me
                        </label>

                        @if (Route::has('password.request'))
                            <a href="{{ route('password.request') }}" class="text-sm font-semibold text-primary">
                                Forgot password?
                            </a>
                        @endif
                    </div>

                    <button type="submit" class="btn-primary w-full text-base">
                        Log in
                    </button>
                </form>

                <p class="mt-5 text-center text-sm text-muted-foreground">
                    No account yet?
                    <a href="{{ route('register') }}" class="font-semibold text-primary" wire:navigate>
                        Sign up
                    </a>
                </p>
            </div>
        </div>
    </div>
@endcomponent
