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

{% block title %}Create Hosting Client Account | Host in Sri Lanka{% endblock %}

{% block content %}

<style>
    /* =========================================================
       LOCAL CLIENT SIGNUP — HOSTING APP THEME
    ========================================================= */

    .local-client-signup-page {
        min-height: 100vh;
        background:
            radial-gradient(circle at top left, rgba(255, 193, 7, 0.10), transparent 30%),
            radial-gradient(circle at top right, rgba(116, 49, 41, 0.10), transparent 32%),
            linear-gradient(180deg, #fffaf5 0%, #ffffff 48%, #fff7ed 100%);
        color: #2c1b17;
    }

    .local-client-signup-hero {
        position: relative;
        overflow: hidden;
        min-height: 520px;
        display: flex;
        align-items: center;
        color: #ffffff;
        background:
            linear-gradient(
                100deg,
                rgba(27, 16, 15, 0.96) 0%,
                rgba(54, 27, 24, 0.88) 44%,
                rgba(89, 44, 30, 0.58) 100%
            );
    }

    .local-client-signup-hero-bg {
        position: absolute;
        inset: 0;
        z-index: 0;
    }

    .local-client-signup-hero-bg img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

    .local-client-signup-hero-bg::after {
        content: "";
        position: absolute;
        inset: 0;
        background:
            radial-gradient(circle at 82% 18%, rgba(255, 193, 7, 0.28), transparent 28%),
            radial-gradient(circle at 12% 78%, rgba(202, 95, 58, 0.22), transparent 32%),
            linear-gradient(
                100deg,
                rgba(27, 16, 15, 0.96) 0%,
                rgba(54, 27, 24, 0.88) 44%,
                rgba(89, 44, 30, 0.62) 100%
            );
    }

    .local-client-signup-hero-placeholder {
        position: absolute;
        inset: 0;
        background:
            radial-gradient(circle at top right, rgba(255, 193, 7, 0.28), transparent 34%),
            linear-gradient(145deg, #2e1817 0%, #6d2e28 64%, #a3601b 100%);
    }

    .local-client-signup-hero::after {
        content: "";
        position: absolute;
        left: 0;
        right: 0;
        bottom: -1px;
        height: 110px;
        background: linear-gradient(180deg, transparent 0%, #fffaf5 100%);
        pointer-events: none;
        z-index: 1;
    }

    .local-client-signup-hero-inner {
        position: relative;
        z-index: 2;
        padding: 6rem 0 7rem;
    }

    .local-client-signup-kicker {
        display: inline-flex;
        align-items: center;
        gap: 0.55rem;
        padding: 0.55rem 1.05rem;
        border-radius: 999px;
        background: rgba(255, 255, 255, 0.13);
        border: 1px solid rgba(255, 255, 255, 0.20);
        color: #ffd36b;
        font-size: 0.84rem;
        font-weight: 900;
        text-transform: uppercase;
        letter-spacing: 0.055em;
        backdrop-filter: blur(10px);
        margin-bottom: 1.1rem;
    }

    .local-client-signup-hero h1 {
        max-width: 980px;
        font-size: clamp(2.25rem, 5vw, 4.65rem);
        font-weight: 950;
        line-height: 1.02;
        letter-spacing: -0.06em;
        margin-bottom: 1rem;
    }

    .local-client-signup-hero h1 span {
        color: #ffd36b;
    }

    .local-client-signup-hero p {
        max-width: 820px;
        color: rgba(255, 255, 255, 0.87);
        font-size: 1.06rem;
        line-height: 1.82;
        margin-bottom: 1.35rem;
    }

    .local-client-signup-hero-meta {
        display: flex;
        flex-wrap: wrap;
        gap: 0.65rem;
    }

    .local-client-signup-chip {
        display: inline-flex;
        align-items: center;
        gap: 0.4rem;
        padding: 0.52rem 0.85rem;
        border-radius: 999px;
        background: rgba(255, 255, 255, 0.13);
        border: 1px solid rgba(255, 255, 255, 0.20);
        color: #ffffff;
        font-size: 0.82rem;
        font-weight: 850;
        backdrop-filter: blur(10px);
    }

    .local-client-signup-chip.gold {
        background: rgba(255, 200, 63, 0.92);
        border-color: rgba(255, 200, 63, 0.96);
        color: #26160d;
    }

    .local-client-signup-section {
        padding: 5rem 0;
    }

    .local-client-card {
        border-radius: 32px;
        background: linear-gradient(145deg, #fffaf4 0%, #ffffff 100%);
        border: 1px solid rgba(124, 74, 50, 0.10);
        box-shadow: 0 18px 42px rgba(55, 31, 22, 0.07);
        overflow: hidden;
        margin-bottom: 1.5rem;
    }

    .local-client-card-header {
        padding: 1.5rem 1.6rem 1.05rem;
        border-bottom: 1px solid rgba(124, 74, 50, 0.10);
        background:
            radial-gradient(circle at top right, rgba(255, 193, 7, 0.08), transparent 30%),
            linear-gradient(145deg, #fffaf4 0%, #ffffff 100%);
    }

    .local-client-card-header h2,
    .local-client-card-header h3 {
        color: #38231d;
        font-weight: 950;
        margin-bottom: 0.35rem;
    }

    .local-client-card-header p {
        color: #78625a;
        line-height: 1.7;
        margin-bottom: 0;
    }

    .local-client-card-body {
        padding: 1.6rem;
    }

    .local-client-form-group {
        margin-bottom: 1.25rem;
    }

    .local-client-form-group label {
        display: block;
        color: #38231d;
        font-size: 0.84rem;
        font-weight: 950;
        text-transform: uppercase;
        letter-spacing: 0.045em;
        margin-bottom: 0.5rem;
    }

    .local-client-form-group input,
    .local-client-form-group select,
    .local-client-form-group textarea {
        width: 100%;
        min-height: 50px;
        border-radius: 16px;
        border: 1px solid #eadbc9;
        background: #fffaf5;
        color: #38231d;
        font-weight: 650;
        padding: 0.8rem 0.95rem;
        transition: 0.2s ease;
    }

    .local-client-form-group input:focus,
    .local-client-form-group select:focus,
    .local-client-form-group textarea:focus {
        border-color: #a75e17;
        box-shadow: 0 0 0 0.22rem rgba(167, 94, 23, 0.14);
        background: #ffffff;
        outline: none;
    }

    .local-client-field-error {
        color: #dc2626;
        font-size: 0.86rem;
        font-weight: 800;
        margin-top: 0.4rem;
    }

    .local-client-non-field-errors {
        border-radius: 22px;
        padding: 1rem 1.1rem;
        background: #fef2f2;
        border: 1px solid #fecaca;
        color: #b91c1c;
        font-weight: 700;
        margin-bottom: 1.25rem;
    }

    .local-client-btn-gold {
        background: linear-gradient(135deg, #ffc83f, #df9219);
        color: #26160d;
        border: none;
        font-weight: 950 !important;
        box-shadow: 0 18px 34px rgba(223, 146, 25, 0.30);
        transition: all 0.22s ease;
        border-radius: 999px;
        min-height: 52px;
        padding: 0.85rem 1.35rem;
    }

    .local-client-btn-gold:hover,
    .local-client-btn-gold:focus {
        background: linear-gradient(135deg, #2e1817, #6d2e28);
        color: #ffffff !important;
        transform: translateY(-2px);
        box-shadow: 0 22px 42px rgba(54, 28, 23, 0.28);
    }

    .local-client-side-card {
        border-radius: 32px;
        background: linear-gradient(145deg, #fffaf4 0%, #ffffff 100%);
        border: 1px solid rgba(124, 74, 50, 0.10);
        box-shadow: 0 18px 42px rgba(55, 31, 22, 0.07);
        overflow: hidden;
        margin-bottom: 1.4rem;
        position: sticky;
        top: 1rem;
    }

    .local-client-side-card.not-sticky {
        position: static;
    }

    .local-client-side-header {
        padding: 1.45rem 1.5rem 1rem;
        border-bottom: 1px solid rgba(124, 74, 50, 0.10);
        background:
            radial-gradient(circle at top right, rgba(255, 193, 7, 0.08), transparent 30%),
            linear-gradient(145deg, #fffaf4 0%, #ffffff 100%);
    }

    .local-client-side-header h3 {
        color: #38231d;
        font-weight: 950;
        margin-bottom: 0.25rem;
    }

    .local-client-side-header p {
        color: #78625a;
        line-height: 1.65;
        margin-bottom: 0;
    }

    .local-client-side-body {
        padding: 1.45rem;
    }

    .local-client-summary-box {
        border-radius: 28px;
        padding: 1.4rem;
        background:
            radial-gradient(circle at top right, rgba(255, 193, 7, 0.18), transparent 34%),
            linear-gradient(145deg, #2e1817 0%, #6d2e28 64%, #a3601b 100%);
        color: #ffffff;
        margin-bottom: 1rem;
    }

    .local-client-summary-box span {
        display: block;
        color: rgba(255, 255, 255, 0.72);
        font-size: 0.78rem;
        font-weight: 950;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        margin-bottom: 0.4rem;
    }

    .local-client-summary-box strong {
        display: block;
        color: #ffffff;
        font-size: 1.5rem;
        font-weight: 950;
        line-height: 1.2;
        margin-bottom: 0.7rem;
    }

    .local-client-summary-box p {
        color: rgba(255, 255, 255, 0.82);
        line-height: 1.65;
        margin-bottom: 0;
        font-size: 0.92rem;
    }

    .local-client-info-item {
        border-radius: 22px;
        padding: 1rem;
        background: #fff7e8;
        border: 1px solid #efd8b7;
        margin-bottom: 0.8rem;
    }

    .local-client-info-item span {
        display: block;
        color: #8b6550;
        font-size: 0.76rem;
        font-weight: 950;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        margin-bottom: 0.35rem;
    }

    .local-client-info-item strong {
        color: #38231d;
        font-weight: 900;
        word-break: break-word;
    }

    .local-client-process-list {
        display: grid;
        gap: 0.75rem;
        margin: 0;
        padding: 0;
        list-style: none;
    }

    .local-client-process-list li {
        display: flex;
        align-items: flex-start;
        gap: 0.65rem;
        color: #78625a;
        line-height: 1.6;
    }

    .local-client-process-list i {
        color: #a75e17;
        margin-top: 0.2rem;
        flex-shrink: 0;
    }

    .local-client-form-actions {
        display: flex;
        flex-wrap: wrap;
        gap: 0.8rem;
        margin-top: 1.35rem;
    }

    .local-client-form-actions .btn {
        border-radius: 999px;
        min-height: 52px;
        font-weight: 950;
        padding: 0.85rem 1.35rem;
    }

    @media (max-width: 991.98px) {
        .local-client-signup-hero {
            min-height: auto;
        }

        .local-client-signup-hero-inner {
            padding: 5.5rem 0 6.5rem;
        }

        .local-client-signup-section {
            padding: 4rem 0;
        }

        .local-client-side-card {
            position: static;
        }
    }

    @media (max-width: 767.98px) {
        .local-client-card-body,
        .local-client-card-header,
        .local-client-side-header,
        .local-client-side-body {
            padding-left: 1.15rem;
            padding-right: 1.15rem;
        }

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

        .local-client-form-actions .btn {
            width: 100%;
        }
    }

    @media (max-width: 575.98px) {
        .local-client-signup-hero > .container,
        .local-client-signup-section > .container {
            padding-left: 1.25rem !important;
            padding-right: 1.25rem !important;
        }
    }
</style>


<div class="local-client-signup-page">

    <!-- HERO -->
    <section class="local-client-signup-hero">

        {% if venue.cover_image %}
            <div class="local-client-signup-hero-bg">
                <img src="{{ venue.cover_image.url }}" alt="{{ venue.venue_name }}">
            </div>
        {% else %}
            <div class="local-client-signup-hero-placeholder"></div>
        {% endif %}

        <div class="container local-client-signup-hero-inner">

            <span class="local-client-signup-kicker">
                <i class="bi bi-person-plus-fill"></i>
                Create Hosting Client Account
            </span>

            <h1>
                Continue booking <span>{{ venue.venue_name }}</span>
            </h1>

            <p>
                Create a simple Hosting Client account so your booking order, payment status,
                event details, and future updates can be managed securely.
            </p>

            <div class="local-client-signup-hero-meta">
                {% if venue.is_featured %}
                    <span class="local-client-signup-chip gold">
                        <i class="bi bi-star-fill"></i>
                        Featured Venue
                    </span>
                {% endif %}

                {% if venue.venue_category %}
                    <span class="local-client-signup-chip">
                        <i class="bi bi-tag-fill"></i>
                        {{ venue.get_venue_category_display }}
                    </span>
                {% endif %}

                {% if venue.city or venue.district %}
                    <span class="local-client-signup-chip">
                        <i class="bi bi-geo-alt-fill"></i>
                        {% if venue.city %}{{ venue.city }}{% endif %}
                        {% if venue.city and venue.district %}, {% endif %}
                        {% if venue.district %}{{ venue.district }}{% endif %}
                    </span>
                {% endif %}

                {% if venue.max_guest_capacity %}
                    <span class="local-client-signup-chip">
                        <i class="bi bi-people-fill"></i>
                        Up to {{ venue.max_guest_capacity }} guests
                    </span>
                {% endif %}
            </div>

        </div>
    </section>


    <!-- SIGNUP FORM -->
    <section class="local-client-signup-section">
        <div class="container">

            <div class="row g-4 align-items-start">

                <!-- MAIN FORM -->
                <div class="col-lg-8">

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

                        {% if form.non_field_errors %}
                            <div class="local-client-non-field-errors">
                                {% for error in form.non_field_errors %}
                                    <div>{{ error }}</div>
                                {% endfor %}
                            </div>
                        {% endif %}

                        <div class="local-client-card">
                            <div class="local-client-card-header">
                                <h2>Your Contact Details</h2>
                                <p>
                                    These details help us create your Hosting Client profile and connect your booking order.
                                </p>
                            </div>

                            <div class="local-client-card-body">

                                <div class="row g-3">

                                    <div class="col-md-6">
                                        <div class="local-client-form-group">
                                            <label for="{{ form.full_name.id_for_label }}">
                                                Full Name
                                            </label>
                                            {{ form.full_name }}
                                            {% for error in form.full_name.errors %}
                                                <div class="local-client-field-error">{{ error }}</div>
                                            {% endfor %}
                                        </div>
                                    </div>

                                    <div class="col-md-6">
                                        <div class="local-client-form-group">
                                            <label for="{{ form.email.id_for_label }}">
                                                Email Address
                                            </label>
                                            {{ form.email }}
                                            {% for error in form.email.errors %}
                                                <div class="local-client-field-error">{{ error }}</div>
                                            {% endfor %}
                                        </div>
                                    </div>

                                    <div class="col-md-6">
                                        <div class="local-client-form-group">
                                            <label for="{{ form.phone_number.id_for_label }}">
                                                Phone Number
                                            </label>
                                            {{ form.phone_number }}
                                            {% for error in form.phone_number.errors %}
                                                <div class="local-client-field-error">{{ error }}</div>
                                            {% endfor %}
                                        </div>
                                    </div>

                                    <div class="col-md-6">
                                        <div class="local-client-form-group">
                                            <label for="{{ form.whatsapp_number.id_for_label }}">
                                                WhatsApp Number
                                            </label>
                                            {{ form.whatsapp_number }}
                                            {% for error in form.whatsapp_number.errors %}
                                                <div class="local-client-field-error">{{ error }}</div>
                                            {% endfor %}
                                        </div>
                                    </div>

                                    <div class="col-md-6">
                                        <div class="local-client-form-group">
                                            <label for="{{ form.country.id_for_label }}">
                                                Country
                                            </label>
                                            {{ form.country }}
                                            {% for error in form.country.errors %}
                                                <div class="local-client-field-error">{{ error }}</div>
                                            {% endfor %}
                                        </div>
                                    </div>

                                    <div class="col-md-6">
                                        <div class="local-client-form-group">
                                            <label for="{{ form.city.id_for_label }}">
                                                City
                                            </label>
                                            {{ form.city }}
                                            {% for error in form.city.errors %}
                                                <div class="local-client-field-error">{{ error }}</div>
                                            {% endfor %}
                                        </div>
                                    </div>

                                </div>

                                <div class="local-client-form-actions">
                                    <button type="submit" class="btn local-client-btn-gold">
                                        <i class="bi bi-person-check-fill me-2"></i>
                                        Create Account & Continue Booking
                                    </button>

                                    <a href="{% url 'hosting_app:public_host_venue_detail' venue.slug %}"
                                       class="btn btn-outline-secondary">
                                        <i class="bi bi-arrow-left-circle me-2"></i>
                                        Back to Venue
                                    </a>
                                </div>

                            </div>
                        </div>

                    </form>

                </div>


                <!-- SIDEBAR -->
                <div class="col-lg-4">

                    <div class="local-client-side-card">
                        <div class="local-client-side-header">
                            <h3>Why create an account?</h3>
                            <p>
                                Your booking order needs a secure client profile for payment and future coordination.
                            </p>
                        </div>

                        <div class="local-client-side-body">
                            <div class="local-client-summary-box">
                                <span>Next Step</span>
                                <strong>Booking Form</strong>
                                <p>
                                    After creating your account, you will continue to the booking form for this venue.
                                </p>
                            </div>

                            <div class="local-client-info-item">
                                <span>Selected Venue</span>
                                <strong>{{ venue.venue_name }}</strong>
                            </div>

                            <div class="local-client-info-item">
                                <span>Location</span>
                                <strong>
                                    {% if venue.city %}{{ venue.city }}{% endif %}
                                    {% if venue.city and venue.district %}, {% endif %}
                                    {% if venue.district %}{{ venue.district }}{% endif %}
                                </strong>
                            </div>

                            {% if venue.max_guest_capacity %}
                                <div class="local-client-info-item">
                                    <span>Capacity</span>
                                    <strong>Up to {{ venue.max_guest_capacity }} guests</strong>
                                </div>
                            {% endif %}

                            <div class="d-grid gap-2 mt-3">
                                <a href="{% url 'hosting_app:public_host_venue_detail' venue.slug %}"
                                   class="btn btn-outline-dark rounded-pill fw-bold">
                                    <i class="bi bi-building-heart me-2"></i>
                                    Venue Details
                                </a>

                                <a href="{% url 'hosting_app:public_host_venue_list' %}"
                                   class="btn btn-outline-secondary rounded-pill fw-bold">
                                    <i class="bi bi-search-heart me-2"></i>
                                    Browse Other Venues
                                </a>
                            </div>
                        </div>
                    </div>


                    <div class="local-client-side-card not-sticky">
                        <div class="local-client-side-header">
                            <h3>How It Works</h3>
                            <p>
                                A simple path from signup to booking.
                            </p>
                        </div>

                        <div class="local-client-side-body">
                            <ul class="local-client-process-list">
                                <li>
                                    <i class="bi bi-1-circle-fill"></i>
                                    <span>Create your Hosting Client account with basic contact details.</span>
                                </li>
                                <li>
                                    <i class="bi bi-2-circle-fill"></i>
                                    <span>Select your event type, date, package, meal plan, and add-ons.</span>
                                </li>
                                <li>
                                    <i class="bi bi-3-circle-fill"></i>
                                    <span>Review the total amount and continue to the Payment Center.</span>
                                </li>
                                <li>
                                    <i class="bi bi-4-circle-fill"></i>
                                    <span>After payment, the booking becomes confirmed for coordination.</span>
                                </li>
                            </ul>
                        </div>
                    </div>

                </div>

            </div>

        </div>
    </section>

</div>

{% endblock %}