<?php
 
 
 
 
?>

<div class="auth-page">
    <div class="auth-card">
        <h1 class="auth-card__title"><?= __('reset_password_title') ?></h1>

        <?php if ($success): ?>
            <div class="form-success" style="padding:12px 16px;background:#ecfdf5;border:1px solid #a7f3d0;border-radius:8px;color:#065f46;font-size:14px;margin-bottom:16px;">
                <?= htmlspecialchars($success) ?>
            </div>
            <div class="auth-footer">
                <a href="/" style="color:var(--primary, #2563eb);font-weight:500;"><?= __('back_to_login') ?></a>
            </div>
        <?php elseif (!$valid): ?>
            <div class="form-error" style="padding:12px 16px;background:#fef2f2;border:1px solid #fecaca;border-radius:8px;color:#991b1b;font-size:14px;margin-bottom:16px;">
                <?= htmlspecialchars($error ?? '') ?>
            </div>
            <div class="auth-footer">
                <a href="/" style="color:var(--primary, #2563eb);font-weight:500;"><?= __('back_to_login') ?></a>
            </div>
        <?php else: ?>
            <?php if ($error): ?>
                <div class="form-error" style="padding:12px 16px;background:#fef2f2;border:1px solid #fecaca;border-radius:8px;color:#991b1b;font-size:14px;margin-bottom:16px;">
                    <?= htmlspecialchars($error) ?>
                </div>
            <?php endif; ?>

            <p style="color:var(--text-muted, #64748b);font-size:14px;margin:0 0 20px;"><?= __('reset_password_desc') ?></p>

            <form action="/reset-password" method="POST">
                <?= Router::csrfField() ?>
                <input type="hidden" name="token" value="<?= htmlspecialchars($token) ?>">

                <div class="form-group">
                    <label for="password"><?= __('new_password') ?></label>
                    <input type="password" id="password" name="password" required minlength="8" autocomplete="new-password">
                </div>

                <div class="form-group">
                    <label for="password_confirm"><?= __('confirm_new_password') ?></label>
                    <input type="password" id="password_confirm" name="password_confirm" required minlength="8" autocomplete="new-password">
                </div>

                <button type="submit" class="btn btn-primary" style="width:100%;"><?= __('reset_password_btn') ?></button>
            </form>
        <?php endif; ?>
    </div>
</div>
