@extends('layouts.auth')

@section('title', 'Login')

@section('content')
    <h2 class="auth-title">LOGIN</h2>

    @if(session('success'))
        <div class="alert alert-success">
            {{ session('success') }}
        </div>
    @endif


    @if (session('error'))
        <div class="alert alert-danger">
            {{ session('error') }}
        </div>
    @endif

    <form method="POST" action="{{ route('login') }}">
        @csrf

        <div class="mb-3">
            <input type="email" class="form-control @error('email') is-invalid @enderror" 
                placeholder="Masukkan E-mail Anda" name="email" value="{{ old('email') }}" required autofocus>
            @error('email')
                <span class="invalid-feedback" role="alert">
                    <strong>{{ $message }}</strong>
                </span>
            @enderror
        </div>

        <div class="mb-3 position-relative">
            <input type="password" class="form-control @error('password') is-invalid @enderror" 
                placeholder="Masukkan Password Anda" name="password" id="password" required>
            <span class="position-absolute top-50 end-0 translate-middle-y me-2 password-toggle" 
                  onclick="togglePassword('password')" style="cursor: pointer;">
                <i class="bi bi-eye-slash" id="password-icon"></i>
            </span>
            @error('password')
                <span class="invalid-feedback" role="alert">
                    <strong>{{ $message }}</strong>
                </span>
            @enderror
        </div>

        <button type="submit" class="btn btn-auth">LOGIN</button>
    </form>

    <div class="text-center mb-3">
        <a href="{{ route('password.request') }}" class="text-decoration-none">Lupa Password?</a>
    </div>

    <div class="auth-footer">
        Belum Punya akun? <a href="{{ route('register') }}">Daftar</a>
    </div>
@endsection 