{% extends 'base.html' %}
{% load static %}

{% block extra_head %}
<link rel="stylesheet" href="{% static 'css/auth.css' %}">
<style>
    .top-actions .btn { display: none; }
</style>
{% endblock %}

{% block content %}

<div class="auth-container">
    <div class="auth-box">
        <h2>Create Account</h2>

        {% if messages %}
            {% for message in messages %}
                <div class="alert alert-success">{{ message }}</div>
            {% endfor %}
        {% endif %}

        {% if error %}
            <div class="alert alert-error">{{ error }}</div>
        {% endif %}

        <form method="POST" class="auth-form">
            {% csrf_token %}

            <div class="form-group">
                <label for="username">Username</label>
                <input type="text" id="username" name="username" placeholder="Choose a username" value="{{ username }}" required>
                <small>At least 3 characters</small>
            </div>

            <div class="form-group">
                <label for="email">Email (Optional)</label>
                <input type="email" id="email" name="email" placeholder="your@email.com" value="{{ email }}">
            </div>

            <div class="form-group">
                <label for="password">Password</label>
                <input type="password" id="password" name="password" placeholder="At least 6 characters" required>
                <small>At least 6 characters</small>
            </div>

            <div class="form-group">
                <label for="confirm_password">Confirm Password</label>
                <input type="password" id="confirm_password" name="confirm_password" placeholder="Confirm your password" required>
            </div>

            <div class="form-group">
                <label for="register_as_seller">
                    <input type="checkbox" id="register_as_seller" name="register_as_seller" {% if register_as_seller %}checked{% endif %}>
                    Become a Seller
                </label>
                <small>Enable this if you want to sell products on Hamro Karma.</small>
            </div>

            <button type="submit" class="btn-primary">Register</button>
        </form>

        <p class="auth-link">Already have an account? <a href="{% url 'login' %}">Login here</a></p>
    </div>
</div>

{% endblock %}
