<!DOCTYPE html>
<html lang="id">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Login - Pusat Data KPH III Asahan</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
    <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
    <style>
        body {
            background-color: #f4f7f6;
            height: 100vh;
            display: flex;
            align-items: center;
            justify-content: center;
        }
        .login-card {
            border: none;
            border-radius: 15px;
            box-shadow: 0 10px 30px rgba(0,0,0,0.1);
            overflow: hidden;
            width: 100%;
            max-width: 900px;
        }
        .bg-login-image {
            background: linear-gradient(rgba(25, 135, 84, 0.8), rgba(25, 135, 84, 0.9)), url('https://images.unsplash.com/photo-1542273917363-3b1817f69a2d?auto=format&fit=crop&q=80') center center;
            background-size: cover;
        }
    </style>
</head>
<body>

<div class="container">
    <div class="card login-card mx-auto">
        <div class="row g-0">
            <!-- Bagian Gambar (Kiri) - Hanya muncul di layar besar -->
            <div class="col-md-6 d-none d-md-flex align-items-center justify-content-center bg-login-image text-white p-5 text-center">
                <div>
                    <i class="fa-solid fa-leaf fa-4x mb-3"></i>
                    <h3 class="fw-bold">KPH III ASAHAN</h3>
                    <p>Sistem Informasi dan Pusat Data Digital Kesatuan Pengelolaan Hutan Wilayah III Kisaran, Kabupaten Asahan.</p>
                </div>
            </div>
            
            <!-- Bagian Form (Kanan) -->
            <div class="col-md-6 p-5 bg-white">
                <div class="text-center mb-4 d-md-none">
                    <i class="fa-solid fa-leaf fa-3x text-success mb-2"></i>
                    <h4 class="fw-bold text-success">KPH III ASAHAN</h4>
                </div>
                
                <h4 class="fw-bold text-dark mb-1">Selamat Datang!</h4>
                <p class="text-muted mb-4">Silakan masuk menggunakan akun Anda.</p>

                <!-- Menampilkan pesan error jika login gagal -->
                <?php if(session()->getFlashdata('error')) : ?>
                    <div class="alert alert-danger p-2 text-center small">
                        <?= session()->getFlashdata('error') ?>
                    </div>
                <?php endif; ?>

                <form action="<?= base_url('login/proses') ?>" method="POST">
                    <div class="mb-3">
                        <label class="form-label fw-bold text-muted small">Username</label>
                        <div class="input-group">
                            <span class="input-group-text bg-light border-end-0"><i class="fa-solid fa-user text-muted"></i></span>
                            <input type="text" name="username" class="form-control bg-light border-start-0" placeholder="Masukkan username" required>
                        </div>
                    </div>

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

                    <button type="submit" class="btn btn-success w-100 py-2 rounded-pill fw-bold shadow-sm mb-3">MASUK SEKARANG</button>
                    
                    <div class="text-center">
                        <small class="text-muted"><i class="fa-solid fa-shield-halved me-1"></i> Area Internal Terbatas</small>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>

<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>