<?php

$pageTitle = 'Đặt lại mật khẩu - PET SPA';
$errorMessage = $_SESSION['flash_error'] ?? null;
unset($_SESSION['flash_error']);
require BASE_PATH . '/app/views/layouts/header.php';
require BASE_PATH . '/app/views/layouts/navbar.php';
?>

<main><section class="auth-section"><div class="container"><div class="auth-card mx-auto">
    <div class="text-center mb-4"><div class="auth-icon">🐾</div><h1 class="auth-title">Đặt lại mật khẩu</h1><p class="text-muted">Chọn mật khẩu mới cho tài khoản của bạn.</p></div>
    <?php if ($errorMessage): ?><div class="alert alert-danger"><?= htmlspecialchars($errorMessage) ?></div><?php endif; ?>
    <form action="<?= BASE_URL ?>/?url=reset-password" method="POST">
        <input type="hidden" name="_token" value="<?= htmlspecialchars($_SESSION['csrf_token']) ?>">
        <input type="hidden" name="token" value="<?= htmlspecialchars($token) ?>">
        <div class="mb-3"><label class="form-label">Mật khẩu mới</label><div class="password-field"><input id="resetPassword" type="password" name="password" class="form-control" minlength="8" autocomplete="new-password" required><button type="button" class="password-toggle" data-target="resetPassword" aria-label="Hiện mật khẩu" title="Hiện mật khẩu"><i class="bi bi-eye"></i></button></div></div>
        <div class="mb-4"><label class="form-label">Xác nhận mật khẩu mới</label><div class="password-field"><input id="resetPasswordConfirmation" type="password" name="password_confirmation" class="form-control" minlength="8" autocomplete="new-password" required><button type="button" class="password-toggle" data-target="resetPasswordConfirmation" aria-label="Hiện mật khẩu" title="Hiện mật khẩu"><i class="bi bi-eye"></i></button></div></div>
        <button class="btn btn-primary btn-lg w-100">Đặt lại mật khẩu</button>
    </form>
</div></div></section></main>

<?php require BASE_PATH . '/app/views/layouts/footer.php'; ?>
