<?php require_once __DIR__ . '/../header.php'; ?>

<div class="container py-5">
    <div class="row justify-content-center">
        <div class="col-md-6">
            <div class="card shadow-sm border-0 rounded-4 p-4">
                <h2 class="text-center mb-4"><?php echo __('register_title'); ?></h2>
                
                <?php if (isset($error)): ?>
                    <div class="alert alert-danger"><?= $error ?></div>
                <?php endif; ?>

                <form action="/register" method="POST">
                    <!-- Honeypot field - hidden from users -->
                    <div style="display:none;">
                        <input type="text" name="full_name" value="">
                    </div>

                    <div class="mb-3">
                        <label for="username" class="form-label"><?php echo __('username'); ?></label>
                        <input type="text" class="form-control rounded-3" id="username" name="username" required>
                    </div>
                    <div class="mb-3">
                        <label for="password" class="form-label"><?php echo __('password'); ?></label>
                        <input type="password" class="form-control rounded-3" id="password" name="password" required>
                    </div>
                    <div class="mb-3">
                        <label for="confirm_password" class="form-label"><?php echo __('confirm_password'); ?></label>
                        <input type="password" class="form-control rounded-3" id="confirm_password" name="confirm_password" required>
                    </div>
                    
                    <div class="mb-4">
                        <label for="ref_code" class="form-label"><?php echo __('referral_code_optional'); ?></label>
                        <input type="text" class="form-control rounded-3" id="ref_code" name="ref_code" value="<?= $ref ?? '' ?>" placeholder="e.g. abcdef12">
                    </div>

                    <button type="submit" class="btn btn-primary w-100 rounded-3 py-2"><?php echo __('create_account'); ?></button>
                </form>
                
                <div class="text-center mt-4">
                    <p class="mb-0"><?php echo __('already_have_account'); ?> <a href="/login" class="text-decoration-none text-primary"><?php echo __('login_here'); ?></a></p>
                </div>
            </div>
        </div>
    </div>
</div>

<?php require_once __DIR__ . '/../footer.php'; ?>
