<!doctype html>
<html lang="id">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title><?= esc($title ?? 'Login Admin') ?></title>
    <link rel="stylesheet" href="<?= base_url('css/app.css') ?>">
</head>
<body class="auth-page">
    <main class="login-shell">
        <section class="login-panel">
            <p class="eyebrow">Buku Kas Umum</p>
            <h1>Login Admin</h1>
            <p class="login-copy">Masuk untuk mengelola transaksi dan laporan kas.</p>

            <?php if (session()->getFlashdata('error')) : ?>
                <div class="alert alert-error"><?= esc(session()->getFlashdata('error')) ?></div>
            <?php endif ?>

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

            <form action="<?= site_url('login') ?>" method="post" class="login-form">
                <label>
                    <span>Username</span>
                    <input type="text" name="username" value="<?= esc(old('username')) ?>" autocomplete="username" required autofocus>
                </label>

                <label>
                    <span>Password</span>
                    <input type="password" name="password" autocomplete="current-password" required>
                </label>

                <button class="button" type="submit">Masuk</button>
            </form>
        </section>
    </main>
</body>
</html>
