@extends('eliteadmin::layouts.auth')

@section('title', 'Login')

@section('content')
    <div class="auth-card">
        <div class="auth-card-header">
            <h1 class="auth-title">Welcome back</h1>
            <p class="auth-subtitle">Enter your credentials to access your account</p>
        </div>

        @if (session('error'))
            <x-eliteadmin::alert type="danger" :message="session('error')" class="mb-3" />
        @endif

        @if ($errors->any())
            <x-eliteadmin::alert type="danger" :dismissible="false" class="mb-3">
                {{ $errors->first() }}
            </x-eliteadmin::alert>
        @endif

        <form class="auth-form" action="{{ route('login.store') }}" method="POST" novalidate>
            @csrf

            <div class="form-group">
                <label for="email" class="form-label">Email address</label>
                <input type="email" class="form-control @error('email') is-invalid @enderror" id="email" name="email"
                       value="{{ old('email') }}" placeholder="name@example.com" required autofocus>
                @error('email')<div class="invalid-feedback">{{ $message }}</div>@enderror
            </div>

            <div class="form-group">
                <div class="d-flex justify-content-between align-items-center">
                    <label for="password" class="form-label">Password</label>
                    @if (Route::has('password.request'))
                        <a href="{{ route('password.request') }}" class="auth-link small">Forgot password?</a>
                    @endif
                </div>
                <div class="input-group">
                    <input type="password" class="form-control @error('password') is-invalid @enderror" id="password"
                           name="password" placeholder="Enter your password" required>
                    <button class="btn btn-outline-secondary" type="button" data-toggle-password>
                        <i class="bi bi-eye"></i>
                    </button>
                </div>
                @error('password')<div class="invalid-feedback d-block">{{ $message }}</div>@enderror
            </div>

            <div class="form-check">
                <input class="form-check-input" type="checkbox" id="remember" name="remember" @checked(old('remember'))>
                <label class="form-check-label" for="remember">Remember me</label>
            </div>

            <button type="submit" class="btn btn-primary btn-block">Sign in</button>
        </form>

        @if ($registrationEnabled ?? false)
            <p class="auth-footer-text mt-3 mb-0">
                Don't have an account?
                <a href="{{ route('register') }}" class="auth-link">Register as customer</a>
            </p>
        @endif
    </div>
@endsection
