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

{% block title %}{{ event_package.title }} | Event Package Detail{% endblock %}

{% block content %}

<style>
    /* =========================================================
       HOST EVENT PACKAGE DETAIL — PREMIUM DASHBOARD STYLE
    ========================================================= */

    .hosting-package-detail-page {
        min-height: 100vh;
        padding: 4rem 0 5rem;
        background:
            radial-gradient(circle at top left, rgba(255, 193, 7, 0.12), transparent 28%),
            radial-gradient(circle at top right, rgba(116, 49, 41, 0.10), transparent 32%),
            linear-gradient(180deg, #fffaf5 0%, #fff4e8 42%, #ffffff 100%);
    }

    .hosting-package-detail-hero {
        position: relative;
        overflow: hidden;
        border-radius: 38px;
        min-height: 430px;
        margin-bottom: 2rem;
        color: #ffffff;
        background:
            linear-gradient(
                100deg,
                rgba(45, 23, 22, 0.94) 0%,
                rgba(45, 23, 22, 0.86) 45%,
                rgba(116, 49, 41, 0.56) 100%
            );
        box-shadow: 0 30px 68px rgba(58, 30, 24, 0.20);
    }

    .hosting-package-detail-hero-bg {
        position: absolute;
        inset: 0;
        z-index: 0;
    }

    .hosting-package-detail-hero-bg img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

    .hosting-package-detail-hero-bg::after {
        content: "";
        position: absolute;
        inset: 0;
        background:
            radial-gradient(circle at top right, rgba(255, 211, 107, 0.22), transparent 34%),
            linear-gradient(
                100deg,
                rgba(45, 23, 22, 0.96) 0%,
                rgba(45, 23, 22, 0.88) 45%,
                rgba(116, 49, 41, 0.60) 100%
            );
    }

    .hosting-package-detail-hero-placeholder {
        position: absolute;
        inset: 0;
        background:
            radial-gradient(circle at top right, rgba(255, 193, 7, 0.18), transparent 34%),
            linear-gradient(135deg, #2d1716 0%, #743129 56%, #a7601b 100%);
    }

    .hosting-package-detail-hero-inner {
        position: relative;
        z-index: 2;
        padding: 3rem 2.4rem;
        min-height: 430px;
        display: flex;
        flex-direction: column;
        justify-content: flex-end;
    }

    .hosting-package-detail-kicker {
        display: inline-flex;
        align-items: center;
        gap: 0.5rem;
        width: fit-content;
        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;
        backdrop-filter: blur(10px);
    }

    .hosting-package-detail-hero h1 {
        font-size: clamp(2.15rem, 4vw, 3.65rem);
        font-weight: 950;
        line-height: 1.08;
        letter-spacing: -0.045em;
        margin-bottom: 0.75rem;
        max-width: 900px;
    }

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

    .hosting-package-detail-badges {
        display: flex;
        flex-wrap: wrap;
        gap: 0.65rem;
        margin: 1.4rem 0 1.6rem;
    }

    .hosting-detail-badge {
        display: inline-flex;
        align-items: center;
        gap: 0.4rem;
        padding: 0.5rem 0.82rem;
        border-radius: 999px;
        font-size: 0.78rem;
        font-weight: 900;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        background: rgba(255, 255, 255, 0.14);
        border: 1px solid rgba(255, 255, 255, 0.20);
        color: #ffffff;
        backdrop-filter: blur(8px);
    }

    .hosting-detail-badge.gold {
        background: rgba(255, 193, 7, 0.92);
        color: #2d1716;
        border-color: rgba(255, 193, 7, 0.95);
    }

    .hosting-detail-badge.white {
        background: rgba(255, 255, 255, 0.92);
        color: #2d1716;
    }

    .hosting-package-detail-actions {
        display: flex;
        flex-wrap: wrap;
        gap: 0.85rem;
    }

    .hosting-package-detail-actions .btn {
        border-radius: 999px;
        font-weight: 850;
        padding: 0.82rem 1.35rem;
        min-height: 48px;
    }

    .hosting-btn-gold {
        background: #ffc107;
        color: #2d1716;
        border: none;
    }

    .hosting-btn-gold:hover {
        background: #ffe082;
        color: #2d1716;
        transform: translateY(-1px);
    }

    .hosting-btn-light-outline {
        background: rgba(255, 255, 255, 0.10);
        color: #ffffff;
        border: 1px solid rgba(255, 255, 255, 0.42);
    }

    .hosting-btn-light-outline:hover {
        background: #ffffff;
        color: #2d1716;
    }

    .hosting-detail-card {
        border-radius: 34px;
        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;
        margin-bottom: 1.5rem;
    }

    .hosting-detail-card-header {
        padding: 1.55rem 1.7rem 1.1rem;
        border-bottom: 1px solid #efe2d3;
        background:
            radial-gradient(circle at top right, rgba(255, 193, 7, 0.08), transparent 28%),
            linear-gradient(180deg, #ffffff 0%, #fffaf5 100%);
    }

    .hosting-detail-card-header h2,
    .hosting-detail-card-header h3 {
        color: #2d1716;
        font-weight: 950;
        margin-bottom: 0.35rem;
    }

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

    .hosting-detail-card-body {
        padding: 1.7rem;
    }

    .hosting-description {
        color: #6f5b53;
        line-height: 1.85;
        font-size: 1rem;
        margin-bottom: 0;
        white-space: pre-line;
    }

    .hosting-info-grid {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 1rem;
    }

    .hosting-info-item {
        border-radius: 22px;
        border: 1px solid #efe2d3;
        background: #fffaf5;
        padding: 1rem;
    }

    .hosting-info-item span {
        display: block;
        color: #7a655d;
        font-size: 0.76rem;
        font-weight: 900;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        margin-bottom: 0.3rem;
    }

    .hosting-info-item strong,
    .hosting-info-item a {
        color: #2d1716;
        font-weight: 900;
        text-decoration: none;
        word-break: break-word;
    }

    .hosting-info-item a:hover {
        color: #a7601b;
        text-decoration: underline;
    }

    .hosting-chip-grid {
        display: flex;
        flex-wrap: wrap;
        gap: 0.65rem;
    }

    .hosting-chip {
        display: inline-flex;
        align-items: center;
        gap: 0.45rem;
        border-radius: 999px;
        padding: 0.56rem 0.85rem;
        background: #fffaf5;
        border: 1px solid #efe2d3;
        color: #6f5b53;
        font-size: 0.84rem;
        font-weight: 800;
    }

    .hosting-chip.active {
        background: #fff4e4;
        color: #2d1716;
        border-color: #efd7ae;
    }

    .hosting-chip i {
        color: #a7601b;
    }

    .hosting-notes-box {
        border-radius: 24px;
        border: 1px solid #efd7ae;
        background: #fff4e4;
        padding: 1.15rem;
        color: #7a4c18;
        line-height: 1.75;
        white-space: pre-line;
    }

    .hosting-side-card {
        border-radius: 34px;
        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.09);
        overflow: hidden;
        margin-bottom: 1.5rem;
    }

    .hosting-side-card-header {
        padding: 1.45rem 1.55rem 1rem;
        border-bottom: 1px solid #efe2d3;
        background:
            radial-gradient(circle at top right, rgba(255, 193, 7, 0.08), transparent 28%),
            linear-gradient(180deg, #ffffff 0%, #fffaf5 100%);
    }

    .hosting-side-card-header h3 {
        color: #2d1716;
        font-weight: 950;
        margin-bottom: 0.25rem;
    }

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

    .hosting-side-card-body {
        padding: 1.45rem;
    }

    .hosting-side-action-list {
        display: grid;
        gap: 0.65rem;
    }

    .hosting-side-action-list .btn {
        border-radius: 999px;
        min-height: 46px;
        font-weight: 850;
    }

    .hosting-price-card {
        border-radius: 28px;
        background:
            radial-gradient(circle at top right, rgba(255, 193, 7, 0.14), transparent 34%),
            linear-gradient(135deg, #2d1716 0%, #743129 58%, #a7601b 100%);
        color: #ffffff;
        padding: 1.5rem;
        margin-bottom: 1rem;
    }

    .hosting-price-card span {
        display: block;
        color: rgba(255, 255, 255, 0.72);
        font-size: 0.78rem;
        font-weight: 900;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        margin-bottom: 0.35rem;
    }

    .hosting-price-card strong {
        display: block;
        color: #ffffff;
        font-size: 2.25rem;
        font-weight: 950;
        letter-spacing: -0.04em;
        line-height: 1;
    }

    .hosting-price-card p {
        color: rgba(255, 255, 255, 0.82);
        line-height: 1.65;
        margin: 0.8rem 0 0;
        font-size: 0.92rem;
    }

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

        .hosting-package-detail-hero,
        .hosting-package-detail-hero-inner {
            min-height: auto;
        }

        .hosting-package-detail-hero-inner {
            padding: 2.4rem 1.45rem;
        }
    }

    @media (max-width: 767.98px) {
        .hosting-package-detail-hero {
            border-radius: 30px;
        }

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

        .hosting-package-detail-actions .btn {
            width: 100%;
        }

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

        .hosting-detail-card-body,
        .hosting-detail-card-header,
        .hosting-side-card-header,
        .hosting-side-card-body {
            padding-left: 1.15rem;
            padding-right: 1.15rem;
        }
    }
</style>


<section class="hosting-package-detail-page">
    <div class="container">

        <!-- HERO -->
        <div class="hosting-package-detail-hero">

            {% if event_package.image %}
                <div class="hosting-package-detail-hero-bg">
                    <img src="{{ event_package.image.url }}" alt="{{ event_package.title }}">
                </div>
            {% elif event_package.package_image %}
                <div class="hosting-package-detail-hero-bg">
                    <img src="{{ event_package.package_image.url }}" alt="{{ event_package.title }}">
                </div>
            {% elif venue.cover_image %}
                <div class="hosting-package-detail-hero-bg">
                    <img src="{{ venue.cover_image.url }}" alt="{{ event_package.title }}">
                </div>
            {% else %}
                <div class="hosting-package-detail-hero-placeholder"></div>
            {% endif %}

            <div class="hosting-package-detail-hero-inner">

                <span class="hosting-package-detail-kicker">
                    <i class="bi bi-gift-fill"></i>
                    {% if event_package.event_type %}
                        {{ event_package.get_event_type_display }}
                    {% else %}
                        Event Package
                    {% endif %}
                </span>

                <h1>{{ event_package.title }}</h1>

                <p>
                    {{ event_package.short_description }}
                </p>

                <div class="hosting-package-detail-badges">

                    <span class="hosting-detail-badge white">
                        <i class="bi bi-circle-fill"></i>
                        {% if event_package.listing_status %}
                            {{ event_package.get_listing_status_display }}
                        {% else %}
                            Draft
                        {% endif %}
                    </span>

                    {% if event_package.is_active %}
                        <span class="hosting-detail-badge">
                            <i class="bi bi-check-circle-fill"></i>
                            Active
                        </span>
                    {% else %}
                        <span class="hosting-detail-badge">
                            <i class="bi bi-pause-circle-fill"></i>
                            Inactive
                        </span>
                    {% endif %}

                    {% if event_package.is_featured %}
                        <span class="hosting-detail-badge gold">
                            <i class="bi bi-star-fill"></i>
                            Featured
                        </span>
                    {% endif %}

                    {% if event_package.duration_hours %}
                        <span class="hosting-detail-badge">
                            <i class="bi bi-clock-fill"></i>
                            {{ event_package.duration_hours }} Hours
                        </span>
                    {% endif %}

                    {% if event_package.max_people_included %}
                        <span class="hosting-detail-badge">
                            <i class="bi bi-people-fill"></i>
                            {{ event_package.max_people_included }} People Included
                        </span>
                    {% endif %}

                </div>

                <div class="hosting-package-detail-actions">
                    <a href="{% url 'hosting_app:host_event_package_update' event_package.slug %}"
                       class="btn hosting-btn-gold">
                        <i class="bi bi-pencil-square me-2"></i>
                        Edit Package
                    </a>

                    <a href="{% url 'hosting_app:host_venue_detail' venue.slug %}"
                       class="btn hosting-btn-light-outline">
                        <i class="bi bi-building-heart me-2"></i>
                        View Venue
                    </a>

                    <a href="{% url 'hosting_app:host_event_package_list' %}"
                       class="btn hosting-btn-light-outline">
                        <i class="bi bi-arrow-left-circle me-2"></i>
                        Back to Packages
                    </a>
                </div>

            </div>
        </div>


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

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

                <!-- DESCRIPTION -->
                <div class="hosting-detail-card">
                    <div class="hosting-detail-card-header">
                        <h2>Package Description</h2>
                        <p>
                            Full details of the experience, setting, and intended celebration flow.
                        </p>
                    </div>

                    <div class="hosting-detail-card-body">
                        <p class="hosting-description">
                            {{ event_package.full_description }}
                        </p>
                    </div>
                </div>


                <!-- VENUE DETAILS -->
                <div class="hosting-detail-card">
                    <div class="hosting-detail-card-header">
                        <h3>Connected Venue</h3>
                        <p>
                            The venue where this package can be arranged.
                        </p>
                    </div>

                    <div class="hosting-detail-card-body">
                        <div class="hosting-info-grid">

                            <div class="hosting-info-item">
                                <span>Venue Name</span>
                                <a href="{% url 'hosting_app:host_venue_detail' venue.slug %}">
                                    {{ venue.venue_name }}
                                    <i class="bi bi-box-arrow-up-right ms-1"></i>
                                </a>
                            </div>

                            <div class="hosting-info-item">
                                <span>Venue Category</span>
                                <strong>
                                    {% if venue.venue_category %}
                                        {{ venue.get_venue_category_display }}
                                    {% else %}
                                        Host Venue
                                    {% endif %}
                                </strong>
                            </div>

                            <div class="hosting-info-item">
                                <span>City</span>
                                <strong>
                                    {% if venue.get_city_display %}
                                        {{ venue.get_city_display }}
                                    {% else %}
                                        {{ venue.city }}
                                    {% endif %}
                                </strong>
                            </div>

                            <div class="hosting-info-item">
                                <span>District</span>
                                <strong>
                                    {% if venue.get_district_display %}
                                        {{ venue.get_district_display }}
                                    {% else %}
                                        {{ venue.district }}
                                    {% endif %}
                                </strong>
                            </div>

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


                <!-- PRICING DETAILS -->
                <div class="hosting-detail-card">
                    <div class="hosting-detail-card-header">
                        <h3>Pricing & Guest Count</h3>
                        <p>
                            Main commercial details for this package.
                        </p>
                    </div>

                    <div class="hosting-detail-card-body">
                        <div class="hosting-info-grid">

                            <div class="hosting-info-item">
                                <span>Base Price</span>
                                <strong>USD {{ event_package.base_price_usd }}</strong>
                            </div>

                            <div class="hosting-info-item">
                                <span>Duration</span>
                                <strong>{{ event_package.duration_hours }} hours</strong>
                            </div>

                            <div class="hosting-info-item">
                                <span>People Included</span>
                                <strong>{{ event_package.max_people_included }}</strong>
                            </div>

                            <div class="hosting-info-item">
                                <span>Extra Person Price</span>
                                <strong>USD {{ event_package.extra_person_price_usd }}</strong>
                            </div>

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


                <!-- INCLUDED FEATURES -->
                <div class="hosting-detail-card">
                    <div class="hosting-detail-card-header">
                        <h3>Included Features</h3>
                        <p>
                            Features included or supported by this package.
                        </p>
                    </div>

                    <div class="hosting-detail-card-body">
                        <div class="hosting-chip-grid">

                            {% if event_package.includes_meals %}
                                <span class="hosting-chip active">
                                    <i class="bi bi-cup-hot-fill"></i>
                                    Meals Included
                                </span>
                            {% endif %}

                            {% if event_package.includes_decoration %}
                                <span class="hosting-chip active">
                                    <i class="bi bi-balloon-heart-fill"></i>
                                    Decoration Included
                                </span>
                            {% endif %}

                            {% if event_package.includes_photography %}
                                <span class="hosting-chip active">
                                    <i class="bi bi-camera-fill"></i>
                                    Photography Included
                                </span>
                            {% endif %}

                            {% if event_package.includes_music %}
                                <span class="hosting-chip active">
                                    <i class="bi bi-music-note-beamed"></i>
                                    Music Included
                                </span>
                            {% endif %}

                            {% if event_package.is_customizable %}
                                <span class="hosting-chip active">
                                    <i class="bi bi-magic"></i>
                                    Customizable
                                </span>
                            {% endif %}

                            {% if not event_package.includes_meals and not event_package.includes_decoration and not event_package.includes_photography and not event_package.includes_music and not event_package.is_customizable %}
                                <div class="hosting-notes-box w-100">
                                    No included feature options have been selected yet.
                                </div>
                            {% endif %}

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


                <!-- INCLUSIONS -->
                {% if event_package.inclusions_summary %}
                    <div class="hosting-detail-card">
                        <div class="hosting-detail-card-header">
                            <h3>Inclusions Summary</h3>
                            <p>
                                What is included in this package.
                            </p>
                        </div>

                        <div class="hosting-detail-card-body">
                            <div class="hosting-notes-box">
                                {{ event_package.inclusions_summary }}
                            </div>
                        </div>
                    </div>
                {% endif %}


                <!-- EXCLUSIONS -->
                {% if event_package.exclusions_summary %}
                    <div class="hosting-detail-card">
                        <div class="hosting-detail-card-header">
                            <h3>Exclusions Summary</h3>
                            <p>
                                What is not included in this package.
                            </p>
                        </div>

                        <div class="hosting-detail-card-body">
                            <div class="hosting-notes-box">
                                {{ event_package.exclusions_summary }}
                            </div>
                        </div>
                    </div>
                {% endif %}


                <!-- PRICING NOTE -->
                {% if event_package.pricing_note %}
                    <div class="hosting-detail-card">
                        <div class="hosting-detail-card-header">
                            <h3>Pricing Note</h3>
                            <p>
                                Extra pricing conditions or operational notes.
                            </p>
                        </div>

                        <div class="hosting-detail-card-body">
                            <div class="hosting-notes-box">
                                {{ event_package.pricing_note }}
                            </div>
                        </div>
                    </div>
                {% endif %}

            </div>


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

                <!-- PRICE SUMMARY -->
                <div class="hosting-price-card">
                    <span>Base Package Price</span>
                    <strong>USD {{ event_package.base_price_usd }}</strong>

                    <p>
                        This is the host-entered base package price. Ensolanka commission,
                        custom additions, extra persons, meal plans, or add-on services may be handled separately.
                    </p>
                </div>


                <!-- QUICK INFO -->
                <div class="hosting-side-card">
                    <div class="hosting-side-card-header">
                        <h3>Package Summary</h3>
                        <p>
                            Quick status and review information.
                        </p>
                    </div>

                    <div class="hosting-side-card-body">
                        <div class="hosting-info-grid" style="grid-template-columns: 1fr;">

                            <div class="hosting-info-item">
                                <span>Listing Status</span>
                                <strong>
                                    {% if event_package.listing_status %}
                                        {{ event_package.get_listing_status_display }}
                                    {% else %}
                                        Draft
                                    {% endif %}
                                </strong>
                            </div>

                            <div class="hosting-info-item">
                                <span>Active</span>
                                <strong>
                                    {% if event_package.is_active %}
                                        Yes
                                    {% else %}
                                        No
                                    {% endif %}
                                </strong>
                            </div>

                            <div class="hosting-info-item">
                                <span>Featured</span>
                                <strong>
                                    {% if event_package.is_featured %}
                                        Yes
                                    {% else %}
                                        No
                                    {% endif %}
                                </strong>
                            </div>

                            <div class="hosting-info-item">
                                <span>Event Type</span>
                                <strong>
                                    {% if event_package.event_type %}
                                        {{ event_package.get_event_type_display }}
                                    {% else %}
                                        Not selected
                                    {% endif %}
                                </strong>
                            </div>

                            <div class="hosting-info-item">
                                <span>Created</span>
                                <strong>{{ event_package.created_at|date:"M d, Y" }}</strong>
                            </div>

                            <div class="hosting-info-item">
                                <span>Last Updated</span>
                                <strong>{{ event_package.updated_at|date:"M d, Y" }}</strong>
                            </div>

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


                <!-- ACTIONS -->
                <div class="hosting-side-card">
                    <div class="hosting-side-card-header">
                        <h3>Package Actions</h3>
                        <p>
                            Continue editing this package or manage connected venue details.
                        </p>
                    </div>

                    <div class="hosting-side-card-body">
                        <div class="hosting-side-action-list">

                            <a href="{% url 'hosting_app:host_event_package_update' event_package.slug %}"
                               class="btn btn-dark">
                                <i class="bi bi-pencil-square me-2"></i>
                                Edit Package
                            </a>

                            <a href="{% url 'hosting_app:host_venue_detail' venue.slug %}"
                               class="btn btn-outline-dark">
                                <i class="bi bi-building-heart me-2"></i>
                                View Connected Venue
                            </a>

                            <a href="{% url 'hosting_app:host_event_package_create_for_venue' venue.slug %}"
                               class="btn btn-outline-dark">
                                <i class="bi bi-plus-circle-fill me-2"></i>
                                Add Another Package
                            </a>

                            <a href="{% url 'hosting_app:host_event_package_list' %}"
                               class="btn btn-outline-secondary">
                                <i class="bi bi-arrow-left-circle me-2"></i>
                                Back to Packages
                            </a>

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


                <!-- ADMIN REVIEW -->
                {% if event_package.admin_review_note %}
                    <div class="hosting-side-card">
                        <div class="hosting-side-card-header">
                            <h3>Admin Review Note</h3>
                            <p>
                                Internal or review feedback from Ensolanka admin team.
                            </p>
                        </div>

                        <div class="hosting-side-card-body">
                            <div class="hosting-notes-box">
                                {{ event_package.admin_review_note }}
                            </div>
                        </div>
                    </div>
                {% endif %}

            </div>

        </div>

    </div>
</section>

{% endblock %}