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

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Login | SIMKP ASN</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;700&display=swap" rel="stylesheet">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.1/font/bootstrap-icons.css">
    <style>
        :root {
            --primary-bg: #f8faff;
            --accent-color: #4361ee;
            --accent-hover: #3a56d4;
            --glass-bg: rgba(255, 255, 255, 0.8);
        }

        body {
            font-family: 'Outfit', sans-serif;
            background: linear-gradient(135deg, #eef2f3 0%, #8e9eab 100%);
            height: 100vh;
            display: flex;
            align-items: center;
            justify-content: center;
            overflow: hidden;
        }

        .login-card {
            background: var(--glass-bg);
            backdrop-filter: blur(10px);
            border-radius: 24px;
            box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
            padding: 3rem;
            width: 100%;
            max-width: 450px;
            border: 1px solid rgba(255, 255, 255, 0.3);
            animation: fadeInScale 0.6s ease-out;
        }

        @keyframes fadeInScale {
            0% {
                opacity: 0;
                transform: scale(0.9);
            }

            100% {
                opacity: 1;
                transform: scale(1);
            }
        }

        .login-header h2 {
            font-weight: 700;
            color: #1a1a1a;
            margin-bottom: 0.5rem;
        }

        .login-header p {
            color: #6c757d;
            margin-bottom: 2rem;
        }

        .form-control {
            border-radius: 12px;
            padding: 0.75rem 1rem;
            border: 1px solid #dee2e6;
            margin-bottom: 1.5rem;
            transition: all 0.3s;
        }

        .form-control:focus {
            box-shadow: 0 0 0 4px rgba(67, 97, 238, 0.15);
            border-color: var(--accent-color);
        }

        .btn-primary {
            background-color: var(--accent-color);
            border: none;
            border-radius: 12px;
            padding: 0.8rem;
            font-weight: 600;
            width: 100%;
            transition: all 0.3s;
        }

        .btn-primary:hover {
            background-color: var(--accent-hover);
            transform: translateY(-2px);
            box-shadow: 0 8px 15px rgba(67, 97, 238, 0.3);
        }

        .alert {
            border-radius: 12px;
            font-weight: 500;
        }

        .footer-text {
            text-align: center;
            margin-top: 2rem;
            font-size: 0.9rem;
            color: #6c757d;
        }

        #debug-icon, .debug-bar {
            display: none !important;
        }
    </style>
</head>

<body>
    <div class="login-card">
        <div class="login-header text-center">
            <img src="<?= base_url('assets/img/logo.png') ?>" alt="Logo" height="120" class="mb-3">
            <h2><?= get_setting('app_name', 'SIMKP ASN') ?></h2>
            <p>Sistem Informasi Kenaikan Pangkat</p>
        </div>

        <?php if (session()->getFlashdata('success')): ?>
            <div class="alert alert-success" role="alert">
                <?= session()->getFlashdata('success') ?>
            </div>
        <?php endif; ?>

        <?php if (session()->getFlashdata('msg')): ?>
            <div class="alert alert-danger" role="alert">
                <?= session()->getFlashdata('msg') ?>
            </div>
        <?php endif; ?>

        <form action="<?= base_url('auth/loginProcess') ?>" method="POST">
            <div class="mb-1">
                <label for="username" class="form-label text-secondary small fw-bold">USERNAME ATAU NIP</label>
                <input type="text" class="form-control" name="username" id="username"
                    placeholder="Masukkan Username/NIP" required autofocus>
            </div>
            <div class="mb-4">
                <label for="password" class="form-label text-secondary small fw-bold">PASSWORD</label>
                <div class="position-relative">
                    <input type="password" class="form-control mb-0" name="password" id="password"
                        placeholder="Masukkan Password" required>
                    <div class="position-absolute end-0 top-0 h-100 d-flex align-items-center pe-3" 
                         onclick="togglePassword()" style="cursor: pointer; z-index: 10;">
                        <i class="bi bi-eye text-secondary" id="eyeIcon"></i>
                    </div>
                </div>
            </div>
            <button type="submit" class="btn btn-primary mb-3">Login Ke Sistem</button>
        </form>

        <div class="text-center small mt-2">
            Belum punya akun? <a href="<?= base_url('auth/register') ?>" class="text-decoration-none fw-bold">Daftar di
                sini</a>
        </div>

        <div class="footer-text">
            &copy; 2026 BKPSDM Kabupaten Boalemo. <br> Seluruh Hak Cipta Dilindungi.
        </div>
    </div>

    <script>
        function togglePassword() {
            const passwordInput = document.getElementById('password');
            const eyeIcon = document.getElementById('eyeIcon');
            
            if (passwordInput.type === 'password') {
                passwordInput.type = 'text';
                eyeIcon.classList.remove('bi-eye');
                eyeIcon.classList.add('bi-eye-slash');
            } else {
                passwordInput.type = 'password';
                eyeIcon.classList.remove('bi-eye-slash');
                eyeIcon.classList.add('bi-eye');
            }
        }
    </script>
</body>

</html>