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

{% block title %}Browse Host Venues | Event Experiences in Sri Lanka{% endblock %}

{% block content %}

<style>
    /* =========================================================
       GUEST HOST VENUE LIST — HOSTING THEME
    ========================================================= */

    .guest-host-list-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;
    }

    .guest-host-list-hero {
        position: relative;
        overflow: hidden;
        min-height: 520px;
        display: flex;
        align-items: center;
        color: #ffffff;
        background:
            linear-gradient(
                100deg,
                rgba(27, 16, 15, 0.94) 0%,
                rgba(54, 27, 24, 0.88) 44%,
                rgba(89, 44, 30, 0.60) 100%
            ),
            url("{% static 'expat_life/images/hosting_hero.webp' %}") center center / cover no-repeat;
    }

    .guest-host-list-hero::before {
        content: "";
        position: absolute;
        inset: 0;
        background:
            radial-gradient(circle at 82% 18%, rgba(255, 193, 7, 0.34), transparent 28%),
            radial-gradient(circle at 12% 78%, rgba(202, 95, 58, 0.28), transparent 32%);
        pointer-events: none;
    }

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

    .guest-host-list-hero-inner {
        position: relative;
        z-index: 2;
        padding: 6rem 0 7rem;
    }

    .guest-host-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;
    }

    .guest-host-list-hero h1 {
        max-width: 900px;
        font-size: clamp(2.35rem, 5vw, 4.8rem);
        font-weight: 950;
        line-height: 1.02;
        letter-spacing: -0.06em;
        margin-bottom: 1rem;
    }

    .guest-host-list-hero h1 span {
        color: #ffd36b;
    }

    .guest-host-list-hero p {
        max-width: 760px;
        color: rgba(255, 255, 255, 0.87);
        font-size: 1.06rem;
        line-height: 1.82;
        margin-bottom: 1.6rem;
    }

    .guest-host-hero-actions {
        display: flex;
        flex-wrap: wrap;
        gap: 0.9rem;
    }

    .guest-host-hero-actions .btn {
        min-height: 52px;
        border-radius: 18px;
        padding: 0.85rem 1.45rem;
        font-weight: 900;
    }

    .guest-host-btn-gold {
        background: linear-gradient(135deg, #ffc83f, #df9219);
        color: #26160d;
        border: none;
        box-shadow: 0 18px 34px rgba(223, 146, 25, 0.30);
    }

    .guest-host-btn-gold:hover {
        background: linear-gradient(135deg, #ffd45f, #ec9f21);
        color: #26160d;
        transform: translateY(-2px);
    }

    .guest-host-btn-glass {
        background: rgba(255, 255, 255, 0.10);
        color: #ffffff;
        border: 1px solid rgba(255, 255, 255, 0.34);
        backdrop-filter: blur(10px);
    }

    .guest-host-btn-glass:hover {
        background: rgba(255, 255, 255, 0.17);
        color: #ffffff;
    }

    .guest-host-section {
        padding: 5rem 0;
    }

    .guest-host-filter-card {
        position: relative;
        z-index: 5;
        margin-top: -3.8rem;
        border-radius: 34px;
        background:
            radial-gradient(circle at top right, rgba(255, 193, 7, 0.08), transparent 30%),
            linear-gradient(145deg, #fffaf4 0%, #ffffff 100%);
        border: 1px solid rgba(124, 74, 50, 0.12);
        box-shadow: 0 28px 66px rgba(55, 31, 22, 0.13);
        padding: 1.5rem;
    }

    .guest-host-filter-title {
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        gap: 1rem;
        flex-wrap: wrap;
        margin-bottom: 1.2rem;
    }

    .guest-host-filter-title h2 {
        color: #38231d;
        font-size: 1.45rem;
        font-weight: 950;
        margin-bottom: 0.25rem;
    }

    .guest-host-filter-title p {
        color: #78625a;
        margin-bottom: 0;
        line-height: 1.65;
    }

    .guest-host-form-label {
        color: #38231d;
        font-size: 0.82rem;
        font-weight: 900;
        text-transform: uppercase;
        letter-spacing: 0.045em;
        margin-bottom: 0.45rem;
    }

    .guest-host-filter-card .form-control,
    .guest-host-filter-card .form-select {
        min-height: 50px;
        border-radius: 16px;
        border: 1px solid #eadbc9;
        background: #fffaf5;
        color: #38231d;
        font-weight: 650;
    }

    .guest-host-filter-card .form-control:focus,
    .guest-host-filter-card .form-select:focus {
        border-color: #a75e17;
        box-shadow: 0 0 0 0.22rem rgba(167, 94, 23, 0.14);
        background: #ffffff;
    }

    .guest-host-section-mini {
        display: inline-flex;
        align-items: center;
        gap: 0.45rem;
        padding: 8px 15px;
        border-radius: 999px;
        background: rgba(184, 111, 31, 0.12);
        border: 1px solid rgba(184, 111, 31, 0.18);
        color: #975816;
        font-size: 0.82rem;
        font-weight: 950;
        text-transform: uppercase;
        letter-spacing: 0.06em;
        margin-bottom: 0.8rem;
    }

    .guest-host-section-title {
        color: #2c1b17;
        font-size: clamp(2rem, 4vw, 3.25rem);
        font-weight: 950;
        line-height: 1.08;
        letter-spacing: -0.05em;
        margin-bottom: 0.9rem;
    }

    .guest-host-section-text {
        color: #78625a;
        font-size: 1rem;
        line-height: 1.85;
        max-width: 830px;
    }

    .guest-host-result-meta {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 1rem;
        flex-wrap: wrap;
        margin-bottom: 1.5rem;
    }

    .guest-host-result-count {
        color: #6f4f3f;
        font-weight: 850;
    }

    .guest-host-venue-card {
        height: 100%;
        border-radius: 30px;
        overflow: hidden;
        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);
        transition: 0.25s ease;
    }

    .guest-host-venue-card:hover {
        transform: translateY(-5px);
        box-shadow: 0 28px 60px rgba(55, 31, 22, 0.13);
    }

    .guest-host-venue-img {
        position: relative;
        height: 245px;
        background: #ffe8bf;
        overflow: hidden;
    }

    .guest-host-venue-img img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        transition: 0.35s ease;
    }

    .guest-host-venue-card:hover .guest-host-venue-img img {
        transform: scale(1.05);
    }

    .guest-host-venue-placeholder {
        width: 100%;
        height: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
        background:
            radial-gradient(circle at top right, rgba(255, 193, 7, 0.18), transparent 34%),
            linear-gradient(135deg, #fffaf4, #ffe8bf);
        color: #a75e17;
        font-size: 3rem;
    }

    .guest-host-badges {
        position: absolute;
        top: 1rem;
        left: 1rem;
        right: 1rem;
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        gap: 0.55rem;
        flex-wrap: wrap;
    }

    .guest-host-badge {
        display: inline-flex;
        align-items: center;
        gap: 0.35rem;
        border-radius: 999px;
        padding: 0.42rem 0.75rem;
        background: rgba(255, 255, 255, 0.92);
        color: #2c1b17;
        font-size: 0.72rem;
        font-weight: 950;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        backdrop-filter: blur(10px);
    }

    .guest-host-badge.gold {
        background: rgba(255, 200, 63, 0.95);
        color: #26160d;
    }

    .guest-host-venue-body {
        padding: 1.35rem;
    }

    .guest-host-venue-category {
        color: #975816;
        font-size: 0.78rem;
        font-weight: 950;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        margin-bottom: 0.45rem;
    }

    .guest-host-venue-body h3 {
        color: #38231d;
        font-weight: 950;
        line-height: 1.3;
        font-size: 1.18rem;
        margin-bottom: 0.55rem;
    }

    .guest-host-venue-location {
        color: #78625a;
        display: flex;
        align-items: flex-start;
        gap: 0.4rem;
        font-size: 0.92rem;
        line-height: 1.5;
        margin-bottom: 0.85rem;
    }

    .guest-host-venue-location i {
        color: #a75e17;
        margin-top: 0.15rem;
    }

    .guest-host-venue-desc {
        color: #78625a;
        line-height: 1.7;
        font-size: 0.93rem;
        margin-bottom: 1rem;
    }

    .guest-host-chip-row {
        display: flex;
        flex-wrap: wrap;
        gap: 0.45rem;
        margin-bottom: 1rem;
    }

    .guest-host-chip {
        display: inline-flex;
        align-items: center;
        gap: 0.3rem;
        border-radius: 999px;
        padding: 0.38rem 0.62rem;
        background: #fff7e8;
        border: 1px solid #efd8b7;
        color: #6f4f3f;
        font-size: 0.75rem;
        font-weight: 800;
    }

    .guest-host-venue-footer {
        display: grid;
        grid-template-columns: 1fr;
        gap: 0.65rem;
    }

    .guest-host-venue-footer .btn {
        border-radius: 999px;
        min-height: 44px;
        font-weight: 850;
    }

    .guest-host-empty {
        border-radius: 34px;
        padding: 4rem 1.5rem;
        text-align: center;
        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);
    }

    .guest-host-empty-icon {
        width: 92px;
        height: 92px;
        border-radius: 32px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        background: #fff0d6;
        color: #a75e17;
        font-size: 2.6rem;
        margin-bottom: 1.2rem;
    }

    .guest-host-empty h3 {
        color: #38231d;
        font-weight: 950;
        margin-bottom: 0.65rem;
    }

    .guest-host-empty p {
        color: #78625a;
        max-width: 700px;
        margin: 0 auto 1.4rem;
        line-height: 1.75;
    }

    .guest-host-cta {
        border-radius: 36px;
        padding: 2.6rem 2.2rem;
        color: #ffffff;
        background:
            radial-gradient(circle at top right, rgba(255, 193, 7, 0.22), transparent 35%),
            linear-gradient(145deg, #2e1817 0%, #6d2e28 64%, #a3601b 100%);
        box-shadow: 0 30px 70px rgba(53, 27, 22, 0.20);
    }

    .guest-host-cta h2 {
        font-size: clamp(1.9rem, 4vw, 3.1rem);
        font-weight: 950;
        letter-spacing: -0.05em;
        line-height: 1.08;
        margin-bottom: 0.9rem;
    }

    .guest-host-cta p {
        max-width: 820px;
        color: rgba(255, 255, 255, 0.84);
        line-height: 1.8;
        margin-bottom: 1.5rem;
    }

    @media (max-width: 991.98px) {
        .guest-host-list-hero {
            min-height: auto;
        }

        .guest-host-list-hero-inner {
            padding: 5.5rem 0 6.5rem;
        }

        .guest-host-section {
            padding: 4rem 0;
        }
    }

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

        .guest-host-hero-actions .btn {
            width: 100%;
        }

        .guest-host-filter-card {
            margin-top: -2.6rem;
            padding: 1.15rem;
            border-radius: 28px;
        }

        .guest-host-cta {
            padding: 2rem 1.35rem;
            border-radius: 30px;
        }
    }

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


<div class="guest-host-list-page">

    <!-- =====================================================
         HERO
    ====================================================== -->
    <section class="guest-host-list-hero">
        <div class="container guest-host-list-hero-inner">

            <span class="guest-host-kicker">
                <i class="bi bi-building-heart"></i>
                Browse Host Venues
            </span>

            <h1>
                Find beautiful places for <span>romantic moments and celebrations.</span>
            </h1>

            <p>
                Explore public host venues in Sri Lanka for romantic dinners, proposals,
                birthday parties, anniversaries, honeymoon moments, private dining,
                engagement events, and custom celebrations.
            </p>

            <div class="guest-host-hero-actions">
                <a href="#venues"
                   class="btn guest-host-btn-gold">
                    <i class="bi bi-search-heart-fill me-2"></i>
                    View Venues
                </a>

                <a href="{% url 'expat_life:host_experiences_home' %}"
                   class="btn guest-host-btn-glass">
                    <i class="bi bi-arrow-left-circle me-2"></i>
                    Experiences Home
                </a>
            </div>

        </div>
    </section>


    <!-- =====================================================
         FILTERS
    ====================================================== -->
    <section class="pb-4">
        <div class="container">
            <div class="guest-host-filter-card">

                <div class="guest-host-filter-title">
                    <div>
                        <h2>Search & Filter Venues</h2>
                        <p>
                            Find a venue by location, category, event type, or keyword.
                        </p>
                    </div>

                    <a href="{% url 'expat_life:guest_host_venue_list' %}"
                       class="btn btn-outline-dark rounded-pill fw-bold">
                        <i class="bi bi-arrow-counterclockwise me-2"></i>
                        Reset
                    </a>
                </div>

                <form method="get">
                    <div class="row g-3 align-items-end">

                        <div class="col-md-6 col-xl-3">
                            <label class="guest-host-form-label" for="q">
                                Search
                            </label>
                            <input type="text"
                                   name="q"
                                   id="q"
                                   value="{{ q }}"
                                   class="form-control"
                                   placeholder="Venue, city, event...">
                        </div>

                        <div class="col-md-6 col-xl-2">
                            <label class="guest-host-form-label" for="district">
                                District
                            </label>
                            <input type="text"
                                   name="district"
                                   id="district"
                                   value="{{ district }}"
                                   class="form-control"
                                   placeholder="e.g. Colombo">
                        </div>

                        <div class="col-md-6 col-xl-2">
                            <label class="guest-host-form-label" for="city">
                                City
                            </label>
                            <input type="text"
                                   name="city"
                                   id="city"
                                   value="{{ city }}"
                                   class="form-control"
                                   placeholder="e.g. Dehiwala">
                        </div>

                        <div class="col-md-6 col-xl-2">
                            <label class="guest-host-form-label" for="event_type">
                                Event Type
                            </label>
                            <select name="event_type" id="event_type" class="form-select">
                                <option value="">Any Event</option>
                                <option value="romantic_dates" {% if event_type == "romantic_dates" %}selected{% endif %}>Romantic Dates</option>
                                <option value="proposal_events" {% if event_type == "proposal_events" %}selected{% endif %}>Proposal Events</option>
                                <option value="anniversaries" {% if event_type == "anniversaries" %}selected{% endif %}>Anniversaries</option>
                                <option value="birthdays" {% if event_type == "birthdays" %}selected{% endif %}>Birthdays</option>
                                <option value="honeymoon" {% if event_type == "honeymoon" %}selected{% endif %}>Honeymoon</option>
                                <option value="private_dinners" {% if event_type == "private_dinners" %}selected{% endif %}>Private Dinners</option>
                                <option value="engagements" {% if event_type == "engagements" %}selected{% endif %}>Engagements</option>
                                <option value="small_weddings" {% if event_type == "small_weddings" %}selected{% endif %}>Small Weddings</option>
                                <option value="custom" {% if event_type == "custom" %}selected{% endif %}>Custom Celebrations</option>
                            </select>
                        </div>

                        <div class="col-md-6 col-xl-3">
                            <button type="submit"
                                    class="btn guest-host-btn-gold w-100">
                                <i class="bi bi-funnel-fill me-2"></i>
                                Apply Filters
                            </button>
                        </div>

                    </div>
                </form>

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


    <!-- =====================================================
         VENUE LIST
    ====================================================== -->
    <section class="guest-host-section" id="venues">
        <div class="container">

            <div class="guest-host-result-meta">
                <div>
                    <span class="guest-host-section-mini">
                        <i class="bi bi-search-heart-fill"></i>
                        Available Host Venues
                    </span>

                    <h2 class="guest-host-section-title mb-0">
                        Venues ready for special experiences.
                    </h2>
                </div>

                <div class="guest-host-result-count">
                    {{ venues|length }} venue{{ venues|length|pluralize }} found
                </div>
            </div>

            {% if venues %}
                <div class="row g-4">
                    {% for venue in venues %}
                        <div class="col-md-6 col-xl-4">
                            <div class="guest-host-venue-card">

                                <div class="guest-host-venue-img">
                                    {% if venue.cover_image %}
                                        <img src="{{ venue.cover_image.url }}" alt="{{ venue.venue_name }}">
                                    {% else %}
                                        <div class="guest-host-venue-placeholder">
                                            <i class="bi bi-building-heart"></i>
                                        </div>
                                    {% endif %}

                                    <div class="guest-host-badges">
                                        {% if venue.is_featured %}
                                            <span class="guest-host-badge gold">
                                                <i class="bi bi-star-fill"></i>
                                                Featured
                                            </span>
                                        {% endif %}

                                        {% if venue.max_guest_capacity %}
                                            <span class="guest-host-badge">
                                                <i class="bi bi-people-fill"></i>
                                                Up to {{ venue.max_guest_capacity }}
                                            </span>
                                        {% endif %}
                                    </div>
                                </div>

                                <div class="guest-host-venue-body">

                                    <div class="guest-host-venue-category">
                                        {% if venue.venue_category %}
                                            {{ venue.get_venue_category_display }}
                                        {% else %}
                                            Host Venue
                                        {% endif %}
                                    </div>

                                    <h3>{{ venue.venue_name }}</h3>

                                    <div class="guest-host-venue-location">
                                        <i class="bi bi-geo-alt-fill"></i>
                                        <span>
                                            {% if venue.city %}{{ venue.city }}{% endif %}
                                            {% if venue.city and venue.district %}, {% endif %}
                                            {% if venue.district %}{{ venue.district }}{% endif %}
                                        </span>
                                    </div>

                                    <p class="guest-host-venue-desc">
                                        {{ venue.short_description|truncatechars:145 }}
                                    </p>

                                    <div class="guest-host-chip-row">
                                        {% if venue.supports_romantic_dates %}
                                            <span class="guest-host-chip">
                                                <i class="bi bi-heart-fill"></i>
                                                Dates
                                            </span>
                                        {% endif %}

                                        {% if venue.supports_proposal_events %}
                                            <span class="guest-host-chip">
                                                <i class="bi bi-gem"></i>
                                                Proposal
                                            </span>
                                        {% endif %}

                                        {% if venue.supports_birthdays %}
                                            <span class="guest-host-chip">
                                                <i class="bi bi-balloon-heart"></i>
                                                Birthday
                                            </span>
                                        {% endif %}

                                        {% if venue.supports_anniversaries %}
                                            <span class="guest-host-chip">
                                                <i class="bi bi-calendar-heart"></i>
                                                Anniversary
                                            </span>
                                        {% endif %}

                                        {% if venue.supports_private_dinners %}
                                            <span class="guest-host-chip">
                                                <i class="bi bi-cup-hot"></i>
                                                Dinner
                                            </span>
                                        {% endif %}

                                        {% if venue.supports_custom_celebrations %}
                                            <span class="guest-host-chip">
                                                <i class="bi bi-magic"></i>
                                                Custom
                                            </span>
                                        {% endif %}
                                    </div>

                                    <div class="guest-host-venue-footer">
                                        <a href="{% url 'expat_life:guest_host_venue_detail' venue.slug %}"
                                           class="btn btn-outline-dark">
                                            View Venue Details
                                            <i class="bi bi-arrow-right ms-2"></i>
                                        </a>
                                    </div>

                                </div>

                            </div>
                        </div>
                    {% endfor %}
                </div>
            {% else %}

                <div class="guest-host-empty">
                    <div class="guest-host-empty-icon">
                        <i class="bi bi-building-heart"></i>
                    </div>

                    <h3>No host venues found</h3>

                    <p>
                        We could not find venues matching your current filters. Try changing the location,
                        event type, or search keyword, or return to all available venues.
                    </p>

                    <a href="{% url 'expat_life:guest_host_venue_list' %}"
                       class="btn guest-host-btn-gold">
                        <i class="bi bi-arrow-counterclockwise me-2"></i>
                        Reset Filters
                    </a>
                </div>

            {% endif %}

        </div>
    </section>


    <!-- =====================================================
         CTA
    ====================================================== -->
    <section class="guest-host-section pt-0">
        <div class="container">
            <div class="guest-host-cta">
                <h2>Need help planning a special event?</h2>

                <p>
                    Browse venues first, then review packages, meals, and add-ons on each venue page.
                    Soon, you will be able to create a complete booking order directly through the platform.
                </p>

                <div class="guest-host-hero-actions">
                    <a href="{% url 'expat_life:host_experiences_home' %}"
                       class="btn guest-host-btn-gold">
                        <i class="bi bi-calendar-heart-fill me-2"></i>
                        Experiences Home
                    </a>

                    <a href="{% url 'expat_life:contact_page' %}"
                       class="btn guest-host-btn-glass">
                        <i class="bi bi-chat-heart-fill me-2"></i>
                        Ask About an Event
                    </a>
                </div>
            </div>
        </div>
    </section>

</div>

{% endblock %}