{% extends 'property_manager_app/base_property_manager.html' %}

{% block title %}Change Password{% endblock %}

{% block content %}

<style>
    /* =========================================================
       PROPERTY CARE CHANGE PASSWORD — PREMIUM
    ========================================================= */

    .pm-password-page-section {
        min-height: 100vh;
        padding: 4rem 0 5rem;
        background:
            radial-gradient(circle at top left, rgba(251, 191, 36, 0.10), transparent 28%),
            radial-gradient(circle at top right, rgba(15, 118, 110, 0.12), transparent 32%),
            linear-gradient(180deg, #f8fafc 0%, #ecfdf5 44%, #ffffff 100%);
    }

    .pm-password-hero {
        position: relative;
        overflow: hidden;
        border-radius: 38px;
        padding: 2.5rem 2.35rem;
        margin-bottom: 2rem;
        color: #ffffff;
        background:
            radial-gradient(circle at top right, rgba(251, 191, 36, 0.18), transparent 32%),
            linear-gradient(135deg, #052e25 0%, #0f766e 58%, #115e59 100%);
        box-shadow: 0 30px 68px rgba(15, 23, 42, 0.20);
    }

    .pm-password-hero::before {
        content: "";
        position: absolute;
        top: -110px;
        right: -85px;
        width: 300px;
        height: 300px;
        border-radius: 50%;
        background: rgba(255, 255, 255, 0.07);
        pointer-events: none;
    }

    .pm-password-hero::after {
        content: "";
        position: absolute;
        bottom: -150px;
        left: -110px;
        width: 360px;
        height: 360px;
        border-radius: 50%;
        background: rgba(251, 191, 36, 0.08);
        pointer-events: none;
    }

    .pm-password-hero-inner {
        position: relative;
        z-index: 2;
    }

    .pm-password-kicker {
        display: inline-flex;
        align-items: center;
        gap: 0.5rem;
        padding: 0.52rem 1rem;
        border-radius: 999px;
        background: rgba(255, 255, 255, 0.14);
        border: 1px solid rgba(255, 255, 255, 0.22);
        color: #fef3c7;
        font-size: 0.84rem;
        font-weight: 900;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        margin-bottom: 1rem;
    }

    .pm-password-hero h1 {
        font-size: clamp(2.1rem, 4vw, 3.35rem);
        font-weight: 950;
        line-height: 1.12;
        letter-spacing: -0.045em;
        margin-bottom: 0.8rem;
    }

    .pm-password-hero p {
        max-width: 820px;
        margin-bottom: 0;
        color: rgba(255, 255, 255, 0.88);
        font-size: 1.03rem;
        line-height: 1.8;
    }

    .pm-password-card {
        border: 1px solid rgba(226, 232, 240, 0.95);
        border-radius: 36px;
        box-shadow: 0 24px 56px rgba(15, 23, 42, 0.10);
        overflow: hidden;
        background: rgba(255, 255, 255, 0.98);
    }

    .pm-password-card-header {
        padding: 1.7rem 1.8rem 1.25rem;
        border-bottom: 1px solid #e2e8f0;
        background:
            radial-gradient(circle at top right, rgba(15, 118, 110, 0.06), transparent 28%),
            linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    }

    .pm-password-card-header h2 {
        font-weight: 950;
        color: #0f172a;
        margin-bottom: 0.45rem;
    }

    .pm-password-card-header p {
        color: #64748b;
        margin-bottom: 0;
        font-size: 0.98rem;
        line-height: 1.7;
    }

    .pm-password-card-body {
        padding: 2rem;
    }

    .pm-form-group-custom {
        margin-bottom: 1.45rem;
    }

    .pm-form-group-custom label {
        display: block;
        font-weight: 850;
        margin-bottom: 0.55rem;
        color: #0f172a;
    }

    .pm-form-group-custom input {
        width: 100%;
        border: 1px solid #d9e2ec;
        border-radius: 16px;
        padding: 0.9rem 1rem;
        font-size: 0.96rem;
        background-color: #f8fafc;
        transition: all 0.2s ease;
        color: #0f172a;
    }

    .pm-form-group-custom input:focus {
        outline: none;
        border-color: #0f766e;
        box-shadow: 0 0 0 0.22rem rgba(15, 118, 110, 0.14);
        background-color: #fff;
    }

    .pm-helptext {
        display: block;
        margin-top: 0.48rem;
        color: #64748b;
        font-size: 0.88rem;
        line-height: 1.6;
    }

    .pm-password-error {
        color: #dc2626;
        font-size: 0.88rem;
        margin-top: 0.35rem;
        font-weight: 700;
    }

    .pm-password-note {
        margin-top: 1.6rem;
        border-radius: 22px;
        padding: 1rem 1.1rem;
        background: #ecfeff;
        border: 1px solid #a5f3fc;
        color: #0f766e;
        line-height: 1.72;
    }

    .pm-password-actions {
        margin-top: 1.8rem;
        display: flex;
        flex-wrap: wrap;
        gap: 0.85rem;
    }

    .pm-password-actions .btn {
        min-height: 52px;
        border-radius: 999px;
        padding: 0.82rem 1.45rem;
        font-weight: 850;
    }

    .pm-btn-password-save {
        background: linear-gradient(135deg, #0f172a, #0f766e);
        color: #fff;
        border: none;
    }

    .pm-btn-password-save:hover {
        color: #fff;
        transform: translateY(-1px);
    }

    .pm-btn-password-cancel {
        font-weight: 850;
    }

    .pm-password-alert {
        border-radius: 20px;
        margin-top: 1.4rem;
    }

    .pm-password-side-card {
        height: 100%;
        border-radius: 34px;
        background: rgba(255, 255, 255, 0.98);
        border: 1px solid rgba(226, 232, 240, 0.95);
        box-shadow: 0 24px 56px rgba(15, 23, 42, 0.10);
        overflow: hidden;
    }

    .pm-password-side-header {
        padding: 1.6rem 1.7rem 1.15rem;
        border-bottom: 1px solid #e2e8f0;
        background:
            radial-gradient(circle at top right, rgba(251, 191, 36, 0.08), transparent 28%),
            linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    }

    .pm-password-side-header h3 {
        color: #0f172a;
        font-weight: 950;
        margin-bottom: 0.4rem;
    }

    .pm-password-side-header p {
        color: #64748b;
        line-height: 1.7;
        margin-bottom: 0;
    }

    .pm-password-side-body {
        padding: 1.7rem;
    }

    .pm-password-tip-list {
        display: grid;
        gap: 0.95rem;
        margin: 0;
        padding: 0;
        list-style: none;
    }

    .pm-password-tip-item {
        display: flex;
        align-items: flex-start;
        gap: 0.75rem;
        color: #475569;
        line-height: 1.68;
    }

    .pm-password-tip-item i {
        color: #0f766e;
        font-size: 1.05rem;
        margin-top: 0.2rem;
        flex-shrink: 0;
    }

    @media (max-width: 991.98px) {
        .pm-password-page-section {
            padding-top: 2.8rem;
        }

        .pm-password-hero {
            padding: 2rem 1.45rem;
            border-radius: 30px;
        }

        .pm-password-card-body,
        .pm-password-card-header,
        .pm-password-side-header,
        .pm-password-side-body {
            padding-left: 1.35rem;
            padding-right: 1.35rem;
        }
    }

    @media (max-width: 767.98px) {
        .pm-password-actions {
            flex-direction: column;
            align-items: stretch;
        }

        .pm-password-actions .btn {
            width: 100%;
        }
    }
</style>


<section class="pm-password-page-section">
    <div class="container">

        <!-- =====================================================
             HERO
        ====================================================== -->
        <div class="pm-password-hero">
            <div class="pm-password-hero-inner">
                <span class="pm-password-kicker">
                    <i class="bi bi-shield-lock-fill"></i>
                    Property Care Account Security
                </span>

                <h1>Change Password</h1>

                <p>
                    Update your Home in Sri Lanka Property Care account password
                    to keep your owner profile, property details, documents, and dashboard access secure.
                </p>
            </div>
        </div>


        <div class="row g-4 justify-content-center align-items-stretch">

            <!-- MAIN FORM -->
            <div class="col-lg-7">
                <div class="pm-password-card">

                    <div class="pm-password-card-header">
                        <h2>Update Account Password</h2>
                        <p>
                            Enter your current password and choose a stronger new password for your Property Care account.
                        </p>
                    </div>

                    <div class="pm-password-card-body">
                        <form method="post">
                            {% csrf_token %}

                            {% for field in form %}
                                <div class="pm-form-group-custom">
                                    <label for="{{ field.id_for_label }}">
                                        {{ field.label }}
                                    </label>

                                    {{ field }}

                                    {% if field.help_text %}
                                        <small class="pm-helptext">
                                            {{ field.help_text|safe }}
                                        </small>
                                    {% endif %}

                                    {% for error in field.errors %}
                                        <div class="pm-password-error">
                                            {{ error }}
                                        </div>
                                    {% endfor %}
                                </div>
                            {% endfor %}

                            {% if form.non_field_errors %}
                                <div class="alert alert-danger pm-password-alert">
                                    {% for error in form.non_field_errors %}
                                        <div>{{ error }}</div>
                                    {% endfor %}
                                </div>
                            {% endif %}

                            <div class="pm-password-note">
                                After changing your password, you will remain signed in on this device,
                                but you should use the new password for future logins.
                            </div>

                            <div class="pm-password-actions">
                                <button type="submit"
                                        class="btn pm-btn-password-save">
                                    <i class="bi bi-check-circle-fill me-2"></i>
                                    Update Password
                                </button>

                                <a href="{% url 'property_manager_app:property_manager_profile_page' %}"
                                   class="btn btn-outline-secondary pm-btn-password-cancel">
                                    <i class="bi bi-arrow-left-circle me-2"></i>
                                    Cancel
                                </a>
                            </div>
                        </form>
                    </div>

                </div>
            </div>


            <!-- SIDE INFO -->
            <div class="col-lg-5">
                <div class="pm-password-side-card">

                    <div class="pm-password-side-header">
                        <h3>Password Safety Tips</h3>
                        <p>
                            A secure password helps protect your Property Care records and account activity.
                        </p>
                    </div>

                    <div class="pm-password-side-body">
                        <ul class="pm-password-tip-list">
                            <li class="pm-password-tip-item">
                                <i class="bi bi-check-circle-fill"></i>
                                <span>Use a password that is not reused on other websites or systems.</span>
                            </li>

                            <li class="pm-password-tip-item">
                                <i class="bi bi-check-circle-fill"></i>
                                <span>Combine uppercase letters, lowercase letters, numbers, and symbols where possible.</span>
                            </li>

                            <li class="pm-password-tip-item">
                                <i class="bi bi-check-circle-fill"></i>
                                <span>Avoid including your name, property name, phone number, or other obvious personal details.</span>
                            </li>

                            <li class="pm-password-tip-item">
                                <i class="bi bi-check-circle-fill"></i>
                                <span>Update your password promptly if you ever suspect your login details were exposed.</span>
                            </li>
                        </ul>
                    </div>

                </div>
            </div>

        </div>

    </div>
</section>

{% endblock %}