/* Buy More Scans modal — conversion-focused package picker */

.buy-modal-dialog {
    max-width: min(780px, calc(100vw - 1rem));
    margin: 0.5rem auto;
    max-height: calc(100dvh - 1rem);
    display: flex;
    align-items: center;
}

.buy-modal.modal-content {
    background: linear-gradient(165deg, #0d0d28 0%, #111133 45%, #0a1220 100%);
    border: 2px solid rgba(0, 255, 157, 0.55);
    border-radius: 16px;
    box-shadow:
        0 0 0 1px rgba(0, 255, 157, 0.12),
        0 24px 64px rgba(0, 0, 0, 0.55),
        0 0 48px rgba(0, 255, 157, 0.08);
    overflow: hidden;
    max-height: calc(100dvh - 1rem);
    width: 100%;
    display: flex;
    flex-direction: column;
}

.buy-modal .modal-header {
    border-bottom: 1px solid rgba(0, 255, 157, 0.2);
    padding: 0.85rem 1.25rem;
    background: rgba(0, 0, 0, 0.2);
    flex-shrink: 0;
}

.buy-modal .modal-title {
    font-weight: 800;
    letter-spacing: 0.02em;
    font-size: 1.1rem;
}

.buy-modal .modal-body {
    padding: 0.9rem 1.15rem calc(1.25rem + env(safe-area-inset-bottom, 0px));
    overflow-x: hidden;
    overflow-y: auto;
    min-height: 0;
    flex: 1 1 auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 255, 157, 0.45) transparent;
}

.buy-modal .modal-body::-webkit-scrollbar {
    width: 8px;
}

.buy-modal .modal-body::-webkit-scrollbar-track {
    background: transparent;
}

.buy-modal .modal-body::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, rgba(0, 255, 157, 0.55), rgba(0, 200, 130, 0.35));
    border-radius: 999px;
    border: 2px solid transparent;
    background-clip: padding-box;
}

/* PayPal iframe buttons need room; avoid clipping debit/credit option */
.buy-modal__checkout #paypal-button-container {
    min-height: 150px;
    overflow: visible;
}

.buy-modal__checkout #paypal-button-container > * {
    max-width: 100%;
}

.buy-modal__hook {
    font-size: 0.88rem;
    line-height: 1.4;
    color: rgba(224, 248, 255, 0.88);
    margin-bottom: 0.55rem;
}

.buy-modal__hook strong {
    color: #00ff9d;
    font-weight: 700;
}

.buy-modal__pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-bottom: 0.75rem;
}

.buy-modal__pill {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 0.22rem 0.5rem;
    border-radius: 999px;
    background: rgba(0, 255, 157, 0.08);
    border: 1px solid rgba(0, 255, 157, 0.28);
    color: rgba(224, 248, 255, 0.85);
}

/* Side-by-side packs + checkout on comfortable widths */
.buy-modal__main {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.85rem;
    align-items: start;
}

@media (min-width: 640px) {
    .buy-modal__main {
        grid-template-columns: 1.15fr 0.85fr;
        gap: 1rem;
        align-items: stretch;
    }

    .buy-modal__checkout {
        margin-top: 0;
        height: 100%;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }
}

.buy-modal__packs {
    min-width: 0;
}

.buy-modal__label {
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    color: #00ff9d;
    margin-bottom: 0.45rem;
}

.buy-packages {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.buy-pkg {
    position: relative;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.2rem 0.65rem;
    align-items: center;
    width: 100%;
    text-align: left;
    padding: 0.62rem 0.85rem;
    border-radius: 10px;
    background: rgba(8, 8, 28, 0.9);
    border: 2px solid rgba(255, 255, 255, 0.1);
    color: #e0f8ff;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.12s ease, background 0.15s ease;
    cursor: pointer;
}

.buy-pkg:hover {
    border-color: rgba(0, 255, 157, 0.45);
    background: rgba(0, 255, 157, 0.04);
    transform: translateY(-1px);
}

.buy-pkg:focus-visible {
    outline: none;
    border-color: #00ff9d;
    box-shadow: 0 0 0 3px rgba(0, 255, 157, 0.25);
}

.buy-pkg.active {
    border-color: #00ff9d;
    background: linear-gradient(120deg, rgba(0, 255, 157, 0.12) 0%, rgba(8, 8, 28, 0.95) 55%);
    box-shadow:
        0 0 0 1px rgba(0, 255, 157, 0.35),
        0 6px 20px rgba(0, 255, 157, 0.12);
}

.buy-pkg--popular.active {
    box-shadow:
        0 0 0 1px rgba(0, 255, 157, 0.5),
        0 0 22px rgba(0, 255, 157, 0.18),
        0 8px 24px rgba(0, 0, 0, 0.35);
}

.buy-pkg--value {
    border-color: rgba(255, 170, 0, 0.35);
}

.buy-pkg--value:hover {
    border-color: rgba(255, 170, 0, 0.65);
}

.buy-pkg--value.active {
    border-color: #ffaa00;
    background: linear-gradient(120deg, rgba(255, 170, 0, 0.12) 0%, rgba(8, 8, 28, 0.95) 55%);
    box-shadow:
        0 0 0 1px rgba(255, 170, 0, 0.4),
        0 6px 20px rgba(255, 170, 0, 0.12);
}

.buy-pkg__left {
    min-width: 0;
}

.buy-pkg__top {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
    margin-bottom: 0.08rem;
}

.buy-pkg__qty {
    font-size: 0.98rem;
    font-weight: 800;
    letter-spacing: -0.01em;
    line-height: 1.15;
}

.buy-pkg__badge {
    font-size: 0.58rem;
    font-weight: 900;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 0.15rem 0.4rem;
    border-radius: 999px;
    line-height: 1.2;
}

.buy-pkg__badge--popular {
    background: #00ff9d;
    color: #000;
}

.buy-pkg__badge--value {
    background: linear-gradient(90deg, #ffaa00, #ffcc44);
    color: #000;
}

.buy-pkg__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.3rem 0.55rem;
    font-size: 0.74rem;
    color: rgba(224, 248, 255, 0.65);
}

.buy-pkg__unit {
    font-weight: 600;
}

.buy-pkg__save {
    font-weight: 800;
    color: #ffcc44;
}

.buy-pkg__right {
    text-align: right;
    flex-shrink: 0;
}

.buy-pkg__total {
    font-size: 1.2rem;
    font-weight: 900;
    color: #00ff9d;
    line-height: 1.1;
    letter-spacing: -0.02em;
}

.buy-pkg--value .buy-pkg__total {
    color: #ffcc44;
}

.buy-pkg__list {
    font-size: 0.68rem;
    color: rgba(224, 248, 255, 0.4);
    text-decoration: line-through;
    margin-top: 0.05rem;
}

.buy-modal__checkout {
    margin-top: 0.75rem;
    padding: 0.85rem 0.95rem 0.95rem;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(0, 255, 157, 0.28);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.buy-modal__summary {
    text-align: center;
    margin-bottom: 0.65rem;
}

.buy-modal__summary-total {
    font-size: 1.25rem;
    font-weight: 900;
    color: #00ff9d;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.buy-modal__summary-detail {
    font-size: 0.78rem;
    color: rgba(224, 248, 255, 0.7);
    margin-top: 0.15rem;
}

.buy-modal__summary-save {
    display: inline-block;
    margin-top: 0.3rem;
    font-size: 0.72rem;
    font-weight: 800;
    color: #000;
    background: linear-gradient(90deg, #ffaa00, #ffcc44);
    padding: 0.18rem 0.5rem;
    border-radius: 999px;
}

.buy-modal__checkout-label {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: rgba(224, 248, 255, 0.55);
    text-align: center;
    margin-bottom: 0.4rem;
}

.buy-modal__trust {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.3rem 0.7rem;
    margin-top: 0.6rem;
    font-size: 0.68rem;
    font-weight: 600;
    color: rgba(224, 248, 255, 0.5);
}

.buy-modal__trust span {
    display: inline-flex;
    align-items: center;
    gap: 0.28rem;
}

.buy-modal__trust i {
    color: #00ff9d;
    font-size: 0.62rem;
}

#buyMessage:empty {
    display: none;
}

#buyMessage {
    margin-top: 0.55rem;
    text-align: center;
}

/* Mobile / short viewports: tighter packs + always scroll to full checkout */
@media (max-width: 639.98px) {
    .buy-modal-dialog {
        margin: 0.35rem auto;
        max-height: calc(100dvh - 0.7rem);
        align-items: flex-start;
    }

    .buy-modal.modal-content {
        max-height: calc(100dvh - 0.7rem);
        border-radius: 14px;
    }

    .buy-modal .modal-header {
        padding: 0.7rem 1rem;
    }

    .buy-modal .modal-body {
        padding: 0.75rem 0.9rem calc(1.5rem + env(safe-area-inset-bottom, 0px));
    }

    .buy-modal__hook {
        font-size: 0.84rem;
        margin-bottom: 0.4rem;
    }

    .buy-modal__pills {
        margin-bottom: 0.5rem;
        gap: 0.28rem;
    }

    .buy-modal__pill {
        font-size: 0.6rem;
        padding: 0.18rem 0.42rem;
    }

    .buy-packages {
        gap: 0.35rem;
    }

    .buy-pkg {
        padding: 0.52rem 0.7rem;
    }

    .buy-pkg__qty {
        font-size: 0.92rem;
    }

    .buy-pkg__total {
        font-size: 1.1rem;
    }

    .buy-modal__checkout {
        margin-top: 0.55rem;
        padding: 0.75rem 0.8rem 1rem;
    }

    .buy-modal__checkout #paypal-button-container {
        min-height: 180px;
        padding-bottom: 0.35rem;
    }

    .buy-modal__trust {
        margin-top: 0.75rem;
        margin-bottom: 0.25rem;
    }
}

@media (max-height: 720px) and (min-width: 640px) {
    .buy-pkg {
        padding: 0.5rem 0.75rem;
    }

    .buy-pkg__qty {
        font-size: 0.92rem;
    }

    .buy-pkg__total {
        font-size: 1.1rem;
    }

    .buy-modal__hook {
        font-size: 0.82rem;
        margin-bottom: 0.4rem;
    }

    .buy-modal__pills {
        margin-bottom: 0.5rem;
    }
}
