<?php
declare(strict_types=1);
/** @var ?string $error */

require_once __DIR__ . '/http_helpers.php';
$error = $error ?? null;
$csrf = \SeoScope\Auth\AdminCsrf::token();
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title><?= seoscope_h(__('auth.login_title')) ?> — <?= seoscope_h(__('app.name')) ?></title>
    <link rel="stylesheet" href="<?= seoscope_h(seoscope_url('/assets/fonts/inter/inter.css')) ?>">
    <link rel="stylesheet" href="<?= seoscope_h(seoscope_url('/assets/vendor/bootstrap/bootstrap.min.css')) ?>">
    <link rel="stylesheet" href="<?= seoscope_h(seoscope_url('/assets/vendor/fontawesome/css/all.min.css')) ?>">
    <link rel="stylesheet" href="<?= seoscope_h(seoscope_url('/assets/admin-template/css/admin-template.css')) ?>">
</head>
<body class="login-page">
    <div class="login-shell">
        <div class="login-wrapper">
            <div class="row g-0">
                <div class="col-lg-5">
                    <div class="login-left">
                        <div>
                            <div class="brand mb-5">
                                <img class="brand-logo" src="<?= seoscope_h(seoscope_url('/assets/admin-template/images/logo-seoscope.png')) ?>" alt="<?= seoscope_h(__('app.name')) ?>">
                                <span><?= seoscope_h(__('app.name')) ?></span>
                            </div>

                            <div class="left-copy">
                                <h1 class="fw-800"><?= seoscope_h(__('auth.login_hero')) ?></h1>
                                <p class="mb-0">
                                    <?= seoscope_h(__('app.tagline')) ?>
                                </p>
                            </div>
                        </div>

                        <div>
                            <div class="feature-box">
                                <h5><?= seoscope_h(__('dashboard.page_title')) ?></h5>
                                <p><?= seoscope_h(__('dashboard.coming_soon')) ?></p>
                            </div>
                        </div>
                    </div>
                </div>

                <div class="col-lg-7">
                    <div class="login-right">
                        <div class="login-card">
                            <div class="badge-soft"><span aria-hidden="true">✨</span> <?= seoscope_h(__('auth.login_badge')) ?></div>
                            <h2 class="fw-800"><?= seoscope_h(__('auth.login_title')) ?></h2>
                            <p class="subtitle"><?= seoscope_h(__('postinstall.stub.body')) ?></p>

                            <?php if ($error): ?>
                                <div class="alert alert-danger mb-4"><?= seoscope_h($error) ?></div>
                            <?php endif; ?>

                            <form method="post" action="<?= seoscope_h(seoscope_url('/login')) ?>">
                                <input type="hidden" name="_csrf" value="<?= seoscope_h($csrf) ?>">

                                <div class="mb-4">
                                    <label for="email" class="form-label"><?= seoscope_h(__('auth.email')) ?></label>
                                    <input
                                        type="email"
                                        class="form-control"
                                        id="email"
                                        name="email"
                                        placeholder="name@example.com"
                                        required
                                        autocomplete="username"
                                    />
                                </div>

                                <div class="mb-4">
                                    <label for="password" class="form-label"><?= seoscope_h(__('auth.password')) ?></label>
                                    <input
                                        type="password"
                                        class="form-control"
                                        id="password"
                                        name="password"
                                        placeholder="••••••••••••"
                                        required
                                        autocomplete="current-password"
                                    />
                                </div>

                                <button type="submit" class="btn-login">
                                    <?= seoscope_h(__('auth.login_submit')) ?>
                                </button>
                            </form>

                            <p class="helper-text mt-3">
                                <a href="<?= seoscope_h(seoscope_url('/forgot-password')) ?>"><?= seoscope_h(__('auth.forgot_link')) ?></a>
                            </p>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <script src="<?= seoscope_h(seoscope_url('/assets/vendor/bootstrap/bootstrap.bundle.min.js')) ?>"></script>
</body>
</html>
