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

{% block content %}
<div class="container py-5">
    <div class="row justify-content-center">
        <div class="col-lg-6">
            <div class="card border-0 shadow-sm rounded-4 overflow-hidden">
                <div class="card-header bg-white border-0 py-4 px-4 text-center">
                    <div class="bg-primary bg-opacity-10 d-inline-block p-3 rounded-4 mb-3">
                        <i class="bi bi-shield-lock text-primary fs-3"></i>
                    </div>
                    <h2 class="h4 fw-bold mb-0">Change Password</h2>
                    <p class="text-muted small mb-0">Secure your account by updating your password</p>
                </div>
                <div class="card-body p-4">
                    <form method="post">
                        {% csrf_token %}
                        {% for field in form %}
                            <div class="mb-3">
                                <label for="{{ field.id_for_label }}" class="form-label small fw-bold text-muted">{{ field.label }}</label>
                                {{ field }}
                                {% if field.help_text %}
                                    <div class="form-text small">{{ field.help_text }}</div>
                                {% endif %}
                                {% for error in field.errors %}
                                    <div class="text-danger small">{{ error }}</div>
                                {% endfor %}
                            </div>
                        {% endfor %}
                        <div class="d-grid gap-2 mt-4">
                            <button type="submit" class="btn btn-primary py-2 rounded-3">Update Password</button>
                            <a href="{% url 'profile' %}" class="btn btn-light py-2 rounded-3">Cancel</a>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>

<style>
    /* Styling for password help text lists */
    .form-text ul {
        padding-left: 1rem;
        margin-top: 0.5rem;
    }
    input.form-control {
        border-radius: 0.75rem;
        padding: 0.75rem 1rem;
    }
</style>
{% endblock %}
