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

{% block content %}
<div class="container py-5">
    <div class="row justify-content-center">
        <div class="col-lg-8">
            <div class="card border-0 shadow-sm rounded-4 overflow-hidden mb-4">
                <div class="card-header bg-white border-0 py-4 px-4">
                    <div class="d-flex align-items-center">
                        <div class="bg-primary bg-opacity-10 p-3 rounded-4 me-3">
                            <i class="bi bi-person-circle text-primary fs-3"></i>
                        </div>
                        <div>
                            <h2 class="h4 fw-bold mb-0">My Profile</h2>
                            <p class="text-muted small mb-0">Manage your account information</p>
                        </div>
                    </div>
                </div>
                <div class="card-body p-4">
                    <form method="post">
                        {% csrf_token %}
                        
                        <h5 class="fw-bold mb-3">User Information</h5>
                        <div class="row g-3 mb-4">
                            <div class="col-md-6">
                                <label class="form-label small fw-bold text-muted">First Name</label>
                                {{ u_form.first_name }}
                                {% if u_form.first_name.errors %}
                                <div class="text-danger small">{{ u_form.first_name.errors }}</div>
                                {% endif %}
                            </div>
                            <div class="col-md-6">
                                <label class="form-label small fw-bold text-muted">Last Name</label>
                                {{ u_form.last_name }}
                                {% if u_form.last_name.errors %}
                                <div class="text-danger small">{{ u_form.last_name.errors }}</div>
                                {% endif %}
                            </div>
                            <div class="col-12">
                                <label class="form-label small fw-bold text-muted">Email Address</label>
                                {{ u_form.email }}
                                {% if u_form.email.errors %}
                                <div class="text-danger small">{{ u_form.email.errors }}</div>
                                {% endif %}
                            </div>
                        </div>

                        {% if v_form %}
                        <hr class="my-4 opacity-10">
                        <h5 class="fw-bold mb-3">Volunteer Details</h5>
                        <div class="row g-3 mb-4">
                            <div class="col-md-12">
                                <label class="form-label small fw-bold text-muted">Phone Number</label>
                                {{ v_form.phone }}
                                {% if v_form.phone.errors %}
                                <div class="text-danger small">{{ v_form.phone.errors }}</div>
                                {% endif %}
                            </div>
                        </div>
                        {% endif %}

                        <div class="d-flex gap-2">
                            <button type="submit" class="btn btn-primary px-4 rounded-3">Save Changes</button>
                            <a href="{% url 'password_change' %}" class="btn btn-outline-secondary px-4 rounded-3">Change Password</a>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
{% endblock %}
