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

{% block title %}Review Hosting Booking | {{ venue.venue_name }}{% endblock %}

{% block content %}

<style>
    .guest-booking-review-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;
        padding: 4rem 0 5rem;
    }

    .guest-review-hero {
        border-radius: 36px;
        padding: 2.6rem 2.3rem;
        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);
        margin-bottom: 2rem;
    }

    .guest-review-kicker {
        display: inline-flex;
        align-items: center;
        gap: 0.5rem;
        padding: 0.52rem 1rem;
        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;
        margin-bottom: 1rem;
    }

    .guest-review-hero h1 {
        font-size: clamp(2.15rem, 4vw, 3.65rem);
        font-weight: 950;
        line-height: 1.06;
        letter-spacing: -0.05em;
        margin-bottom: 0.8rem;
    }

    .guest-review-hero p {
        color: rgba(255,255,255,0.84);
        line-height: 1.8;
        max-width: 860px;
        margin-bottom: 0;
    }

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

    .guest-review-card-header {
        padding: 1.45rem 1.55rem 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%);
    }

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

    .guest-review-card-header p {
        color: #78625a;
        line-height: 1.65;
        margin-bottom: 0;
    }

    .guest-review-card-body {
        padding: 1.55rem;
    }

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

    .guest-review-info-item {
        border-radius: 22px;
        padding: 1rem;
        background: #fff7e8;
        border: 1px solid #efd8b7;
    }

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

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

    .guest-review-total-box {
        border-radius: 28px;
        padding: 1.45rem;
        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%);
        margin-bottom: 1rem;
    }

    .guest-review-total-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.35rem;
    }

    .guest-review-total-box strong {
        display: block;
        color: #ffffff;
        font-size: 2.25rem;
        font-weight: 950;
        line-height: 1;
    }

    .guest-review-line {
        display: flex;
        justify-content: space-between;
        gap: 1rem;
        padding: 0.8rem 0;
        border-bottom: 1px solid #efd8b7;
        color: #6f4f3f;
    }

    .guest-review-line:last-child {
        border-bottom: none;
    }

    .guest-review-line strong {
        color: #38231d;
    }

    .guest-review-actions {
        display: flex;
        flex-wrap: wrap;
        gap: 0.85rem;
        margin-top: 1.5rem;
    }

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

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

    .guest-host-btn-gold:hover,
    .guest-host-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);
    }

    @media (max-width: 767.98px) {
        .guest-booking-review-page {
            padding-top: 2.8rem;
        }

        .guest-review-hero {
            padding: 2rem 1.35rem;
            border-radius: 30px;
        }

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

        .guest-review-actions {
            flex-direction: column;
            align-items: stretch;
        }

        .guest-review-actions .btn {
            width: 100%;
        }
    }
</style>


<section class="guest-booking-review-page">
    <div class="container">

        <div class="guest-review-hero">
            <span class="guest-review-kicker">
                <i class="bi bi-check-circle-fill"></i>
                Review Hosting Booking
            </span>

            <h1>Review your booking before payment</h1>

            <p>
                Please check your selected venue, event details, package, meal plan, add-on services,
                and total amount. After confirmation, you can complete payment from your Guest Payment Center.
            </p>
        </div>


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

            <div class="col-lg-8">

                <div class="guest-review-card">
                    <div class="guest-review-card-header">
                        <h2>Booking Details</h2>
                        <p>Your selected event and venue information.</p>
                    </div>

                    <div class="guest-review-card-body">
                        <div class="guest-review-info-grid">
                            <div class="guest-review-info-item">
                                <span>Venue</span>
                                <strong>{{ booking.venue_name_snapshot }}</strong>
                            </div>

                            <div class="guest-review-info-item">
                                <span>Host</span>
                                <strong>{{ booking.host_business_name_snapshot|default:"Hosting Partner" }}</strong>
                            </div>

                            <div class="guest-review-info-item">
                                <span>Event Type</span>
                                <strong>{{ booking.get_event_type_display }}</strong>
                            </div>

                            <div class="guest-review-info-item">
                                <span>Event Date</span>
                                <strong>{{ booking.preferred_event_date }}</strong>
                            </div>

                            <div class="guest-review-info-item">
                                <span>Start Time</span>
                                <strong>{{ booking.preferred_start_time|default:"Flexible / Not specified" }}</strong>
                            </div>

                            <div class="guest-review-info-item">
                                <span>Guests</span>
                                <strong>{{ booking.number_of_guests }}</strong>
                            </div>
                        </div>
                    </div>
                </div>


                <div class="guest-review-card">
                    <div class="guest-review-card-header">
                        <h3>Selected Items</h3>
                        <p>Package, meal plan, and add-on services included in this booking.</p>
                    </div>

                    <div class="guest-review-card-body">
                        <div class="guest-review-line">
                            <span>Event Package</span>
                            <strong>
                                {% if booking.selected_package %}
                                    {{ booking.package_title_snapshot }} — USD {{ booking.package_amount_snapshot_usd|floatformat:2 }}
                                {% else %}
                                    Not selected
                                {% endif %}
                            </strong>
                        </div>

                        <div class="guest-review-line">
                            <span>Meal Plan</span>
                            <strong>
                                {% if booking.selected_meal_plan %}
                                    {{ booking.meal_plan_title_snapshot }} — USD {{ booking.meal_amount_snapshot_usd|floatformat:2 }}
                                {% else %}
                                    Not selected
                                {% endif %}
                            </strong>
                        </div>

                        <div class="guest-review-line">
                            <span>Add-on Services</span>
                            <strong>USD {{ booking.add_on_amount_snapshot_usd|floatformat:2 }}</strong>
                        </div>

                        {% if selected_add_ons %}
                            <div class="mt-3">
                                {% for item in selected_add_ons %}
                                    <div class="guest-review-info-item mb-2">
                                        <span>{{ item.add_on_title_snapshot }}</span>
                                        <strong>
                                            {{ item.quantity }} × USD {{ item.unit_price_snapshot_usd|floatformat:2 }}
                                            = USD {{ item.subtotal_snapshot_usd|floatformat:2 }}
                                        </strong>
                                    </div>
                                {% endfor %}
                            </div>
                        {% endif %}
                    </div>
                </div>


                {% if booking.occasion_title or booking.occasion_note or booking.special_requests %}
                    <div class="guest-review-card">
                        <div class="guest-review-card-header">
                            <h3>Occasion Notes</h3>
                            <p>Your personal notes and special requests.</p>
                        </div>

                        <div class="guest-review-card-body">
                            {% if booking.occasion_title %}
                                <div class="guest-review-info-item mb-2">
                                    <span>Occasion Title</span>
                                    <strong>{{ booking.occasion_title }}</strong>
                                </div>
                            {% endif %}

                            {% if booking.occasion_note %}
                                <div class="guest-review-info-item mb-2">
                                    <span>Occasion Note</span>
                                    <strong style="white-space: pre-line;">{{ booking.occasion_note }}</strong>
                                </div>
                            {% endif %}

                            {% if booking.special_requests %}
                                <div class="guest-review-info-item">
                                    <span>Special Requests</span>
                                    <strong style="white-space: pre-line;">{{ booking.special_requests }}</strong>
                                </div>
                            {% endif %}
                        </div>
                    </div>
                {% endif %}

            </div>


            <div class="col-lg-4">
                <div class="guest-review-card">
                    <div class="guest-review-card-header">
                        <h3>Payment Summary</h3>
                        <p>This amount will appear in your Guest Payment Center.</p>
                    </div>

                    <div class="guest-review-card-body">
                        <div class="guest-review-total-box">
                            <span>Total Booking Amount</span>
                            <strong>USD {{ booking.total_amount_usd|floatformat:2 }}</strong>
                        </div>

                        <div class="guest-review-line">
                            <span>Package</span>
                            <strong>USD {{ booking.package_amount_snapshot_usd|floatformat:2 }}</strong>
                        </div>

                        <div class="guest-review-line">
                            <span>Meal</span>
                            <strong>USD {{ booking.meal_amount_snapshot_usd|floatformat:2 }}</strong>
                        </div>

                        <div class="guest-review-line">
                            <span>Add-ons</span>
                            <strong>USD {{ booking.add_on_amount_snapshot_usd|floatformat:2 }}</strong>
                        </div>

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

                            <div class="guest-review-actions">
                                <button type="submit" class="btn guest-host-btn-gold w-100">
                                    <i class="bi bi-wallet2 me-2"></i>
                                    Confirm & Go to Payment Center
                                </button>

                                <a href="{% url 'expat_life:guest_host_booking_start' venue.slug %}"
                                   class="btn btn-outline-dark w-100">
                                    <i class="bi bi-pencil-square me-2"></i>
                                    Edit Booking
                                </a>

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

        </div>

    </div>
</section>

{% endblock %}