{% extends 'rental_app/base_rental.html' %}

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

{% block content %}

<style>
    /* =========================================================
       RENTAL OWNER CHANGE PASSWORD — PREMIUM
    ========================================================= */

    .rental-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(14, 116, 144, 0.12), transparent 32%),
            linear-gradient(180deg, #f8fafc 0%, #eff6ff 44%, #ffffff 100%);
    }

    .rental-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, #082f49 0%, #0e7490 56%, #0f766e 100%);
        box-shadow: 0 30px 68px rgba(15, 23, 42, 0.20);
    }

    .rental-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;
    }

    .rental-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;
    }

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

    .rental-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;
    }

    .rental-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;
    }

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

    .rental-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);
        height: 100%;
    }

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

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

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

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

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

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

    .rental-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;
    }

    .rental-form-group-custom input:focus {
        outline: none;
        border-color: #0e7490;
        box-shadow: 0 0 0 0.22rem rgba(14, 116, 144, 0.14);
        background-color: #fff;
    }

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

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

    .rental-password-note {
        margin-top: 1.6rem;
        border-radius: 22px;
        padding: 1rem 1.1rem;
        background: #eff6ff;
        border: 1px solid #bfdbfe;
        color: #1d4ed8;
        line-height: 1.72;
    }

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

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

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

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

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

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

    /* =========================================================
       SIDE GUIDANCE CARD
    ========================================================= */

    .rental-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;
    }

    .rental-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%);
    }

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

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

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

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

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

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

    .rental-security-highlight {
        margin-top: 1.45rem;
        border-radius: 24px;
        padding: 1.1rem;
        background:
            radial-gradient(circle at top right, rgba(251, 191, 36, 0.10), transparent 34%),
            #f8fafc;
        border: 1px solid #e2e8f0;
    }

    .rental-security-highlight h6 {
        color: #0f172a;
        font-weight: 950;
        margin-bottom: 0.45rem;
    }

    .rental-security-highlight p {
        color: #64748b;
        line-height: 1.68;
        margin-bottom: 0;
        font-size: 0.94rem;
    }

    /* =========================================================
       RESPONSIVE
    ========================================================= */

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

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

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

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

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


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

        <!-- =====================================================
             HERO
        ====================================================== -->
        <div class="rental-password-hero">
            <div class="rental-password-hero-inner">
                <span class="rental-password-kicker">
                    <i class="bi bi-shield-lock-fill"></i>
                    Rental Owner Account Security
                </span>

                <h1>Change Password</h1>

                <p>
                    Update your Rent in Sri Lanka Rental Owner account password
                    to keep your profile, listings, banking details, 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="rental-password-card">

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

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

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

                                    {{ field }}

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

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

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

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

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

                                <a href="{% url 'rental_app:rental_owner_profile_page' %}"
                                   class="btn btn-outline-secondary rental-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="rental-password-side-card">

                    <div class="rental-password-side-header">
                        <h3>Password Safety Tips</h3>
                        <p>
                            A secure password helps protect your rental profile, listing records, and payout-related information.
                        </p>
                    </div>

                    <div class="rental-password-side-body">
                        <ul class="rental-password-tip-list">
                            <li class="rental-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="rental-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="rental-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="rental-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 class="rental-security-highlight">
                            <h6>
                                Keep Your Rental Account Protected
                            </h6>

                            <p>
                                Your account may include rental listings, payment center actions,
                                banking readiness, and guest interest records. A strong password
                                helps safeguard that activity.
                            </p>
                        </div>
                    </div>

                </div>
            </div>

        </div>

    </div>
</section>

{% endblock %}