<!DOCTYPE html>
<html lang="<?= current_locale() ?>">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title><?= __('auth.reset_title') ?></title>
    <link rel="stylesheet" href="/admin/assets/css/tokens.css?v=<?= cms_version() ?>">
    <link rel="stylesheet" href="/admin/assets/css/admin.css">
</head>
<body class="login-body">
    <div class="login-container">
        <div class="login-header">
            <h1 class="login-logo">ITSWEBER <span>CMS</span></h1>
        </div>

        <h2 class="login-subtitle"><?= __('auth.reset_heading') ?></h2>

        <?php if (!empty($error)): ?>
        <div class="alert alert-error"><?= e($error) ?></div>
        <?php endif; ?>

        <?php if (!$valid): ?>
            <!-- Token is missing, expired, or already used -->
            <div class="alert alert-error">
                <?= __('auth.reset_invalid') ?>
            </div>
            <p class="login-forgot">
                <a href="/admin/forgot-password"><?= __('auth.reset_request_new') ?></a>
            </p>
        <?php else: ?>
            <form method="POST" action="/admin/reset-password" class="login-form">
                <?= csrf_field() ?>
                <input type="hidden" name="token" value="<?= e($token) ?>">

                <div class="form-group">
                    <label for="password"><?= __('auth.reset_password') ?></label>
                    <input type="password" id="password" name="password"
                           required autofocus minlength="8"
                           placeholder="<?= __('auth.reset_password_placeholder') ?>">
                </div>
                <div class="form-group">
                    <label for="password_confirm"><?= __('auth.reset_confirm') ?></label>
                    <input type="password" id="password_confirm" name="password_confirm"
                           required minlength="8"
                           placeholder="<?= __('auth.reset_confirm_placeholder') ?>">
                </div>
                <button type="submit" class="btn btn-primary btn-full"><?= __('auth.reset_submit') ?></button>
            </form>
        <?php endif; ?>

        <p class="login-forgot">
            <a href="/admin/login"><?= __('auth.reset_back') ?></a>
        </p>
    </div>
</body>
</html>
