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

<head>
    <meta charset="utf-8">
    <meta content="width=device-width, initial-scale=1.0" name="viewport">

    <title>Ellia Cellular</title>
    <link rel="icon" href="{{ asset('assets/img/logo_ellia_cellular.jpeg') }}" type="image">

    <link href="assets/vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet">
    <link href="assets/vendor/bootstrap-icons/bootstrap-icons.css" rel="stylesheet">
    <link href="assets/css/style.css" rel="stylesheet">

    <style>
        .login-container {
            min-height: 100vh;
        }

        .login-left {
            background-color: #fff;
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 2rem;
        }

        .login-right {
            background-color: #000;
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 2rem;
        }

        .login-right img {
            max-width: 100%;
            height: auto;
        }

        .card {
            width: 100%;
            max-width: 400px;
        }

        .btn-primary {
            background-color: #f7b731;
            border-color: #f7b731;
        }

        .btn-primary:hover {
            background-color: #e2a620;
            border-color: #e2a620;
        }
    </style>
</head>

<body>

    <div class="container-fluid login-container d-flex">
        <div class="col-md-6 login-left">
            <div class="card">
                <div class="card-body">
                    <div class="pt-4 pb-2">
                        <h5 class="card-title text-center pb-0 fs-4">Login</h5>
                        <p class="text-center small">Masukkan Email & Password</p>
                    </div>

                    <form method="POST" action="{{ route('login') }}" class="row g-3 needs-validation" novalidate>
                        @csrf

                        @if ($errors->any())
                            <div class="alert alert-danger">
                                {{ $errors->first() }}
                            </div>
                        @endif

                        <div class="col-12">
                            <label for="yourUsername" class="form-label">Email</label>
                            <div class="input-group has-validation">
                                <span class="input-group-text">@</span>
                                <input type="text" name="email" class="form-control" id="yourUsername" required>
                            </div>
                        </div>

                        <div class="col-12">
                            <label for="yourPassword" class="form-label">Password</label>

                            <div class="input-group">
                                <input type="password" name="password" class="form-control" id="yourPassword" required>

                                {{-- tombol eye --}}
                                <span class="input-group-text" id="togglePassword" style="cursor:pointer">
                                    <i class="bi bi-eye"></i>
                                </span>
                            </div>
                        </div>


                        <div class="col-12">
                            <button class="btn btn-primary w-100" type="submit">Login</button>
                        </div>
                    </form>
                </div>
            </div>
        </div>

        <div class="col-md-6 login-right">
            <img src="{{ asset('assets/img/logo_ellia_cellular.jpeg') }}" alt="Ellia Cellular Logo">
        </div>
    </div>

    <script src="assets/vendor/bootstrap/js/bootstrap.bundle.min.js"></script>

    <script>
        const toggle = document.getElementById('togglePassword');
        const input = document.getElementById('yourPassword');

        toggle.addEventListener('click', () => {
            const isPwd = input.type === 'password';
            input.type = isPwd ? 'text' : 'password';

            // ubah ikon
            toggle.firstElementChild.classList.toggle('bi-eye', !isPwd);
            toggle.firstElementChild.classList.toggle('bi-eye-slash', isPwd);
        });
    </script>

</body>

</html>
