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

{% block title %}{{ add_on_service.title }} | Add-on Service Detail{% endblock %}

{% block content %}

<style>
    /* =========================================================
       HOST ADD-ON SERVICE DETAIL — PREMIUM DASHBOARD STYLE
    ========================================================= */

    .hosting-addon-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-addon-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-addon-detail-hero-bg {
        position: absolute;
        inset: 0;
        z-index: 0;
    }

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

    .hosting-addon-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-addon-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-addon-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-addon-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-addon-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-addon-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-addon-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-addon-detail-actions {
        display: flex;
        flex-wrap: wrap;
        gap: 0.85rem;
    }

    .hosting-addon-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-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-addon-detail-page {
            padding-top: 2.8rem;
        }

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

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

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

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

        .hosting-addon-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-addon-detail-page">
    <div class="container">

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

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

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

                <span class="hosting-addon-detail-kicker">
                    <i class="bi bi-stars"></i>
                    Add-on Service
                </span>

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

                <p>
                    {{ add_on_service.description|truncatechars:220 }}
                </p>

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

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

                    {% if add_on_service.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 add_on_service.is_featured %}
                        <span class="hosting-detail-badge gold">
                            <i class="bi bi-star-fill"></i>
                            Featured
                        </span>
                    {% endif %}

                    {% if add_on_service.pricing_type %}
                        <span class="hosting-detail-badge">
                            <i class="bi bi-tag-fill"></i>
                            {{ add_on_service.get_pricing_type_display }}
                        </span>
                    {% endif %}

                    <span class="hosting-detail-badge">
                        <i class="bi bi-cash-coin"></i>
                        USD {{ add_on_service.price_usd }}
                    </span>

                </div>

                <div class="hosting-addon-detail-actions">
                    <a href="{% url 'hosting_app:host_add_on_service_update' add_on_service.pk %}"
                       class="btn hosting-btn-gold">
                        <i class="bi bi-pencil-square me-2"></i>
                        Edit Add-on
                    </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_add_on_service_list' %}"
                       class="btn hosting-btn-light-outline">
                        <i class="bi bi-arrow-left-circle me-2"></i>
                        Back to Add-ons
                    </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>Add-on Service Description</h2>
                        <p>
                            Guest-facing explanation of this optional event enhancement service.
                        </p>
                    </div>

                    <div class="hosting-detail-card-body">
                        <p class="hosting-description">
                            {{ add_on_service.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 add-on service can be offered.
                        </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 Details</h3>
                        <p>
                            Main pricing information for this optional service.
                        </p>
                    </div>

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

                            <div class="hosting-info-item">
                                <span>Price</span>
                                <strong>USD {{ add_on_service.price_usd }}</strong>
                            </div>

                            <div class="hosting-info-item">
                                <span>Pricing Type</span>
                                <strong>
                                    {% if add_on_service.pricing_type %}
                                        {{ add_on_service.get_pricing_type_display }}
                                    {% else %}
                                        Fixed
                                    {% endif %}
                                </strong>
                            </div>

                            <div class="hosting-info-item">
                                <span>Commission Note</span>
                                <strong>Ensolanka 10% coordination commission applies</strong>
                            </div>

                            <div class="hosting-info-item">
                                <span>Usage</span>
                                <strong>Optional service selected with event arrangements</strong>
                            </div>

                        </div>

                        <div class="hosting-notes-box mt-3">
                            Final payable amount may change depending on guest requirements,
                            event package selection, quantity, duration, availability, supplier charges,
                            and Ensolanka-host final confirmation.
                        </div>
                    </div>
                </div>

            </div>


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

                <!-- PRICE SUMMARY -->
                <div class="hosting-price-card">
                    <span>Add-on Service Price</span>
                    <strong>USD {{ add_on_service.price_usd }}</strong>

                    <p>
                        Pricing type:
                        {% if add_on_service.pricing_type %}
                            {{ add_on_service.get_pricing_type_display }}.
                        {% else %}
                            Fixed.
                        {% endif %}
                        Final guest payable amount may depend on final arrangement confirmation.
                    </p>
                </div>


                <!-- QUICK INFO -->
                <div class="hosting-side-card">
                    <div class="hosting-side-card-header">
                        <h3>Add-on 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 add_on_service.listing_status %}
                                        {{ add_on_service.get_listing_status_display }}
                                    {% else %}
                                        Draft
                                    {% endif %}
                                </strong>
                            </div>

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

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

                            <div class="hosting-info-item">
                                <span>Pricing Type</span>
                                <strong>
                                    {% if add_on_service.pricing_type %}
                                        {{ add_on_service.get_pricing_type_display }}
                                    {% else %}
                                        Fixed
                                    {% endif %}
                                </strong>
                            </div>

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

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

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


                <!-- ACTIONS -->
                <div class="hosting-side-card">
                    <div class="hosting-side-card-header">
                        <h3>Add-on Actions</h3>
                        <p>
                            Continue editing this service or manage the connected venue.
                        </p>
                    </div>

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

                            <a href="{% url 'hosting_app:host_add_on_service_update' add_on_service.pk %}"
                               class="btn btn-dark">
                                <i class="bi bi-pencil-square me-2"></i>
                                Edit Add-on Service
                            </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_add_on_service_create_for_venue' venue.slug %}"
                               class="btn btn-outline-dark">
                                <i class="bi bi-plus-circle-fill me-2"></i>
                                Add Another Add-on
                            </a>

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

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


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

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

            </div>

        </div>

    </div>
</section>

{% endblock %}