{% extends 'expat_life/base.html' %}

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

{% block content %}
<style>
    /* =========================================================
       PASSWORD PAGE - PREMIUM LIVE IN SRI LANKA THEME
    ========================================================= */

    :root {
        --lis-deep: #07131c;
        --lis-navy: #0b2638;
        --lis-blue: #0d6efd;
        --lis-blue-dark: #0b3d91;
        --lis-teal: #0f766e;
        --lis-gold: #ffc107;
        --lis-gold-light: #ffd45f;
        --lis-soft-blue: #f5f9ff;
        --lis-white: #ffffff;
        --lis-text: #102033;
        --lis-muted: #64748b;
        --lis-border: rgba(15, 42, 64, 0.10);
        --lis-shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
        --lis-shadow-strong: 0 28px 70px rgba(15, 23, 42, 0.16);
    }

    .password-page-section {
        position: relative;
        overflow: hidden;
        min-height: 80vh;
        background:
            radial-gradient(circle at 10% 12%, rgba(255, 193, 7, 0.13), transparent 28%),
            radial-gradient(circle at 88% 14%, rgba(13, 110, 253, 0.10), transparent 30%),
            radial-gradient(circle at 82% 86%, rgba(15, 118, 110, 0.12), transparent 32%),
            linear-gradient(180deg, #f5f9ff 0%, #ffffff 100%);
        padding: 90px 0;
    }

    .password-page-section::before {
        content: "";
        position: absolute;
        width: 420px;
        height: 420px;
        right: -190px;
        top: -190px;
        border-radius: 50%;
        background: rgba(255, 193, 7, 0.12);
        pointer-events: none;
    }

    .password-page-section::after {
        content: "";
        position: absolute;
        width: 360px;
        height: 360px;
        left: -170px;
        bottom: -180px;
        border-radius: 50%;
        background: rgba(13, 110, 253, 0.08);
        pointer-events: none;
    }

    .password-card {
        position: relative;
        overflow: hidden;
        border: 1px solid rgba(15, 42, 64, 0.08);
        border-radius: 34px;
        background:
            radial-gradient(circle at 90% 10%, rgba(255, 193, 7, 0.14), transparent 32%),
            linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
        box-shadow: var(--lis-shadow-strong);
    }

    .password-card::before {
        content: "";
        position: absolute;
        inset: 0 0 auto 0;
        height: 6px;
        background: linear-gradient(90deg, var(--lis-gold), var(--lis-teal), var(--lis-blue));
        z-index: 2;
    }

    .password-card::after {
        content: "";
        position: absolute;
        width: 210px;
        height: 210px;
        right: -105px;
        bottom: -105px;
        border-radius: 50%;
        background: rgba(15, 118, 110, 0.08);
        pointer-events: none;
    }

    .password-card .card-body {
        position: relative;
        z-index: 3;
        padding: 2.8rem;
    }

    .password-header {
        text-align: center;
        margin-bottom: 2.2rem;
    }

    .password-header::before {
        content: "\F4C8";
        font-family: "bootstrap-icons";
        width: 86px;
        height: 86px;
        margin: 0 auto 1.3rem;
        border-radius: 28px;
        background:
            radial-gradient(circle at 30% 25%, rgba(255, 255, 255, 0.75), transparent 28%),
            linear-gradient(135deg, var(--lis-gold-light), var(--lis-gold));
        color: var(--lis-deep);
        display: inline-flex;
        align-items: center;
        justify-content: center;
        font-size: 2.35rem;
        box-shadow:
            0 18px 38px rgba(255, 193, 7, 0.28),
            0 0 0 10px rgba(255, 193, 7, 0.10);
    }

    .password-header h2 {
        color: var(--lis-text);
        font-weight: 950;
        letter-spacing: -0.035em;
        line-height: 1.12;
        margin-bottom: 0.75rem;
    }

    .password-header p {
        color: var(--lis-muted);
        margin-bottom: 0;
        font-size: 1rem;
        line-height: 1.7;
        max-width: 560px;
        margin-left: auto;
        margin-right: auto;
    }

    .password-form p {
        margin-bottom: 1.25rem;
    }

    .password-form label {
        display: block;
        font-weight: 850;
        margin-bottom: 0.5rem;
        color: var(--lis-text);
        letter-spacing: -0.01em;
    }

    .password-form input {
        width: 100%;
        border: 1px solid rgba(15, 42, 64, 0.12);
        border-radius: 17px;
        padding: 0.92rem 1rem;
        font-size: 0.96rem;
        color: var(--lis-text);
        background:
            linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
        transition: all 0.22s ease;
        box-shadow: 0 10px 22px rgba(15, 23, 42, 0.035);
    }

    .password-form input:focus {
        outline: none;
        border-color: rgba(15, 118, 110, 0.52);
        box-shadow:
            0 0 0 0.22rem rgba(15, 118, 110, 0.11),
            0 12px 24px rgba(13, 110, 253, 0.07);
        background: #ffffff;
    }

    .password-form input::placeholder {
        color: #94a3b8;
    }

    .password-form ul {
        margin-top: 0.55rem;
        padding-left: 1.1rem;
        color: var(--lis-muted);
        font-size: 0.88rem;
        line-height: 1.6;
    }

    .password-form .errorlist {
        list-style: none;
        padding-left: 0;
        margin: 0.45rem 0 0;
        color: #b42318;
        font-size: 0.88rem;
        font-weight: 700;
    }

    .password-form .errorlist li {
        padding: 0.65rem 0.85rem;
        border-radius: 14px;
        background: rgba(180, 35, 24, 0.08);
        border: 1px solid rgba(180, 35, 24, 0.14);
    }

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

    .password-actions .btn,
    .password-actions a {
        border-radius: 999px;
        padding: 0.85rem 1.55rem;
        font-weight: 850;
        letter-spacing: 0.01em;
        transition: all 0.22s ease;
    }

    .btn-password-save {
        background: linear-gradient(135deg, var(--lis-deep), var(--lis-blue));
        color: #ffffff;
        border: none;
        box-shadow: 0 16px 32px rgba(13, 110, 253, 0.20);
    }

    .btn-password-save:hover {
        background: linear-gradient(135deg, var(--lis-deep), var(--lis-teal));
        color: #ffffff;
        transform: translateY(-2px);
        box-shadow: 0 20px 38px rgba(15, 118, 110, 0.24);
    }

    .btn-password-cancel {
        color: var(--lis-deep);
        border: 1px solid rgba(7, 19, 28, 0.20);
        background: #ffffff;
        box-shadow: 0 12px 24px rgba(15, 23, 42, 0.06);
    }

    .btn-password-cancel:hover {
        background: var(--lis-deep);
        border-color: var(--lis-deep);
        color: #ffffff;
        transform: translateY(-2px);
    }

    .password-note {
        margin-top: 1.6rem;
        padding: 1rem 1.1rem;
        border-radius: 18px;
        background:
            linear-gradient(135deg, rgba(255, 193, 7, 0.11), rgba(15, 118, 110, 0.06));
        color: #475569;
        font-size: 0.92rem;
        line-height: 1.65;
        border: 1px solid rgba(255, 193, 7, 0.18);
    }

    .password-note i {
        color: var(--lis-teal);
    }

    @media (max-width: 576px) {
        .password-page-section {
            padding: 60px 0;
            min-height: auto;
        }

        .password-card {
            border-radius: 28px;
        }

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

        .password-header::before {
            width: 76px;
            height: 76px;
            border-radius: 24px;
            font-size: 2rem;
        }

        .password-header h2 {
            font-size: 1.75rem;
        }

        .password-actions {
            flex-direction: column;
        }

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

<section class="password-page-section py-5">
    <div class="container">
        <div class="row justify-content-center align-items-center">
            <div class="col-lg-6 col-md-8">
                <div class="card password-card">
                    <div class="card-body">
                        <div class="password-header">
                            <h2>Change Password</h2>
                            <p>Update your account password to keep your profile secure.</p>
                        </div>

                        <form method="post" class="password-form">
                            {% csrf_token %}
                            {{ form.as_p }}

                            <div class="password-actions">
                                <button type="submit" class="btn btn-password-save">
                                    Update Password
                                </button>
                                <a href="{% url 'expat_life:foreigner_profile_page' %}" class="btn btn-outline-secondary btn-password-cancel">
                                    Cancel
                                </a>
                            </div>
                        </form>

                        <div class="password-note">
                            Choose a strong password with a mix of letters, numbers, and symbols for better security.
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</section>
{% endblock %}