<?php
 
?>

<div class="auth-page">
    <div class="auth-card">
        <h1 class="auth-card__title"><?php echo __('sign_up'); ?></h1>

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

        <form action="<?php echo url('/register'); ?>" method="POST">
            <?php echo Router::csrfField(); ?>

            <div class="form-group">
                <label for="username"><?php echo __('username'); ?></label>
                <input type="text" id="username" name="username" required autocomplete="username" value="<?php echo htmlspecialchars($_POST['username'] ?? ''); ?>">
            </div>

            <div class="form-group">
                <label for="email"><?php echo __('email'); ?></label>
                <input type="email" id="email" name="email" required autocomplete="email" placeholder="<?php echo __('email'); ?>" value="<?php echo htmlspecialchars($_POST['email'] ?? ''); ?>">
            </div>

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

            <div class="form-group">
                <label for="password_confirm"><?php echo __('confirm_password'); ?></label>
                <input type="password" id="password_confirm" name="password_confirm" required autocomplete="new-password">
            </div>

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

        <div class="auth-footer">
            <?php echo __('have_account'); ?> <a href="<?php echo url('/login'); ?>"><?php echo __('log_in'); ?></a>
        </div>
    </div>
</div>
