{% extends 'base/base.html' %}

{% block title %}Sign Up - CryptoSignals Pro{% endblock %}

{% block extra_css %}
<style>
    .auth-wrapper {
        min-height: calc(100vh - 200px);
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 2rem;
    }
    
    .auth-card-new {
        background: rgba(17, 24, 39, 0.8);
        backdrop-filter: blur(20px);
        border: 1px solid rgba(0, 212, 255, 0.2);
        border-radius: 24px;
        padding: 2.5rem;
        max-width: 480px;
        width: 100%;
        position: relative;
        overflow: hidden;
    }
    
    .auth-card-new::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        height: 4px;
        background: linear-gradient(90deg, #00d4ff, #7b2ff7, #f107a3);
    }
    
    .auth-card-new::after {
        content: '';
        position: absolute;
        top: -50%;
        left: -50%;
        width: 200%;
        height: 200%;
        background: radial-gradient(circle, rgba(0, 212, 255, 0.05) 0%, transparent 50%);
        pointer-events: none;
    }
    
    .auth-icon-new {
        width: 70px;
        height: 70px;
        border-radius: 20px;
        background: linear-gradient(135deg, rgba(0, 212, 255, 0.2), rgba(123, 47, 247, 0.2));
        display: flex;
        align-items: center;
        justify-content: center;
        margin: 0 auto 1.5rem;
        font-size: 1.75rem;
        color: #00d4ff;
        border: 1px solid rgba(0, 212, 255, 0.3);
    }
    
    .auth-title {
        font-family: 'Space Grotesk', sans-serif;
        font-size: 1.75rem;
        font-weight: 700;
        text-align: center;
        margin-bottom: 0.5rem;
        background: linear-gradient(135deg, #fff 0%, #94a3b8 100%);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        background-clip: text;
    }
    
    .auth-subtitle {
        text-align: center;
        color: #94a3b8;
        margin-bottom: 2rem;
    }
    
    .form-group-new {
        margin-bottom: 1rem;
    }
    
    .form-label-new {
        display: block;
        color: #94a3b8;
        font-weight: 500;
        margin-bottom: 0.5rem;
        font-size: 0.875rem;
    }
    
    .form-control-new {
        width: 100%;
        padding: 0.75rem 1rem;
        background: #0a0e17;
        border: 1px solid #1e293b;
        border-radius: 12px;
        color: #fff;
        font-size: 0.95rem;
        transition: all 0.3s ease;
    }
    
    .form-control-new:focus {
        outline: none;
        border-color: #00d4ff;
        box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.1);
    }
    
    .form-control-new::placeholder {
        color: #64748b;
    }
    
    .btn-login {
        width: 100%;
        padding: 1rem;
        background: linear-gradient(135deg, #00d4ff 0%, #7b2ff7 100%);
        border: none;
        border-radius: 12px;
        color: #fff;
        font-weight: 600;
        font-size: 1rem;
        cursor: pointer;
        transition: all 0.3s ease;
        margin-top: 0.5rem;
    }
    
    .btn-login:hover {
        transform: translateY(-2px);
        box-shadow: 0 10px 30px rgba(0, 212, 255, 0.3);
    }
    
    .auth-footer {
        text-align: center;
        margin-top: 1.5rem;
        color: #94a3b8;
    }
    
    .auth-footer a {
        color: #00d4ff;
        text-decoration: none;
        font-weight: 500;
    }
    
    .auth-footer a:hover {
        text-decoration: underline;
    }
    
    .form-row {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 1rem;
    }
    
    .referral-box {
        background: rgba(0, 212, 255, 0.05);
        border: 1px dashed rgba(0, 212, 255, 0.3);
        border-radius: 12px;
        padding: 1rem;
        margin-bottom: 1rem;
    }
    
    .referral-box .form-label-new {
        margin-bottom: 0;
    }
    
    .error-text {
        color: #ef4444;
        font-size: 0.8rem;
        margin-top: 0.25rem;
    }

    @media (max-width: 575.98px) {
        .auth-wrapper {
            padding: 1rem;
            min-height: auto;
        }

        .auth-card-new {
            padding: 1.5rem 1rem;
            border-radius: 18px;
        }

        .form-row {
            grid-template-columns: 1fr;
            gap: 0;
        }

        .auth-title {
            font-size: 1.45rem;
        }
    }
</style>
{% endblock %}

{% block content %}
<div class="auth-wrapper">
    <div class="auth-card-new">
        <div class="auth-icon-new">
            <i class="bi bi-person-plus-fill"></i>
        </div>
        
        <h1 class="auth-title">Create Account</h1>
        <p class="auth-subtitle">Join CryptoSignals Pro today</p>
        
        {% if messages %}
            {% for message in messages %}
            <div class="alert alert-{{ message.tags }} alert-dismissible fade show" role="alert" style="background: rgba(16, 185, 129, 0.1); border: none; color: #10b981; border-radius: 10px;">
                {{ message }}
                <button type="button" class="btn-close" data-bs-dismiss="alert"></button>
            </div>
            {% endfor %}
        {% endif %}
        
        <form method="post">
            {% csrf_token %}
            
            {% if form.errors %}
            <div class="alert alert-danger" style="background: rgba(239, 68, 68, 0.1); border: none; color: #ef4444; border-radius: 10px;">
                {% for field in form %}
                    {% for error in field.errors %}
                        <p class="mb-1">{{ error }}</p>
                    {% endfor %}
                {% endfor %}
                {% for error in form.non_field_errors %}
                    <p class="mb-0">{{ error }}</p>
                {% endfor %}
            </div>
            {% endif %}
            
            <div class="form-row">
                <div class="form-group-new">
                    <label class="form-label-new">First Name</label>
                    {{ form.first_name }}
                </div>
                <div class="form-group-new">
                    <label class="form-label-new">Last Name</label>
                    {{ form.last_name }}
                </div>
            </div>
            
            <div class="form-group-new">
                <label class="form-label-new">Username</label>
                {{ form.username }}
            </div>
            
            <div class="form-group-new">
                <label class="form-label-new">Email Address</label>
                {{ form.email }}
            </div>
            
            <div class="referral-box">
                <label class="form-label-new">Referral Code (Optional)</label>
                {{ form.referrer_code }}
            </div>
            
            <div class="form-group-new">
                <label class="form-label-new">Password</label>
                {{ form.password1 }}
            </div>
            
            <div class="form-group-new">
                <label class="form-label-new">Confirm Password</label>
                {{ form.password2 }}
            </div>
            
            <button type="submit" class="btn-login">Create Account</button>
        </form>
        
        <p class="auth-footer">
            Already have an account? 
            <a href="{% url 'login' %}">Sign In</a>
        </p>
    </div>
</div>
{% endblock %}
