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

{% block title %}Guest Wallet Top-up{% endblock %}

{% block content %}

<style>
    /* =========================================================
       GUEST WALLET TOP-UP — PREMIUM LIVE IN SRI LANKA THEME
    ========================================================= */

    :root {
        --lis-deep: #07131c;
        --lis-navy: #0b2638;
        --lis-blue: #0d6efd;
        --lis-blue-dark: #0b3d91;
        --lis-teal: #0f766e;
        --lis-teal-bright: #20c997;
        --lis-teal-soft: #ecfdf5;
        --lis-gold: #ffc107;
        --lis-gold-light: #ffd45f;
        --lis-sand: #fff8ed;
        --lis-soft-blue: #f5f9ff;
        --lis-white: #ffffff;
        --lis-text: #102033;
        --lis-muted: #64748b;
        --lis-border: rgba(15, 42, 64, 0.10);
        --lis-shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
        --lis-shadow-strong: 0 28px 70px rgba(15, 23, 42, 0.16);
    }

    .guest-wallet-page {
        position: relative;
        overflow: hidden;
        min-height: 100vh;
        padding: 4rem 0 5rem;
        background:
            radial-gradient(circle at 10% 10%, rgba(255, 193, 7, 0.13), transparent 28%),
            radial-gradient(circle at 88% 14%, rgba(13, 110, 253, 0.10), transparent 30%),
            radial-gradient(circle at 82% 86%, rgba(15, 118, 110, 0.12), transparent 32%),
            linear-gradient(180deg, #f5f9ff 0%, #ffffff 100%);
    }

    .guest-wallet-page::before {
        content: "";
        position: absolute;
        width: 430px;
        height: 430px;
        right: -210px;
        top: -210px;
        border-radius: 50%;
        background: rgba(255, 193, 7, 0.11);
        pointer-events: none;
    }

    .guest-wallet-page::after {
        content: "";
        position: absolute;
        width: 360px;
        height: 360px;
        left: -170px;
        bottom: -180px;
        border-radius: 50%;
        background: rgba(13, 110, 253, 0.07);
        pointer-events: none;
    }

    .guest-wallet-page > * {
        position: relative;
        z-index: 2;
    }

    /* =========================================================
       HERO
    ========================================================= */

    .guest-wallet-hero {
        position: relative;
        overflow: hidden;
        border-radius: 40px;
        padding: 2.9rem 2.6rem;
        margin-bottom: 2rem;
        background:
            radial-gradient(circle at top right, rgba(255, 193, 7, 0.18), transparent 34%),
            radial-gradient(circle at bottom left, rgba(32, 201, 151, 0.18), transparent 34%),
            linear-gradient(135deg, #061b2a 0%, #0b3d91 52%, #0f766e 100%);
        color: #ffffff;
        box-shadow: 0 30px 70px rgba(15, 23, 42, 0.20);
    }

    .guest-wallet-hero::before {
        content: "";
        position: absolute;
        top: -95px;
        right: -70px;
        width: 280px;
        height: 280px;
        border-radius: 50%;
        background: rgba(255, 255, 255, 0.08);
        pointer-events: none;
    }

    .guest-wallet-hero::after {
        content: "";
        position: absolute;
        bottom: -130px;
        left: -80px;
        width: 340px;
        height: 340px;
        border-radius: 50%;
        background: rgba(255, 193, 7, 0.10);
        pointer-events: none;
    }

    .guest-wallet-hero-inner {
        position: relative;
        z-index: 2;
    }

    .guest-wallet-mini-title {
        display: inline-flex;
        align-items: center;
        gap: 0.5rem;
        padding: 0.5rem 0.95rem;
        border-radius: 999px;
        background: rgba(255, 193, 7, 0.14);
        border: 1px solid rgba(255, 193, 7, 0.28);
        color: #ffd36b;
        font-size: 0.82rem;
        font-weight: 900;
        text-transform: uppercase;
        letter-spacing: 0.065em;
        margin-bottom: 1rem;
        backdrop-filter: blur(10px);
    }

    .guest-wallet-mini-title::before {
        content: "";
        width: 7px;
        height: 7px;
        border-radius: 50%;
        background: #ffffff;
        box-shadow: 0 0 0 5px rgba(255, 255, 255, 0.12);
    }

    .guest-wallet-hero h1 {
        font-size: clamp(2.2rem, 4vw, 3.65rem);
        font-weight: 950;
        letter-spacing: -0.045em;
        line-height: 1.07;
        margin-bottom: 0.95rem;
    }

    .guest-wallet-hero p {
        max-width: 920px;
        color: rgba(255, 255, 255, 0.86);
        font-size: 1.04rem;
        line-height: 1.78;
        margin-bottom: 0;
    }

    /* =========================================================
       HERO WALLET PANEL
    ========================================================= */

    .guest-wallet-panel {
        margin-top: 1.4rem;
        border-radius: 28px;
        padding: 1.35rem;
        background: rgba(255, 255, 255, 0.12);
        border: 1px solid rgba(255, 255, 255, 0.18);
        backdrop-filter: blur(10px);
        box-shadow: 0 18px 42px rgba(0, 0, 0, 0.10);
    }

    .guest-wallet-panel-item {
        height: 100%;
        border-radius: 22px;
        padding: 1rem 1.05rem;
        background:
            radial-gradient(circle at top right, rgba(255, 193, 7, 0.10), transparent 32%),
            rgba(255, 255, 255, 0.96);
        border: 1px solid rgba(255, 255, 255, 0.24);
        color: var(--lis-text) !important;
        box-shadow: 0 14px 28px rgba(15, 23, 42, 0.08);
    }

    .guest-wallet-label,
    .guest-wallet-panel-item .guest-wallet-label {
        display: block;
        color: var(--lis-muted) !important;
        font-size: 0.78rem;
        font-weight: 900;
        text-transform: uppercase;
        letter-spacing: 0.055em;
        margin-bottom: 0.4rem;
    }

    .guest-wallet-value,
    .guest-wallet-panel-item .guest-wallet-value {
        color: var(--lis-text) !important;
        font-weight: 950;
        font-size: 1.08rem;
        line-height: 1.4;
        margin-bottom: 0;
    }

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

    .guest-wallet-actions .btn {
        border-radius: 999px;
        font-weight: 850;
        padding: 0.82rem 1.35rem;
        min-height: 48px;
        transition: all 0.22s ease;
    }

    .guest-btn-gold {
        background: linear-gradient(135deg, var(--lis-gold-light), var(--lis-gold));
        color: #231707;
        border: none;
        box-shadow: 0 16px 32px rgba(255, 193, 7, 0.24);
    }

    .guest-btn-gold:hover {
        background: linear-gradient(135deg, #ffe08a, var(--lis-gold));
        color: #231707;
        transform: translateY(-2px);
        box-shadow: 0 20px 38px rgba(255, 193, 7, 0.30);
    }

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

    .guest-btn-light-outline:hover {
        background: #ffffff;
        color: var(--lis-deep);
        border-color: #ffffff;
        transform: translateY(-2px);
    }

    /* =========================================================
       MAIN CARDS
    ========================================================= */

    .guest-wallet-card {
        position: relative;
        overflow: hidden;
        border-radius: 34px;
        background:
            radial-gradient(circle at 92% 8%, rgba(255, 193, 7, 0.12), transparent 32%),
            linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
        border: 1px solid rgba(15, 42, 64, 0.08);
        box-shadow: var(--lis-shadow-strong);
        margin-bottom: 1.5rem;
    }

    .guest-wallet-card::before {
        content: "";
        position: absolute;
        inset: 0 0 auto 0;
        height: 6px;
        background: linear-gradient(90deg, var(--lis-gold), var(--lis-teal), var(--lis-blue));
        z-index: 2;
    }

    .guest-wallet-card::after {
        content: "";
        position: absolute;
        width: 230px;
        height: 230px;
        right: -120px;
        bottom: -120px;
        border-radius: 50%;
        background: rgba(15, 118, 110, 0.07);
        pointer-events: none;
    }

    .guest-wallet-card > * {
        position: relative;
        z-index: 3;
    }

    .guest-wallet-card-header {
        padding: 1.65rem 1.8rem 1.15rem;
        border-bottom: 1px solid rgba(15, 42, 64, 0.08);
        background:
            radial-gradient(circle at 92% 10%, rgba(255, 193, 7, 0.13), transparent 34%),
            linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
    }

    .guest-wallet-card-header h2,
    .guest-wallet-card-header h3 {
        color: var(--lis-text);
        font-weight: 950;
        letter-spacing: -0.035em;
        line-height: 1.12;
        margin-bottom: 0.45rem;
    }

    .guest-wallet-card-header p {
        color: var(--lis-muted);
        line-height: 1.7;
        margin-bottom: 0;
    }

    .guest-wallet-card-body {
        padding: 1.8rem;
    }

    /* =========================================================
       FORMS
    ========================================================= */

    .guest-form-group {
        margin-bottom: 1.35rem;
    }

    .guest-form-group label {
        display: block;
        color: var(--lis-text);
        font-weight: 850;
        margin-bottom: 0.5rem;
        letter-spacing: -0.01em;
    }

    .guest-form-group input,
    .guest-form-group select,
    .guest-form-group textarea {
        width: 100%;
        border-radius: 18px;
        border: 1px solid rgba(15, 42, 64, 0.12);
        background:
            linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
        min-height: 52px;
        color: var(--lis-text);
        transition: all 0.22s ease;
        box-shadow: 0 10px 22px rgba(15, 23, 42, 0.035);
    }

    .guest-form-group input:focus,
    .guest-form-group select:focus,
    .guest-form-group textarea:focus {
        outline: none;
        border-color: rgba(15, 118, 110, 0.52);
        background: #ffffff;
        box-shadow:
            0 0 0 0.22rem rgba(15, 118, 110, 0.11),
            0 12px 24px rgba(13, 110, 253, 0.07);
    }

    .guest-field-error {
        color: #b42318;
        font-size: 0.86rem;
        font-weight: 750;
        margin-top: 0.45rem;
    }

    /* =========================================================
       QUICK AMOUNTS
    ========================================================= */

    .quick-amount-grid {
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 0.75rem;
        margin-top: 0.85rem;
    }

    .quick-amount-btn {
        position: relative;
        overflow: hidden;
        border-radius: 18px;
        border: 1px solid rgba(15, 42, 64, 0.10);
        background:
            radial-gradient(circle at 92% 10%, rgba(255, 193, 7, 0.08), transparent 32%),
            linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
        color: var(--lis-text);
        padding: 0.82rem 0.75rem;
        font-weight: 900;
        transition: all 0.22s ease;
        box-shadow: 0 10px 22px rgba(15, 23, 42, 0.035);
    }

    .quick-amount-btn::before {
        content: "";
        position: absolute;
        inset: 0 0 auto 0;
        height: 3px;
        background: linear-gradient(90deg, var(--lis-gold), var(--lis-teal), var(--lis-blue));
        opacity: 0;
        transition: opacity 0.22s ease;
    }

    .quick-amount-btn:hover {
        border-color: rgba(15, 118, 110, 0.22);
        background:
            radial-gradient(circle at 92% 10%, rgba(15, 118, 110, 0.10), transparent 34%),
            linear-gradient(180deg, #ffffff 0%, #ecfdf5 100%);
        color: var(--lis-teal);
        transform: translateY(-2px);
        box-shadow: var(--lis-shadow);
    }

    .quick-amount-btn:hover::before {
        opacity: 1;
    }

    /* =========================================================
       PAYMENT METHOD CARDS
    ========================================================= */

    .payment-method-list {
        display: grid;
        gap: 0.95rem;
    }

    .payment-method-card {
        position: relative;
        overflow: hidden;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 1rem;
        min-height: 82px;
        padding: 1rem 1.05rem;
        border: 1px solid rgba(15, 42, 64, 0.08);
        border-radius: 24px;
        background:
            radial-gradient(circle at 94% 12%, rgba(255, 193, 7, 0.09), transparent 34%),
            linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
        box-shadow: 0 14px 30px rgba(15, 23, 42, 0.055);
        cursor: pointer;
        transition: all 0.24s ease;
    }

    .payment-method-card::before {
        content: "";
        position: absolute;
        inset: 0 0 auto 0;
        height: 4px;
        background: linear-gradient(90deg, var(--lis-gold), var(--lis-teal), var(--lis-blue));
        opacity: 0;
        transition: opacity 0.24s ease;
    }

    .payment-method-card::after {
        content: "";
        position: absolute;
        width: 115px;
        height: 115px;
        right: -58px;
        bottom: -58px;
        border-radius: 50%;
        background: rgba(13, 110, 253, 0.055);
        pointer-events: none;
    }

    .payment-method-card:hover {
        transform: translateY(-3px);
        border-color: rgba(15, 118, 110, 0.20);
        box-shadow: var(--lis-shadow);
    }

    .payment-method-card:hover::before {
        opacity: 1;
    }

    .payment-method-left,
    .payment-method-right {
        position: relative;
        z-index: 2;
    }

    .payment-method-left {
        display: flex;
        align-items: center;
        gap: 0.95rem;
        min-width: 0;
    }

    .payment-method-icon {
        width: 50px;
        height: 50px;
        border-radius: 18px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.25rem;
        flex-shrink: 0;
        box-shadow: 0 12px 24px rgba(15, 23, 42, 0.08);
    }

    .stripe-card .payment-method-icon {
        background:
            linear-gradient(135deg, rgba(13, 110, 253, 0.12), rgba(15, 118, 110, 0.07));
        color: var(--lis-blue);
    }

    .paypal-card .payment-method-icon {
        background:
            linear-gradient(135deg, rgba(255, 193, 7, 0.18), rgba(13, 110, 253, 0.08));
        color: var(--lis-blue-dark);
    }

    .payment-method-title {
        color: var(--lis-text);
        font-weight: 950;
        letter-spacing: -0.015em;
        line-height: 1.2;
    }

    .payment-method-subtitle {
        color: var(--lis-muted);
        font-size: 0.9rem;
        line-height: 1.45;
        margin-top: 0.18rem;
    }

    .payment-method-right {
        display: flex;
        align-items: center;
        gap: 0.65rem;
        flex-shrink: 0;
    }

    .payment-method-status {
        display: inline-flex;
        align-items: center;
        color: var(--lis-teal);
        background: rgba(15, 118, 110, 0.09);
        border: 1px solid rgba(15, 118, 110, 0.15);
        border-radius: 999px;
        padding: 0.32rem 0.68rem;
        font-size: 0.8rem;
        font-weight: 900;
        white-space: nowrap;
    }

    .payment-method-check {
        color: var(--lis-teal);
        font-size: 1.2rem;
        opacity: 0;
        transition: opacity 0.22s ease, transform 0.22s ease;
        line-height: 1;
    }

    .btn-check:checked + .payment-method-card {
        border-color: rgba(15, 118, 110, 0.42);
        background:
            radial-gradient(circle at 94% 12%, rgba(15, 118, 110, 0.12), transparent 34%),
            linear-gradient(180deg, #ffffff 0%, #ecfdf5 100%);
        box-shadow:
            0 0 0 4px rgba(15, 118, 110, 0.10),
            0 22px 50px rgba(15, 23, 42, 0.12);
    }

    .btn-check:checked + .payment-method-card::before {
        opacity: 1;
    }

    .btn-check:checked + .payment-method-card .payment-method-check {
        opacity: 1;
        transform: scale(1.04);
    }

    .btn-check:checked + .payment-method-card .payment-method-icon {
        background: linear-gradient(135deg, var(--lis-deep), var(--lis-blue));
        color: #ffffff;
        box-shadow: 0 14px 28px rgba(13, 110, 253, 0.20);
    }

    /* =========================================================
       SUBMIT / NOTES / SIDE STATS
    ========================================================= */

    .guest-wallet-submit {
        border-radius: 999px;
        min-height: 54px;
        font-weight: 900;
        background: linear-gradient(135deg, var(--lis-deep), var(--lis-blue));
        color: #ffffff;
        border: none;
        box-shadow: 0 16px 32px rgba(13, 110, 253, 0.20);
        transition: all 0.22s ease;
    }

    .guest-wallet-submit:hover {
        color: #ffffff;
        background: linear-gradient(135deg, var(--lis-deep), var(--lis-teal));
        transform: translateY(-2px);
        box-shadow: 0 20px 38px rgba(15, 118, 110, 0.24);
    }

    .guest-note-box {
        border-radius: 24px;
        padding: 1rem 1.1rem;
        background:
            radial-gradient(circle at 92% 10%, rgba(255, 193, 7, 0.12), transparent 32%),
            linear-gradient(135deg, rgba(255, 193, 7, 0.10), rgba(15, 118, 110, 0.06));
        border: 1px solid rgba(255, 193, 7, 0.20);
        color: #475569;
        line-height: 1.7;
    }

    .guest-note-box strong {
        color: var(--lis-text);
    }

    .guest-side-stat {
        position: relative;
        overflow: hidden;
        border-radius: 24px;
        padding: 1.15rem;
        background:
            radial-gradient(circle at 92% 10%, rgba(13, 110, 253, 0.07), transparent 32%),
            linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
        border: 1px solid rgba(15, 42, 64, 0.08);
        margin-bottom: 0.9rem;
        box-shadow: 0 12px 26px rgba(15, 23, 42, 0.045);
    }

    .guest-side-stat::before {
        content: "";
        position: absolute;
        inset: 0 0 auto 0;
        height: 4px;
        background: linear-gradient(90deg, var(--lis-gold), var(--lis-teal), var(--lis-blue));
        opacity: 0.8;
    }

    .guest-side-stat span {
        display: block;
        color: var(--lis-muted);
        font-size: 0.78rem;
        font-weight: 900;
        text-transform: uppercase;
        letter-spacing: 0.055em;
        margin-bottom: 0.35rem;
    }

    .guest-side-stat strong {
        color: var(--lis-text);
        font-weight: 950;
        font-size: 1.18rem;
        letter-spacing: -0.02em;
    }

    .guest-wallet-balance-box {
        position: relative;
        overflow: hidden;
        border-radius: 28px;
        padding: 1.35rem;
        color: #ffffff;
        background:
            radial-gradient(circle at top right, rgba(255, 193, 7, 0.18), transparent 34%),
            radial-gradient(circle at bottom left, rgba(32, 201, 151, 0.16), transparent 34%),
            linear-gradient(135deg, #061b2a 0%, #0b3d91 52%, #0f766e 100%);
        margin-bottom: 1rem;
        box-shadow: 0 20px 44px rgba(15, 23, 42, 0.18);
    }

    .guest-wallet-balance-box::after {
        content: "";
        position: absolute;
        width: 170px;
        height: 170px;
        right: -80px;
        top: -90px;
        border-radius: 50%;
        background: rgba(255, 255, 255, 0.08);
        pointer-events: none;
    }

    .guest-wallet-balance-box span,
    .guest-wallet-balance-box strong {
        position: relative;
        z-index: 2;
    }

    .guest-wallet-balance-box span {
        display: block;
        color: rgba(255, 255, 255, 0.72);
        font-size: 0.78rem;
        font-weight: 900;
        text-transform: uppercase;
        letter-spacing: 0.055em;
        margin-bottom: 0.35rem;
    }

    .guest-wallet-balance-box strong {
        display: block;
        color: #ffffff;
        font-size: 2.35rem;
        font-weight: 950;
        letter-spacing: -0.04em;
        line-height: 1;
    }

    /* =========================================================
       RESPONSIVE
    ========================================================= */

    @media (max-width: 991.98px) {
        .guest-wallet-page {
            padding-top: 2.8rem;
        }

        .guest-wallet-hero {
            padding: 2.15rem 1.45rem;
            border-radius: 30px;
        }
    }

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

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

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

        .quick-amount-grid {
            grid-template-columns: repeat(2, minmax(0, 1fr));
        }

        .payment-method-card {
            padding: 0.9rem;
            border-radius: 20px;
            align-items: flex-start;
        }

        .payment-method-left {
            gap: 0.75rem;
        }

        .payment-method-icon {
            width: 44px;
            height: 44px;
            border-radius: 16px;
            font-size: 1.1rem;
        }

        .payment-method-right {
            flex-direction: column;
            align-items: flex-end;
            gap: 0.45rem;
        }
    }

    @media (max-width: 420px) {
        .guest-wallet-hero {
            border-radius: 26px;
        }

        .guest-wallet-hero h1 {
            font-size: 2.05rem;
        }

        .guest-wallet-card {
            border-radius: 26px;
        }

        .quick-amount-grid {
            grid-template-columns: 1fr;
        }
    }
</style>


<section class="guest-wallet-page">
    <div class="container">

        <!-- HERO -->
        <div class="guest-wallet-hero">
            <div class="guest-wallet-hero-inner">

                <span class="guest-wallet-mini-title">
                    <i class="bi bi-wallet2"></i>
                    Guest Wallet
                </span>

                <h1>Top Up Your Wallet</h1>

                <p>
                    Add funds to your Guest wallet so you can pay future Live in Sri Lanka services,
                    confirmations, bookings, upgrades, and other approved platform payments more easily.
                </p>

                <div class="guest-wallet-panel">
                    <div class="row g-3">

                        <div class="col-md-4">
                            <div class="guest-wallet-panel-item">
                                <span class="guest-wallet-label">Account</span>
                                <p class="guest-wallet-value">
                                    {{ profile.user.get_full_name|default:profile.user.username }}
                                </p>
                            </div>
                        </div>

                        <div class="col-md-4">
                            <div class="guest-wallet-panel-item">
                                <span class="guest-wallet-label">Wallet Type</span>
                                <p class="guest-wallet-value">
                                    {{ account_label|default:"Guest Wallet" }}
                                </p>
                            </div>
                        </div>

                        <div class="col-md-4">
                            <div class="guest-wallet-panel-item">
                                <span class="guest-wallet-label">Current Balance</span>
                                <p class="guest-wallet-value">
                                    USD {{ wallet.balance_usd|floatformat:2 }}
                                </p>
                            </div>
                        </div>

                    </div>
                </div>

                <div class="guest-wallet-actions">
                    <a href="{% url 'expat_life:foreigner_payment_center' %}"
                       class="btn guest-btn-light-outline">
                        <i class="bi bi-arrow-left-circle me-2"></i>
                        Back to Payment Center
                    </a>

                    <a href="{% url 'expat_life:foreigner_dashboard' %}"
                       class="btn guest-btn-light-outline">
                        <i class="bi bi-speedometer2 me-2"></i>
                        My Dashboard
                    </a>

                    <a href="{% url 'expat_life:package_list' %}"
                       class="btn guest-btn-gold">
                        <i class="bi bi-box-seam-fill me-2"></i>
                        View Packages
                    </a>
                </div>

            </div>
        </div>


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

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

                    <div class="guest-wallet-card-header">
                        <h2>Top-up Details</h2>
                        <p>
                            Enter the amount you want to add to your wallet and choose your preferred payment method.
                        </p>
                    </div>

                    <div class="guest-wallet-card-body">

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

                            {% if form.non_field_errors %}
                                <div class="alert alert-danger rounded-4">
                                    {% for error in form.non_field_errors %}
                                        <div>{{ error }}</div>
                                    {% endfor %}
                                </div>
                            {% endif %}

                            <!-- Amount -->
                            <div class="guest-form-group">
                                <label for="{{ form.amount_usd.id_for_label }}">
                                    Top-up Amount USD
                                </label>

                                {{ form.amount_usd }}

                                {% for error in form.amount_usd.errors %}
                                    <div class="guest-field-error">{{ error }}</div>
                                {% endfor %}

                                <div class="quick-amount-grid">
                                    <button type="button" class="quick-amount-btn" data-amount="25">USD 25</button>
                                    <button type="button" class="quick-amount-btn" data-amount="50">USD 50</button>
                                    <button type="button" class="quick-amount-btn" data-amount="100">USD 100</button>
                                    <button type="button" class="quick-amount-btn" data-amount="250">USD 250</button>
                                </div>
                            </div>


                            <!-- Payment Method -->
                            <div class="guest-form-group">
                                <label class="form-label fw-bold mb-3">
                                    Payment Method
                                </label>

                                <div class="payment-method-list">

                                    <input
                                        class="btn-check"
                                        type="radio"
                                        name="payment_method"
                                        id="payStripe"
                                        value="stripe"
                                        {% if form.payment_method.value == "stripe" or not form.payment_method.value %}checked{% endif %}
                                    >

                                    <label class="payment-method-card stripe-card" for="payStripe">
                                        <div class="payment-method-left">
                                            <div class="payment-method-icon">
                                                <i class="bi bi-credit-card-2-front-fill"></i>
                                            </div>

                                            <div>
                                                <div class="payment-method-title">Stripe</div>
                                                <div class="payment-method-subtitle">
                                                    Pay securely with card
                                                </div>
                                            </div>
                                        </div>

                                        <div class="payment-method-right">
                                            <span class="payment-method-status">Available</span>
                                            <span class="payment-method-check">
                                                <i class="bi bi-check-circle-fill"></i>
                                            </span>
                                        </div>
                                    </label>


                                    <input
                                        class="btn-check"
                                        type="radio"
                                        name="payment_method"
                                        id="payPaypal"
                                        value="paypal"
                                        {% if form.payment_method.value == "paypal" %}checked{% endif %}
                                    >

                                    <label class="payment-method-card paypal-card" for="payPaypal">
                                        <div class="payment-method-left">
                                            <div class="payment-method-icon">
                                                <i class="bi bi-paypal"></i>
                                            </div>

                                            <div>
                                                <div class="payment-method-title">PayPal</div>
                                                <div class="payment-method-subtitle">
                                                    Pay securely with your PayPal account
                                                </div>
                                            </div>
                                        </div>

                                        <div class="payment-method-right">
                                            <span class="payment-method-status">Available</span>
                                            <span class="payment-method-check">
                                                <i class="bi bi-check-circle-fill"></i>
                                            </span>
                                        </div>
                                    </label>

                                </div>

                                {% for error in form.payment_method.errors %}
                                    <div class="guest-field-error">{{ error }}</div>
                                {% endfor %}
                            </div>


                            <div class="guest-note-box mb-4">
                                <strong>Important:</strong>
                                Wallet top-up payments are credited to your Guest wallet only after payment confirmation.
                                You can later use your wallet balance for eligible Live in Sri Lanka payments.
                            </div>

                            <button type="submit" class="btn guest-wallet-submit w-100">
                                <i class="bi bi-lock-fill me-2"></i>
                                Continue to Secure Payment
                            </button>

                        </form>

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


            <!-- SIDE INFO -->
            <div class="col-lg-4">

                <div class="guest-wallet-card">
                    <div class="guest-wallet-card-header">
                        <h3>Wallet Summary</h3>
                        <p>
                            Your wallet helps you manage future platform payments more conveniently.
                        </p>
                    </div>

                    <div class="guest-wallet-card-body">
                        <div class="guest-wallet-balance-box">
                            <span>Available Balance</span>
                            <strong>USD {{ wallet.balance_usd|floatformat:2 }}</strong>
                        </div>

                        <div class="guest-side-stat">
                            <span>Wallet Status</span>
                            <strong>
                                {% if wallet.is_active %}
                                    Active
                                {% else %}
                                    Inactive
                                {% endif %}
                            </strong>
                        </div>

                        <div class="guest-side-stat">
                            <span>Profile Type</span>
                            <strong>Guest / Foreigner</strong>
                        </div>

                        <div class="guest-side-stat">
                            <span>Minimum Top-up</span>
                            <strong>USD 5.00</strong>
                        </div>
                    </div>
                </div>


                <div class="guest-wallet-card">
                    <div class="guest-wallet-card-header">
                        <h3>What can wallet funds be used for?</h3>
                        <p>
                            Wallet funds can support eligible future payments in your Guest journey.
                        </p>
                    </div>

                    <div class="guest-wallet-card-body">
                        <ul class="mb-0 ps-3 text-muted" style="line-height: 1.85;">
                            <li>Guest confirmation and service-related payments.</li>
                            <li>Package-related payments and approved upgrades.</li>
                            <li>Rental, furniture, booking, or arrangement payments where wallet usage is enabled.</li>
                            <li>Future eligible services inside the Live in Sri Lanka platform.</li>
                        </ul>
                    </div>
                </div>


                <div class="guest-wallet-card">
                    <div class="guest-wallet-card-header">
                        <h3>Quick Links</h3>
                        <p>
                            Continue managing your Guest account.
                        </p>
                    </div>

                    <div class="guest-wallet-card-body">
                        <div class="d-grid gap-2">
                            <a href="{% url 'expat_life:foreigner_payment_center' %}"
                               class="btn btn-dark rounded-pill fw-bold">
                                <i class="bi bi-wallet2 me-2"></i>
                                Payment Center
                            </a>

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

            </div>

        </div>

    </div>
</section>


<script>
    document.addEventListener('DOMContentLoaded', function () {
        const amountInput = document.getElementById('{{ form.amount_usd.id_for_label }}');
        const quickButtons = document.querySelectorAll('.quick-amount-btn');

        quickButtons.forEach(function (button) {
            button.addEventListener('click', function () {
                const amount = button.dataset.amount || '';
                if (amountInput) {
                    amountInput.value = amount;
                    amountInput.focus();
                }
            });
        });
    });
</script>

{% endblock %}