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

{% block title %}Edit Hosting Client Profile{% endblock %}

{% block content %}

<style>
    /* =========================================================
       HOSTING CLIENT EDIT PROFILE — PREMIUM
    ========================================================= */

    .hosting-edit-profile-page {
        min-height: 100vh;
        padding: 4rem 0 5rem;
        background:
            radial-gradient(circle at top left, rgba(255, 193, 7, 0.11), transparent 28%),
            radial-gradient(circle at top right, rgba(138, 57, 45, 0.10), transparent 32%),
            linear-gradient(180deg, #fffaf5 0%, #fff4e8 44%, #ffffff 100%);
    }

    .hosting-edit-hero {
        position: relative;
        overflow: hidden;
        border-radius: 38px;
        padding: 2.6rem 2.4rem;
        margin-bottom: 2rem;
        color: #ffffff;
        background:
            radial-gradient(circle at top right, rgba(255, 211, 107, 0.20), transparent 32%),
            linear-gradient(135deg, #2d1716 0%, #743129 56%, #a7601b 100%);
        box-shadow: 0 30px 68px rgba(58, 30, 24, 0.20);
    }

    .hosting-edit-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;
    }

    .hosting-edit-hero::after {
        content: "";
        position: absolute;
        bottom: -150px;
        left: -110px;
        width: 360px;
        height: 360px;
        border-radius: 50%;
        background: rgba(255, 193, 7, 0.10);
        pointer-events: none;
    }

    .hosting-edit-hero-inner {
        position: relative;
        z-index: 2;
    }

    .hosting-edit-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: #ffe7aa;
        font-size: 0.84rem;
        font-weight: 900;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        margin-bottom: 1rem;
    }

    .hosting-edit-hero h1 {
        font-size: clamp(2.15rem, 4vw, 3.45rem);
        font-weight: 950;
        line-height: 1.12;
        letter-spacing: -0.045em;
        margin-bottom: 0.8rem;
    }

    .hosting-edit-hero p {
        max-width: 860px;
        margin-bottom: 0;
        color: rgba(255, 255, 255, 0.88);
        font-size: 1.04rem;
        line-height: 1.8;
    }

    .hosting-edit-shell {
        border-radius: 36px;
        background: rgba(255, 255, 255, 0.98);
        border: 1px solid rgba(239, 226, 211, 0.95);
        box-shadow: 0 24px 56px rgba(58, 30, 24, 0.10);
        overflow: hidden;
    }

    .hosting-edit-card-header {
        padding: 1.7rem 1.8rem 1.25rem;
        border-bottom: 1px solid #efe2d3;
        background:
            radial-gradient(circle at top right, rgba(183, 106, 31, 0.06), transparent 28%),
            linear-gradient(180deg, #ffffff 0%, #fffaf5 100%);
    }

    .hosting-edit-card-header h2 {
        color: #2f1d18;
        font-weight: 950;
        margin-bottom: 0.4rem;
    }

    .hosting-edit-card-header p {
        color: #7a655d;
        line-height: 1.7;
        margin-bottom: 0;
    }

    .hosting-edit-card-body {
        padding: 1.8rem;
    }

    .hosting-edit-form-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 1.25rem;
    }

    .hosting-edit-field.full-width {
        grid-column: 1 / -1;
    }

    .hosting-edit-field .form-label {
        display: block;
        color: #2f1d18;
        font-weight: 850;
        margin-bottom: 0.55rem;
    }

    .hosting-edit-field input,
    .hosting-edit-field select,
    .hosting-edit-field textarea {
        width: 100%;
        border-radius: 16px;
        border: 1px solid #eadbc9;
        padding: 0.84rem 1rem;
        background: #fffaf5;
        color: #2f1d18;
        transition: all 0.22s ease;
    }

    .hosting-edit-field textarea {
        min-height: 135px;
        resize: vertical;
    }

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

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

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

    .hosting-edit-actions .btn {
        border-radius: 999px;
        font-weight: 850;
        min-height: 52px;
        padding-left: 1.35rem;
        padding-right: 1.35rem;
    }

    .hosting-edit-save-btn {
        color: #fff;
        border: none;
        background: linear-gradient(135deg, #321816, #a7601b);
    }

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

    .hosting-edit-note {
        margin-top: 1.6rem;
        border-radius: 22px;
        padding: 1rem 1.1rem;
        background: #fff4e4;
        border: 1px solid #efd7ae;
        color: #8a5418;
        line-height: 1.7;
    }

    .hosting-edit-non-field-error {
        margin-top: 1.4rem;
        border-radius: 20px;
    }

    @media (max-width: 991.98px) {
        .hosting-edit-profile-page {
            padding-top: 2.8rem;
        }

        .hosting-edit-hero {
            padding: 2rem 1.45rem;
            border-radius: 30px;
        }

        .hosting-edit-card-header,
        .hosting-edit-card-body {
            padding-left: 1.35rem;
            padding-right: 1.35rem;
        }

        .hosting-edit-form-grid {
            grid-template-columns: 1fr;
        }
    }

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

        .hosting-edit-actions .btn {
            width: 100%;
        }
    }
</style>


<section class="hosting-edit-profile-page">
    <div class="container">

        <!-- =====================================================
             HERO
        ====================================================== -->
        <div class="hosting-edit-hero">
            <div class="hosting-edit-hero-inner">
                <span class="hosting-edit-kicker">
                    <i class="bi bi-pencil-square"></i>
                    Hosting Client Profile
                </span>

                <h1>Edit Hosting Client Profile</h1>

                <p>
                    Update your personal identity, contact details, country, and city
                    so your Host in Sri Lanka client account remains accurate, professional,
                    and ready for future hosting requests, quotations, and event arrangements.
                </p>
            </div>
        </div>


        <!-- =====================================================
             FORM CARD
        ====================================================== -->
        <div class="row justify-content-center">
            <div class="col-xl-10">
                <div class="hosting-edit-shell">

                    <div class="hosting-edit-card-header">
                        <h2>Client Profile Information</h2>
                        <p>
                            Keep your Hosting Client details up to date. These details help Ensolanka
                            manage your account, coordinate communications, and support your future hosting
                            inquiries, bookings, and event-related arrangements.
                        </p>
                    </div>

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

                            <div class="hosting-edit-form-grid">
                                {% for field in form %}
                                    <div class="hosting-edit-field
                                        {% if field.name == 'admin_note' %}
                                            full-width
                                        {% endif %}
                                    ">
                                        <label class="form-label" for="{{ field.id_for_label }}">
                                            {{ field.label }}
                                        </label>

                                        {{ field }}

                                        {% if field.help_text %}
                                            <div class="form-text">
                                                {{ field.help_text }}
                                            </div>
                                        {% endif %}

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

                            <div class="hosting-edit-note">
                                Updating your full name and email will also keep the linked user account
                                synchronized where applicable.
                            </div>

                            <div class="hosting-edit-actions">
                                <button type="submit"
                                        class="btn hosting-edit-save-btn">
                                    <i class="bi bi-save-fill me-2"></i>
                                    Save Changes
                                </button>

                                <a href="{% url 'hosting_app:hosting_client_profile_page' %}"
                                   class="btn btn-outline-secondary">
                                    <i class="bi bi-arrow-left-circle me-2"></i>
                                    Cancel
                                </a>
                            </div>

                            {% if form.non_field_errors %}
                                <div class="alert alert-danger hosting-edit-non-field-error mb-0">
                                    {% for error in form.non_field_errors %}
                                        <div>{{ error }}</div>
                                    {% endfor %}
                                </div>
                            {% endif %}
                        </form>
                    </div>

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

    </div>
</section>

{% endblock %}