{% extends "master.html" %}
{% load static %}

{% block content %}
<div class="container mt-5" style="margin: 125px !important;">
    <div class="row justify-content-center">
        <div class="col-lg-6">
            <div class="card shadow-lg border-0 rounded-4">
                <div class="card-body p-5">
                    <h2 class="text-center fw-bold text-primary">Edit Profile</h2>
                    <hr>

                    {% if messages %}
                        {% for message in messages %}
                            <div class="alert {% if message.tags == 'error' %} alert-danger {% else %} alert-success {% endif %} text-center">
                                {{ message }}
                            </div>
                        {% endfor %}
                    {% endif %}

                    <form method="POST" enctype="multipart/form-data">
                        {% csrf_token %}
                        
                        <div class="mb-3">
                            <label class="form-label">Username</label>
                            {{ form.username }}
                        </div>

                        <div class="mb-3">
                            <label class="form-label">Full Name</label>
                            {{ form.full_name }}
                        </div>

                        <div class="mb-3">
                            <label class="form-label">Email</label>
                            {{ form.email }}
                        </div>

                        <div class="mb-3">
                            <label class="form-label">Phone</label>
                            {{ form.phone }}
                        </div>

                        
                        <button type="submit" class="btn btn-primary w-100">Update Profile</button>
                    </form>

                    <a href="{% url 'profile' %}" class="btn btn-secondary w-100 mt-3">Cancel</a>
                </div>
            </div>
        </div>
    </div>
</div>
{% endblock %}
