<?php
$title = 'Login Client';
$description = 'Form login akun client atau user.';
$errors = flash('errors', []);
?>
<section class="auth-wrap">
    <div class="container">
        <div class="card auth-card">
            <div class="card-header">
                <span class="eyebrow">Masuk akun</span>
                <h1>Login ke dashboard client</h1>
                <p>Gunakan email atau WhatsApp yang sudah terdaftar.</p>
            </div>

            <?php if ($status = flash('status')): ?>
                <div class="alert alert-success"><?= e($status) ?></div>
            <?php endif; ?>

            <?php if ($errors !== []): ?>
                <div class="alert alert-error">
                    <strong>Login gagal:</strong>
                    <ul class="field-errors">
                        <?php foreach ($errors as $messages): ?>
                            <?php foreach ((array) $messages as $message): ?>
                                <li><?= e($message) ?></li>
                            <?php endforeach; ?>
                        <?php endforeach; ?>
                    </ul>
                </div>
            <?php endif; ?>

            <form class="form-grid" action="<?= e(url('/login')) ?>" method="post" novalidate>
                <?= csrf() ?>
                <div class="field">
                    <label for="identifier">Email / WhatsApp</label>
                    <input id="identifier" name="identifier" type="text" value="<?= e(old('identifier')) ?>" autocomplete="username" placeholder="email atau WhatsApp">
                </div>
                <div class="field">
                    <label for="password">Password</label>
                    <input id="password" name="password" type="password" autocomplete="current-password" placeholder="Password">
                </div>
                <div class="form-footer">
                    <button class="button-primary" type="submit">Login</button>
                    <p class="footer-note">Belum punya akun? <a href="<?= e(url('/register')) ?>">Daftar</a></p>
                </div>
            </form>
        </div>
    </div>
</section>
