<!DOCTYPE html>
<?php /* Variables: $baseUrl, $assetsUrl, $error, $success */ ?>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Forgot password · <?= htmlspecialchars(\PpPhp\Core\Brand::name()) ?></title>
    <link href="<?= $assetsUrl ?>/bootstrap/css/bootstrap.min.css" rel="stylesheet">
    <link href="<?= $assetsUrl ?>/icons/bootstrap-icons.css" rel="stylesheet">
    <?php include constant('BASE_PATH') . '/core/views/theme-head.php'; ?>
    <?php include __DIR__ . '/partials/auth-card.css.php'; ?>
</head>

<body>
    <main class="auth-wrap">
        <div class="auth-card">
            <div style="display:flex;justify-content:center;margin-bottom:1.1rem"><?= \PpPhp\Core\Brand::lockup(30) ?></div>
            <div class="auth-head">
                <span class="auth-mark"><i class="bi bi-key-fill"></i></span>
                <h1>Forgot your password?</h1>
                <p>Enter the email address on your account and we'll send you a code to get back in.</p>
            </div>

            <?php if ($error): ?>
                <div class="auth-msg err"><i class="bi bi-exclamation-triangle-fill"></i><span><?= htmlspecialchars($error) ?></span></div>
            <?php endif; ?>
            <?php if ($success): ?>
                <div class="auth-msg ok"><i class="bi bi-check-circle-fill"></i><span><?= htmlspecialchars($success) ?></span></div>
            <?php endif; ?>

            <form method="post" action="<?= $baseUrl ?>/forgot-password" novalidate>
                <label class="auth-label" for="email">Email address</label>
                <input class="form-control" id="email" name="email" type="email" required autofocus
                    placeholder="you@example.com" autocomplete="email">
                <button class="auth-btn mt-3" type="submit"><i class="bi bi-send me-1"></i> Send reset code</button>
            </form>

            <?php if (!empty($ownerRecoverable)): ?>
                <div class="auth-owner-recover" style="margin-top:1rem;padding-top:.9rem;border-top:1px solid var(--pp-border,#e5e7eb)">
                    <p style="font-size:.82rem;color:var(--pp-text-muted,#64748b);margin:0 0 .5rem">
                        Email isn’t configured on this server yet. If you are the platform owner, recover owner access:
                    </p>
                    <form method="post" action="<?= $baseUrl ?>/owner-recover">
                        <button class="auth-btn" type="submit" style="background:var(--pp-accent-soft,#eef2ff);color:var(--pp-accent,#4f46e5)">
                            <i class="bi bi-shield-lock me-1"></i> Recover owner access
                        </button>
                    </form>
                </div>
            <?php endif; ?>

            <div class="auth-foot">
                <a href="<?= $baseUrl ?>/login"><i class="bi bi-arrow-left me-1"></i> Back to sign in</a>
                <a href="<?= $baseUrl ?>/reset-password">I already have a code</a>
            </div>
        </div>
    </main>
</body>

</html>
