<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Masuk - TaniDesa</title>
    
    <link href="{{ asset('template/frontend/css/bootstrap.min.css') }}" rel="stylesheet">
    <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.15.4/css/all.css" />
    
    <style>
        body {
            background-color: #f4f6f9;
            height: 100vh;
            display: flex;
            align-items: center;
            justify-content: center;
        }
        .card-auth {
            width: 100%;
            max-width: 400px;
            border: none;
            border-radius: 15px;
            box-shadow: 0 0 20px rgba(0,0,0,0.05);
        }
        .form-control:focus {
            border-color: #81c408; /* Warna Hijau Frontend */
            box-shadow: 0 0 0 0.25rem rgba(129, 196, 8, 0.25);
        }
        .btn-tani {
            background-color: #81c408;
            border-color: #81c408;
            color: white;
            font-weight: 600;
        }
        .btn-tani:hover {
            background-color: #6da705;
            color: white;
        }
        .text-tani {
            color: #81c408;
        }
    </style>
</head>

<body>

    <div class="card card-auth bg-white p-4">
        <div class="card-body">
            <div class="text-center mb-4">
                <a href="{{ url('/') }}" class="text-decoration-none">
                    <h1 class="text-tani display-6 fw-bold">TaniDesa</h1>
                </a>
                <p class="text-muted">Masuk untuk melanjutkan</p>
            </div>

            {{-- Pesan Sukses --}}
            @if (session('success'))
                <div class="alert alert-success py-2" role="alert">
                    <small>{{ session('success') }}</small>
                </div>
            @endif

            {{-- Pesan Error --}}
            @if ($errors->any())
                <div class="alert alert-danger py-2">
                    <ul class="mb-0 ps-3 small">
                        @foreach ($errors->all() as $error)
                            <li>{{ $error }}</li>
                        @endforeach
                    </ul>
                </div>
            @endif

            <form action="{{ route('login.proses') }}" method="POST">
                @csrf
                <div class="mb-3">
                    <label class="form-label text-muted small">Username</label>
                    <div class="input-group">
                        <span class="input-group-text bg-light border-end-0"><i class="fas fa-user text-muted"></i></span>
                        <input type="text" name="username" class="form-control border-start-0 ps-0" placeholder="Masukkan username" required>
                    </div>
                </div>

                <div class="mb-4">
                    <label class="form-label text-muted small">Password</label>
                    <div class="input-group">
                        <span class="input-group-text bg-light border-end-0"><i class="fas fa-lock text-muted"></i></span>
                        <input type="password" name="password" class="form-control border-start-0 ps-0" placeholder="Masukkan password" required>
                    </div>
                </div>

                <div class="d-grid gap-2">
                    <button type="submit" class="btn btn-tani rounded-pill py-2">MASUK</button>
                </div>
            </form>

            <div class="text-center mt-4">
                <small class="text-muted">Belum punya akun? <a href="{{ route('register') }}" class="text-tani fw-bold text-decoration-none">Daftar</a></small>
            </div>
        </div>
    </div>

</body>
</html>