@extends('layouts.app')
@section('title', 'Login - ISPA Prediction')
@section('content')
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons/font/bootstrap-icons.css">
<style>
    @import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600&display=swap');

    body {
        background: none;
        margin: 0;
        padding: 0;
        font-family: 'Poppins', sans-serif;
        height: 100vh;
        display: flex;
        justify-content: center;
        align-items: center;
    }

    .login-container {
        background: white;
        padding: 50px 40px;
        border-radius: 20px;
        box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
        width: 100%;
        max-width: 420px;
        text-align: center;
        z-index: 2;
        border-top: 8px solid #2563eb;
    }

    .login-container h2 {
        font-size: 2rem;
        font-weight: 600;
        margin-bottom: 10px;
        color: #1e3a8a;
    }

    .form-group {
        margin-bottom: 25px;
        text-align: left;
    }

    .form-group label {
        font-weight: 500;
        margin-bottom: 8px;
        display: block;
        color: #333;
    }

    .input-group {
        position: relative;
        display: flex;
        align-items: center;
        border: 1px solid #cfd8e3;
        border-radius: 50px;
        background-color: #eaf1ff;
        padding: 5px 15px;
    }

    .input-group .form-control {
        border: none;
        background: transparent;
        padding-left: 10px;
        font-size: 1rem;
        flex: 1;
        border-radius: 0;
    }

    .input-group-text {
        background: transparent;
        border: none;
        font-size: 1.1rem;
        color: #333;
    }

    .form-control:focus {
        outline: none;
        box-shadow: none;
        background-color: #fff;
    }
.btn-primary {
    width: auto;
    padding: 12px 28px; /* dinaikkan dari 8px 20px */
    border-radius: 25px;
    background-color: #2563eb;
    border: none;
    font-size: 1rem; /* dinaikkan dari 0.9rem */
    color: white;
    font-weight: 500;
    letter-spacing: 0.5px;
    transition: all 0.2s ease;
    box-shadow: 0 4px 0 #1e40af, 0 6px 12px rgba(0, 0, 0, 0.1);
    margin-top: 0.5px;
}


.btn-primary:hover {
    background-color: #1e40af;
    transform: translateY(-2px);
    box-shadow: 0 6px 0 #1e3a8a, 0 10px 16px rgba(0, 0, 0, 0.15);
}

    .toggle-password {
        position: absolute;
        right: 15px;
        top: 50%;
        transform: translateY(-50%);
        cursor: pointer;
        color: #666;
        font-size: 18px;
    }

    .toggle-password:hover {
        color: #333;
    }

    @media screen and (max-width: 600px) {
        .login-container {
            padding: 35px 25px;
        }

        .form-control {
            font-size: 0.95rem;
        }
    }
</style>

<!-- Info Login Popup -->
<div id="loginInfoPopup" style="position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
    background-color: #f1f5f9; border-radius: 15px; padding: 25px 30px; box-shadow: 0 8px 20px rgba(0,0,0,0.2);
    z-index: 9999; max-width: 90%; width: 400px; text-align: center; display: none;">
    <h4 style="margin-bottom: 10px; color: #1e3a8a;">Info Login Admin</h4>
    <p style="margin-bottom: 5px;"><strong>Username:</strong> admin@example.com</p>
    <p style="margin-bottom: 15px;"><strong>Password:</strong> password</p>
    <button onclick="document.getElementById('loginInfoPopup').style.display='none'"
        style="background-color: #2563eb; border: none; color: white; padding: 8px 20px;
        border-radius: 30px; cursor: pointer;">Tutup</button>
</div>

<div class="login-container">
    <div style="display: flex; align-items: center; justify-content: center; gap: 15px; margin-bottom: 20px;">
        <img src="{{ asset('images/pantauispa.png') }}" alt="Logo" style="width: 60px;">
        <h2 style="margin: 0;">Login Admin</h2>
    </div>
    <p style="font-family: 'Courier New', monospace; font-size: 0.8rem; color: #555; margin-top: -10px;">
        Selamat datang kembali di Login Admin
    </p>

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

        <!-- Username -->
        <div class="form-group">
            <label for="email">Username</label>
            <div class="input-group">
                <span class="input-group-text"><i class="bi bi-person-fill"></i></span>
                <input type="text" name="email" id="email" class="form-control" placeholder="Masukkan username" required autofocus>
            </div>
        </div>

        <!-- Password -->
        <div class="form-group">
            <label for="password">Password</label>
            <div class="input-group">
                <span class="input-group-text"><i class="bi bi-lock-fill"></i></span>
                <input type="password" id="password" name="password" class="form-control" placeholder="Masukkan password" required>
                <span class="toggle-password" onclick="togglePassword()">
                    <i class="bi bi-eye-slash" id="toggleIcon"></i>
                </span>
            </div>
            <div style="text-align: right; margin-top: 5px;">
                <button type="button" onclick="document.getElementById('loginInfoPopup').style.display='block'" 
                    style="background:none; border:none; color:#2563eb; padding:0; font-size:0.85rem; cursor:pointer;">
                    Info Login Admin
                </button>
            </div>
        </div>

        <!-- Submit -->
        <button type="submit" class="btn btn-primary">Login</button>
    </form>
</div>

<script>
    function togglePassword() {
        const passwordInput = document.getElementById('password');
        const toggleIcon = document.getElementById('toggleIcon');

        if (passwordInput.type === "password") {
            passwordInput.type = "text";
            toggleIcon.classList.replace("bi-eye-slash", "bi-eye");
        } else {
            passwordInput.type = "password";
            toggleIcon.classList.replace("bi-eye", "bi-eye-slash");
        }
    }
</script>
@endsection
