<x-guest-layout>
    <div class="space-y-6">
        <div class="space-y-2">
            <h1 class="text-2xl font-semibold tracking-tight">Welcome back</h1>
            <p class="text-sm text-muted-foreground">Sign in to your workspace to continue.</p>
        </div>

        @if (session('status'))
            <div class="rounded-md border border-success/30 bg-success/5 px-3 py-2 text-sm text-success">
                {{ session('status') }}
            </div>
        @endif

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

            <div class="space-y-1.5">
                <x-ui.label for="email">Email</x-ui.label>
                <x-ui.input id="email" type="email" name="email" value="{{ old('email') }}" required autofocus autocomplete="username" placeholder="you@example.com" />
                @error('email') <p class="text-xs text-destructive">{{ $message }}</p> @enderror
            </div>

            <div class="space-y-1.5">
                <div class="flex items-center justify-between">
                    <x-ui.label for="password">Password</x-ui.label>
                    @if (Route::has('password.request'))
                        <a href="{{ route('password.request') }}" class="text-xs text-muted-foreground hover:text-foreground">Forgot?</a>
                    @endif
                </div>
                <x-ui.input id="password" type="password" name="password" required autocomplete="current-password" />
                @error('password') <p class="text-xs text-destructive">{{ $message }}</p> @enderror
            </div>

            <label class="flex items-center gap-2 text-sm text-muted-foreground">
                <input type="checkbox" name="remember" class="rounded border-input" />
                Keep me signed in
            </label>

            <x-ui.button type="submit" class="w-full h-10">Sign in</x-ui.button>
        </form>

        @if (app(\App\Settings\GeneralSettings::class)->allow_registration)
            <p class="text-center text-sm text-muted-foreground">
                New here?
                <a href="{{ route('register') }}" class="font-medium text-foreground hover:underline">Create an account</a>
            </p>
        @endif
    </div>
</x-guest-layout>
