{% extends 'hosting_app/base_hosting.html' %}

{% block title %}Set New Client Password | Host in Sri Lanka{% endblock %}

{% block content %}

<style>
    /* =========================================================
       HOSTING CLIENT PASSWORD RESET CONFIRM — PREMIUM
    ========================================================= */

    .hosting-client-confirm-page {
        position: relative;
        min-height: 100vh;
        padding: 6rem 0;
        background:
            radial-gradient(circle at top left, rgba(255, 193, 7, 0.20), transparent 34%),
            radial-gradient(circle at bottom right, rgba(138, 57, 45, 0.20), transparent 32%),
            linear-gradient(135deg, #2d1716 0%, #743129 52%, #a7601b 100%);
        color: #ffffff;
        overflow: hidden;
    }

    .hosting-client-confirm-page::before {
        content: "";
        position: absolute;
        inset: 0;
        background:
            linear-gradient(120deg, rgba(255, 255, 255, 0.08), transparent 35%),
            radial-gradient(circle at 80% 10%, rgba(255, 255, 255, 0.10), transparent 28%);
        pointer-events: none;
    }

    .hosting-client-confirm-page::after {
        content: "";
        position: absolute;
        right: -160px;
        bottom: -180px;
        width: 480px;
        height: 480px;
        border-radius: 50%;
        background: rgba(255, 255, 255, 0.08);
        pointer-events: none;
    }

    .hosting-client-confirm-page .container {
        position: relative;
        z-index: 2;
    }

    .hosting-client-confirm-hero {
        max-width: 600px;
    }

    .hosting-client-confirm-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.24);
        color: #ffe7aa;
        font-size: 0.82rem;
        font-weight: 900;
        text-transform: uppercase;
        letter-spacing: 0.06em;
        margin-bottom: 1.1rem;
    }

    .hosting-client-confirm-hero h1 {
        color: #ffffff;
        font-size: clamp(2.35rem, 4.2vw, 4.1rem);
        font-weight: 950;
        letter-spacing: -0.045em;
        line-height: 1.06;
        margin-bottom: 1rem;
    }

    .hosting-client-confirm-hero p {
        color: rgba(255, 255, 255, 0.86);
        font-size: 1.08rem;
        line-height: 1.8;
        margin-bottom: 0;
    }

    .hosting-client-password-rules {
        margin-top: 1.5rem;
        display: grid;
        gap: 0.8rem;
    }

    .hosting-client-password-rule {
        display: flex;
        align-items: flex-start;
        gap: 0.75rem;
        color: rgba(255, 255, 255, 0.92);
        font-weight: 650;
        line-height: 1.55;
    }

    .hosting-client-password-rule i {
        color: #ffe7aa;
        font-size: 1.15rem;
        margin-top: 0.15rem;
    }

    .hosting-client-confirm-card {
        background: rgba(255, 255, 255, 0.98);
        border-radius: 34px;
        box-shadow: 0 28px 70px rgba(0, 0, 0, 0.24);
        overflow: hidden;
        border: 1px solid rgba(255, 255, 255, 0.35);
    }

    .hosting-client-confirm-card-header {
        background:
            radial-gradient(circle at top right, rgba(255, 193, 7, 0.12), transparent 28%),
            linear-gradient(135deg, #ffffff 0%, #fff4e4 100%);
        padding: 1.8rem 2rem;
        color: #2f1d18;
        text-align: center;
        border-bottom: 1px solid #efe2d3;
    }

    .hosting-client-confirm-card-header-icon {
        width: 74px;
        height: 74px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border-radius: 26px;
        background:
            radial-gradient(circle at top right, rgba(255, 193, 7, 0.22), transparent 35%),
            linear-gradient(135deg, #fff4e4, #ffe7aa);
        color: #a7601b;
        font-size: 2rem;
        box-shadow: 0 14px 28px rgba(167, 96, 27, 0.14);
        margin-bottom: 1rem;
    }

    .hosting-client-confirm-card-header h3 {
        margin: 0;
        font-weight: 950;
        color: #2f1d18;
        letter-spacing: -0.025em;
    }

    .hosting-client-confirm-card-header p {
        color: #7a655d;
        font-size: 0.94rem;
        line-height: 1.65;
        margin-top: 0.5rem;
        margin-bottom: 0;
    }

    .hosting-client-confirm-card-body {
        padding: 2rem;
    }

    .hosting-client-form-group {
        margin-bottom: 1.2rem;
    }

    .hosting-client-form-group label {
        display: block;
        color: #2f1d18;
        font-size: 0.82rem;
        font-weight: 950;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        margin-bottom: 0.5rem;
    }

    .hosting-client-form-group input {
        width: 100%;
        min-height: 52px;
        border-radius: 18px;
        border: 1px solid #eadbc9;
        padding: 0.85rem 1rem;
        box-shadow: none;
        color: #2f1d18;
        background: #fffaf5;
        font-weight: 650;
        transition: all 0.2s ease;
    }

    .hosting-client-form-group input:focus {
        border-color: #a7601b;
        box-shadow: 0 0 0 0.22rem rgba(167, 96, 27, 0.14);
        background: #ffffff;
        outline: none;
    }

    .hosting-client-field-error {
        color: #dc2626;
        font-size: 0.84rem;
        font-weight: 800;
        margin-top: 0.45rem;
    }

    .hosting-client-help-text {
        margin-top: 0.5rem;
        color: #7a655d;
        font-size: 0.86rem;
        line-height: 1.55;
    }

    .hosting-client-confirm-submit-btn {
        width: 100%;
        min-height: 54px;
        border: none;
        border-radius: 999px;
        background: linear-gradient(135deg, #321816, #a7601b);
        color: #ffffff;
        font-weight: 950;
        box-shadow: 0 16px 32px rgba(167, 96, 27, 0.24);
        transition: all 0.2s ease;
    }

    .hosting-client-confirm-submit-btn:hover {
        background: linear-gradient(135deg, #ffc107, #df9219);
        color: #2d1716;
        transform: translateY(-2px);
    }

    .hosting-client-confirm-note {
        margin-top: 1.25rem;
        padding: 1rem 1.1rem;
        border-radius: 22px;
        background: #fff4e4;
        border: 1px solid #efd7ae;
        color: #8a5418;
        line-height: 1.65;
        font-size: 0.92rem;
    }

    .hosting-client-confirm-note strong {
        color: #2d1716;
    }

    .hosting-client-invalid-card {
        max-width: 780px;
        margin: 0 auto;
        background: rgba(255, 255, 255, 0.98);
        border-radius: 34px;
        box-shadow: 0 28px 70px rgba(0, 0, 0, 0.24);
        overflow: hidden;
        border: 1px solid rgba(255, 255, 255, 0.35);
        text-align: center;
    }

    .hosting-client-invalid-card-inner {
        padding: 3rem 2.3rem;
    }

    .hosting-client-invalid-icon {
        width: 104px;
        height: 104px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border-radius: 38px;
        background: #fffbeb;
        color: #b45309;
        font-size: 2.9rem;
        box-shadow: 0 18px 36px rgba(167, 96, 27, 0.14);
        margin-bottom: 1.35rem;
    }

    .hosting-client-invalid-card h1 {
        color: #2f1d18;
        font-size: clamp(2rem, 4vw, 3.05rem);
        font-weight: 950;
        letter-spacing: -0.04em;
        margin-bottom: 1rem;
    }

    .hosting-client-invalid-card p {
        color: #6b564d;
        font-size: 1.02rem;
        line-height: 1.75;
        max-width: 620px;
        margin-left: auto;
        margin-right: auto;
    }

    .hosting-client-actions {
        display: flex;
        justify-content: center;
        flex-wrap: wrap;
        gap: 0.85rem;
        margin-top: 2rem;
    }

    .hosting-client-actions a {
        min-height: 52px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border-radius: 999px;
        padding: 0.9rem 1.5rem;
        font-weight: 900;
        text-decoration: none;
        transition: all 0.2s ease;
    }

    .hosting-client-btn-warning {
        background: linear-gradient(135deg, #ffc107, #df9219);
        color: #2d1716;
        border: none;
        box-shadow: 0 16px 32px rgba(223, 146, 25, 0.22);
    }

    .hosting-client-btn-warning:hover {
        color: #2d1716;
        background: linear-gradient(135deg, #ffe082, #ffc107);
        transform: translateY(-2px);
    }

    .hosting-client-btn-outline {
        border: 2px solid #a7601b;
        color: #a7601b;
        background: #ffffff;
    }

    .hosting-client-btn-outline:hover {
        background: #a7601b;
        color: #ffffff;
        transform: translateY(-2px);
    }

    @media (max-width: 991.98px) {
        .hosting-client-confirm-hero {
            max-width: 100%;
            text-align: center;
            margin-bottom: 2rem;
        }

        .hosting-client-password-rule {
            justify-content: center;
            text-align: left;
        }
    }

    @media (max-width: 768px) {
        .hosting-client-confirm-page {
            padding: 4rem 0;
        }

        .hosting-client-confirm-card,
        .hosting-client-invalid-card {
            border-radius: 28px;
        }

        .hosting-client-confirm-card-header,
        .hosting-client-confirm-card-body,
        .hosting-client-invalid-card-inner {
            padding-left: 1.35rem;
            padding-right: 1.35rem;
        }

        .hosting-client-actions {
            flex-direction: column;
            align-items: stretch;
        }

        .hosting-client-actions a {
            width: 100%;
        }
    }

    @media (max-width: 575.98px) {
        .hosting-client-confirm-page .container {
            padding-left: 1.25rem !important;
            padding-right: 1.25rem !important;
        }
    }
</style>


<section class="hosting-client-confirm-page">
    <div class="container">

        {% if validlink %}

            <div class="row g-5 align-items-center">

                <div class="col-lg-6">
                    <div class="hosting-client-confirm-hero">
                        <span class="hosting-client-confirm-kicker">
                            <i class="bi bi-shield-lock-fill"></i>
                            Hosting Client Security
                        </span>

                        <h1>Choose your new password</h1>

                        <p>
                            Create a secure new password for your Hosting Client account.
                            After saving it, you can log in again and continue managing your bookings,
                            payments, and hosted experiences.
                        </p>

                        <div class="hosting-client-password-rules">
                            <div class="hosting-client-password-rule">
                                <i class="bi bi-check-circle-fill"></i>
                                <span>Use a password that is unique to this account.</span>
                            </div>

                            <div class="hosting-client-password-rule">
                                <i class="bi bi-check-circle-fill"></i>
                                <span>Use a mix of letters, numbers, and special characters where possible.</span>
                            </div>

                            <div class="hosting-client-password-rule">
                                <i class="bi bi-check-circle-fill"></i>
                                <span>Do not share your password with anyone.</span>
                            </div>
                        </div>
                    </div>
                </div>

                <div class="col-lg-6">
                    <div class="hosting-client-confirm-card">

                        <div class="hosting-client-confirm-card-header">
                            <div class="hosting-client-confirm-card-header-icon">
                                <i class="bi bi-key-fill"></i>
                            </div>

                            <h3>Set New Password</h3>

                            <p>
                                Enter and confirm your new password below.
                            </p>
                        </div>

                        <div class="hosting-client-confirm-card-body">

                            <form method="post">
                                {% csrf_token %}

                                <div class="hosting-client-form-group">
                                    <label for="{{ form.new_password1.id_for_label }}">
                                        New Password
                                    </label>

                                    {{ form.new_password1 }}

                                    {% if form.new_password1.help_text %}
                                        <div class="hosting-client-help-text">
                                            {{ form.new_password1.help_text|safe }}
                                        </div>
                                    {% endif %}

                                    {% for error in form.new_password1.errors %}
                                        <div class="hosting-client-field-error">
                                            {{ error }}
                                        </div>
                                    {% endfor %}
                                </div>

                                <div class="hosting-client-form-group">
                                    <label for="{{ form.new_password2.id_for_label }}">
                                        Confirm New Password
                                    </label>

                                    {{ form.new_password2 }}

                                    {% if form.new_password2.help_text %}
                                        <div class="hosting-client-help-text">
                                            {{ form.new_password2.help_text|safe }}
                                        </div>
                                    {% endif %}

                                    {% for error in form.new_password2.errors %}
                                        <div class="hosting-client-field-error">
                                            {{ error }}
                                        </div>
                                    {% endfor %}
                                </div>

                                <button type="submit" class="btn hosting-client-confirm-submit-btn">
                                    <i class="bi bi-check-circle-fill me-2"></i>
                                    Change Password
                                </button>

                                <div class="hosting-client-confirm-note">
                                    <strong>Security note:</strong><br>
                                    After changing your password, you will be able to sign in using your new password.
                                </div>
                            </form>

                        </div>
                    </div>
                </div>

            </div>

        {% else %}

            <div class="hosting-client-invalid-card">
                <div class="hosting-client-invalid-card-inner">

                    <div class="hosting-client-invalid-icon">
                        <i class="bi bi-exclamation-triangle-fill"></i>
                    </div>

                    <h1>Invalid reset link</h1>

                    <p>
                        This password reset link is invalid, expired, or has already been used.
                        Please request a new password reset link to continue.
                    </p>

                    <div class="hosting-client-confirm-note text-start">
                        <strong>Why this may happen:</strong><br>
                        The link may have expired, the password may already have been reset,
                        or the reset link may have been copied incorrectly.
                    </div>

                    <div class="hosting-client-actions">
                        <a href="{% url 'hosting_app:hosting_client_password_reset' %}"
                           class="hosting-client-btn-warning">
                            <i class="bi bi-arrow-repeat me-2"></i>
                            Request New Reset Link
                        </a>

                        <a href="{% url 'hosting_app:hosting_client_login' %}"
                           class="hosting-client-btn-outline">
                            <i class="bi bi-box-arrow-in-right me-2"></i>
                            Back to Client Login
                        </a>
                    </div>

                </div>
            </div>

        {% endif %}

    </div>
</section>

{% endblock %}