<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Jambo Admin Login</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        :root {
            --primary: #4f46e5;
            --primary-dark: #4338ca;
            --bg: #f9fafb;
            --surface: #ffffff;
            --text: #111827;
            --border: #e5e7eb;
            --error-bg: #fee2e2;
            --error-text: #991b1b;
            --shadow: 0 10px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
            --radius: 0.75rem;
        }

        body {
            font-family: 'Inter', system-ui, -apple-system, sans-serif;
            background: var(--bg);
            min-height: 100vh;
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 1rem;
        }

        .card {
            background: var(--surface);
            padding: 2.5rem;
            border-radius: var(--radius);
            box-shadow: var(--shadow);
            width: 100%;
            max-width: 400px;
        }

        h1 {
            margin: 0 0 0.5rem;
            font-size: 2rem;
            font-weight: 600;
            color: var(--primary);
            text-align: center;
        }

        .sub {
            text-align: center;
            color: #6b7280;
            margin-bottom: 2rem;
            font-size: 0.95rem;
        }

        label {
            display: block;
            margin-bottom: 0.25rem;
            font-weight: 500;
            color: var(--text);
        }

        input {
            width: 100%;
            padding: 0.75rem 1rem;
            margin-bottom: 1.5rem;
            border: 1px solid var(--border);
            border-radius: var(--radius);
            font-size: 1rem;
            transition: border 0.2s, box-shadow 0.2s;
        }

        input:focus {
            outline: none;
            border-color: var(--primary);
            box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
        }

        button {
            width: 100%;
            padding: 0.875rem;
            background: var(--primary);
            color: white;
            border: none;
            border-radius: var(--radius);
            font-weight: 600;
            font-size: 1rem;
            cursor: pointer;
            transition: background 0.2s, transform 0.1s;
        }

        button:hover {
            background: var(--primary-dark);
        }

        button:active {
            transform: scale(0.98);
        }

        .error {
            background: var(--error-bg);
            color: var(--error-text);
            padding: 0.75rem 1rem;
            margin-bottom: 1.5rem;
            border-radius: var(--radius);
            font-size: 0.9rem;
            border-left: 4px solid #ef4444;
        }
    </style>
</head>
<body>
    <div class="card">
        <h1>Jambo Admin</h1>
        <div class="sub">Sign in to your account</div>
        <?php if (session()->getFlashdata('error')): ?>
            <div class="error"><?= esc(session()->getFlashdata('error')) ?></div>
        <?php endif ?>
        <form method="post" action="<?= base_url('admin/login/attempt') ?>">
            <input type="hidden" name="<?= csrf_token() ?>" value="<?= csrf_hash() ?>">
            <label>Phone (9 digits)</label>
            <input type="text" name="phone" value="<?= esc(old('phone')) ?>" placeholder="712345678" maxlength="12" required>
            <label>PIN (6 digits)</label>
            <input type="password" name="pin" placeholder="••••••" maxlength="6" required>
            <button type="submit">Login</button>
        </form>
    </div>
</body>
</html>