/* NextMarket Quick Checkout — uses the storefront-child theme variables (variables.css). */

/* ================================================================== */
/* Product page buttons                                                */
/* ================================================================== */

.nm-qc {
    grid-column: 1 / -1;
    width: 100%;
    flex-basis: 100%;
    margin-top: 6px;
    font-family: var(--font-main, 'Geist', Helvetica, Arial, sans-serif);
}

.nm-qc-label {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 8px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-opacity-low, #909090);
}

.nm-qc-label::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, var(--secondary-border-color, rgba(255, 255, 255, 0.18)), transparent);
}

.nm-qc-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.nm-qc .nm-qc-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    min-height: 46px;
    margin: 0;
    padding: 0 16px;
    border-radius: var(--border-radius, 12px);
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, opacity 0.2s ease, transform 0.1s ease;
}

.nm-qc .nm-qc-btn:active {
    transform: scale(0.985);
}

.nm-qc .nm-qc-btn--apple {
    background: #ececf0;
    color: #0a0a0a;
    border: 1px solid #ececf0;
}

.nm-qc .nm-qc-btn--apple:hover {
    background: #ffffff;
    border-color: #ffffff;
    color: #0a0a0a;
}

.nm-qc .nm-qc-btn--google {
    background: var(--bg-dark, #0a0a0a);
    color: var(--text-main, #ffffff);
    border: 1px solid var(--secondary-border-color, rgba(255, 255, 255, 0.18));
}

.nm-qc .nm-qc-btn--google:hover {
    background: var(--bg-dark-light, #323232);
    border-color: var(--secondary-border-color, rgba(255, 255, 255, 0.18));
    color: var(--text-main, #ffffff);
}

.nm-qc-logo {
    flex: 0 0 auto;
    width: 17px;
    height: 17px;
}

.nm-qc.is-disabled .nm-qc-btn {
    opacity: 0.5;
}

.nm-qc-hint {
    margin: 8px 0 0;
    font-size: 0.85rem;
    color: var(--primary-red, #f87171);
}

.nm-qc.is-shaking .nm-qc-buttons {
    animation: nm-qc-shake 0.35s ease;
}

@keyframes nm-qc-shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* ================================================================== */
/* Popup                                                               */
/* ================================================================== */

html.nm-qc-open,
html.nm-qc-open body {
    overflow: hidden;
}

.nm-qc-modal {
    --qc-primary: var(--primary-color, #915eff);
    --qc-accent: var(--accent-color, #bb86fc);
    --qc-green: var(--accent-green, #4ade80);
    --qc-border: var(--secondary-border-color, rgba(255, 255, 255, 0.18));
    --qc-dim: var(--text-dim, #a1a1aa);
    --qc-low: var(--text-opacity-low, #909090);
    --qc-card: #0b0b0d;

    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    font-family: var(--font-main, 'Geist', Helvetica, Arial, sans-serif);
    color: var(--text-main, #ffffff);
    opacity: 0;
    transition: opacity 0.22s ease;
}

.nm-qc-modal[hidden] {
    display: none;
}

.nm-qc-modal.is-visible {
    opacity: 1;
}

.nm-qc-overlay {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(600px 400px at 50% 40%, rgba(145, 94, 255, 0.16), transparent 70%),
        rgba(3, 3, 5, 0.78);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

/* ---------- Dialog shell: gradient border + aura ---------- */

.nm-qc-dialog {
    position: relative;
    width: 100%;
    max-width: 460px;
    max-height: calc(100vh - 32px);
    max-height: calc(100dvh - 32px);
    overflow-x: hidden;
    overflow-y: auto;
    padding: 22px 26px 20px;
    border: 1px solid transparent;
    border-radius: 22px;
    background:
        linear-gradient(var(--qc-card), var(--qc-card)) padding-box,
        linear-gradient(150deg, rgba(145, 94, 255, 0.75), rgba(255, 255, 255, 0.07) 38%, rgba(255, 255, 255, 0.05) 62%, rgba(187, 134, 252, 0.45)) border-box;
    box-shadow:
        0 30px 80px rgba(0, 0, 0, 0.6),
        0 0 60px rgba(145, 94, 255, 0.12);
    transform: translateY(14px) scale(0.97);
    filter: blur(2px);
    transition: transform 0.28s cubic-bezier(0.2, 0.9, 0.3, 1.15), filter 0.22s ease;
    scrollbar-width: thin;
}

.nm-qc-modal.is-visible .nm-qc-dialog {
    transform: none;
    filter: none;
}

.nm-qc-aura {
    position: absolute;
    top: -140px;
    left: 50%;
    width: 420px;
    height: 260px;
    margin-left: -210px;
    background: radial-gradient(closest-side, rgba(145, 94, 255, 0.35), rgba(187, 134, 252, 0.12) 55%, transparent);
    pointer-events: none;
    animation: nm-qc-aura 7s ease-in-out infinite alternate;
}

.nm-qc-dialog::before {
    /* faint dotted grid, fading out toward the bottom */
    content: '';
    position: absolute;
    inset: 0;
    background-image: radial-gradient(rgba(255, 255, 255, 0.07) 1px, transparent 1px);
    background-size: 16px 16px;
    -webkit-mask-image: linear-gradient(to bottom, #000, transparent 45%);
    mask-image: linear-gradient(to bottom, #000, transparent 45%);
    pointer-events: none;
}

.nm-qc-dialog > *:not(.nm-qc-aura) {
    position: relative;
}

@keyframes nm-qc-aura {
    from { transform: translateX(-30px) scale(1); opacity: 0.85; }
    to { transform: translateX(30px) scale(1.1); opacity: 1; }
}

/* ---------- Header ---------- */

.nm-qc-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.nm-qc-badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 5px 11px;
    background: rgba(145, 94, 255, 0.12);
    border: 1px solid rgba(145, 94, 255, 0.35);
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--qc-accent);
}

.nm-qc-badge-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--qc-green);
    box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.6);
    animation: nm-qc-pulse 2s ease-out infinite;
}

@keyframes nm-qc-pulse {
    0% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.55); }
    70%, 100% { box-shadow: 0 0 0 7px rgba(74, 222, 128, 0); }
}

.nm-qc-dialog .nm-qc-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    margin: 0;
    padding: 0;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    color: var(--qc-dim);
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.nm-qc-dialog .nm-qc-close:hover {
    background: rgba(255, 255, 255, 0.09);
    color: #ffffff;
    transform: rotate(90deg);
}

.nm-qc-dialog .nm-qc-title {
    margin: 0;
    font-family: inherit;
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.2;
    background: linear-gradient(100deg, #ffffff 30%, var(--qc-accent) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.nm-qc-subtitle {
    margin: 4px 0 18px;
    font-size: 0.95rem;
    color: var(--qc-dim);
}

/* ---------- Product card ---------- */

.nm-qc-product {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 14px 12px 12px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.015));
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 16px;
}

.nm-qc-thumb {
    flex: 0 0 auto;
    width: 56px;
    height: 56px;
    overflow: hidden;
    border-radius: 12px;
    background:
        radial-gradient(circle at 30% 25%, rgba(187, 134, 252, 0.45), transparent 60%),
        linear-gradient(135deg, #1b1230, #0d0a16);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.nm-qc-thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.nm-qc-thumb img[hidden] {
    display: none;
}

.nm-qc-product-info {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 5px;
    min-width: 0;
}

.nm-qc-product-name {
    overflow: hidden;
    font-weight: 600;
    font-size: 0.98rem;
    line-height: 1.3;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nm-qc-product-variant {
    align-self: flex-start;
    max-width: 100%;
    overflow: hidden;
    padding: 2px 8px;
    background: rgba(145, 94, 255, 0.14);
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--qc-accent);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nm-qc-product-variant:empty {
    display: none;
}

.nm-qc-product-price {
    display: flex;
    flex: 0 0 auto;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

.nm-qc-product-price-label {
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--qc-low);
}

.nm-qc-product-price strong {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

/* loading skeleton */
.nm-qc-dialog.is-loading .nm-qc-product-name,
.nm-qc-dialog.is-loading .nm-qc-product-price strong {
    min-width: 120px;
    border-radius: 6px;
    color: transparent;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.05) 25%, rgba(255, 255, 255, 0.12) 50%, rgba(255, 255, 255, 0.05) 75%);
    background-size: 200% 100%;
    animation: nm-qc-skeleton 1.2s linear infinite;
}

.nm-qc-dialog.is-loading .nm-qc-product-price strong {
    min-width: 60px;
}

@keyframes nm-qc-skeleton {
    from { background-position: 200% 0; }
    to { background-position: -200% 0; }
}

/* ---------- Wallet switch (segmented control) ---------- */

.nm-qc-wallets {
    position: relative;
    display: grid;
    grid-template-columns: 1fr 1fr;
    margin: 14px 0 20px;
    padding: 4px;
    background: rgba(255, 255, 255, 0.035);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
}

.nm-qc-wallets-slider {
    position: absolute;
    top: 4px;
    bottom: 4px;
    left: 4px;
    width: calc(50% - 4px);
    border-radius: 10px;
    background: #f1f1f4;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
    transition: transform 0.3s cubic-bezier(0.3, 0.9, 0.3, 1), background 0.3s ease;
}

.nm-qc-wallets[data-active="google_pay"] .nm-qc-wallets-slider {
    transform: translateX(100%);
}

.nm-qc-dialog .nm-qc-wallet {
    position: relative;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 40px;
    margin: 0;
    padding: 0 10px;
    background: transparent;
    border: 0;
    border-radius: 10px;
    color: var(--qc-dim);
    font-family: inherit;
    font-size: 0.92rem;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.25s ease;
}

.nm-qc-dialog .nm-qc-wallet:hover {
    background: transparent;
    color: #ffffff;
}

.nm-qc-dialog .nm-qc-wallet.is-active,
.nm-qc-dialog .nm-qc-wallet.is-active:hover {
    color: #0a0a0a;
}

.nm-qc-dialog .nm-qc-wallet:focus-visible {
    outline: 2px solid var(--qc-primary);
    outline-offset: 2px;
}

/* ---------- Email ---------- */

.nm-qc-form {
    margin: 0;
}

.nm-qc-field-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 0.92rem;
    color: #ffffff;
}

.nm-qc-input-wrap {
    position: relative;
}

.nm-qc-input-icon,
.nm-qc-input-check {
    position: absolute;
    top: 50%;
    pointer-events: none;
    transform: translateY(-50%);
}

.nm-qc-input-icon {
    left: 14px;
    color: var(--qc-low);
    transition: color 0.2s ease;
}

.nm-qc-input-check {
    right: 14px;
    color: var(--qc-green);
    opacity: 0;
    transform: translateY(-50%) scale(0.5);
    transition: opacity 0.2s ease, transform 0.25s cubic-bezier(0.3, 1.6, 0.5, 1);
}

.nm-qc-input-wrap.is-valid .nm-qc-input-check {
    opacity: 1;
    transform: translateY(-50%) scale(1);
}

.nm-qc-input-wrap:focus-within .nm-qc-input-icon {
    color: var(--qc-accent);
}

.nm-qc-dialog .nm-qc-input {
    display: block;
    width: 100%;
    min-height: 50px;
    margin: 0;
    padding: 0 44px;
    background: rgba(0, 0, 0, 0.45);
    border: 1px solid var(--qc-border);
    border-radius: 12px;
    box-shadow: none;
    color: #ffffff;
    font-family: inherit;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.nm-qc-dialog .nm-qc-input::placeholder {
    color: var(--qc-low);
}

.nm-qc-dialog .nm-qc-input:focus {
    background: rgba(0, 0, 0, 0.6);
    border-color: var(--qc-primary);
    box-shadow: 0 0 0 4px rgba(145, 94, 255, 0.18);
}

.nm-qc-input-wrap.is-invalid .nm-qc-input {
    border-color: var(--primary-red, #f87171);
    box-shadow: 0 0 0 4px rgba(248, 113, 113, 0.15);
}

.nm-qc-dialog .nm-qc-select {
    margin-top: 10px;
    padding: 0 14px;
    -webkit-appearance: auto;
    appearance: auto;
}

.nm-qc-dialog .nm-qc-select[hidden] {
    display: none;
}

.nm-qc-country {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 10px;
    font-size: 0.85rem;
    color: var(--qc-dim);
}

.nm-qc-dialog .nm-qc-link {
    margin: 0;
    padding: 0;
    background: none;
    border: 0;
    color: var(--qc-dim);
    font: inherit;
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
}

.nm-qc-dialog .nm-qc-link:hover {
    background: none;
    color: #ffffff;
}

/* ---------- Steps ---------- */

.nm-qc-steps {
    display: flex;
    align-items: center;
    margin: 20px 0 0;
    padding: 0;
    list-style: none;
    counter-reset: none;
}

.nm-qc-step {
    display: flex;
    flex: 1 1 0;
    align-items: center;
    gap: 7px;
    min-width: 0;
    margin: 0;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--qc-low);
    white-space: nowrap;
    transition: color 0.25s ease;
}

.nm-qc-step:not(:last-child)::after {
    content: '';
    flex: 1;
    height: 2px;
    margin: 0 8px 0 2px;
    border-radius: 2px;
    background: linear-gradient(90deg, var(--qc-primary) var(--qc-fill, 0%), rgba(255, 255, 255, 0.1) var(--qc-fill, 0%));
    transition: --qc-fill 0.4s ease;
}

.nm-qc-step.is-done:not(:last-child)::after {
    --qc-fill: 100%;
}

.nm-qc-step-dot {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.04);
    font-size: 0.72rem;
    font-weight: 700;
    transition: background 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease, color 0.25s ease;
}

.nm-qc-step.is-active {
    color: #ffffff;
}

.nm-qc-step.is-active .nm-qc-step-dot {
    background: var(--qc-primary);
    border-color: var(--qc-primary);
    color: #ffffff;
    box-shadow: 0 0 0 4px rgba(145, 94, 255, 0.22);
}

.nm-qc-step.is-done {
    color: var(--qc-dim);
}

.nm-qc-step.is-done .nm-qc-step-dot {
    background: rgba(74, 222, 128, 0.15);
    border-color: rgba(74, 222, 128, 0.5);
    color: var(--qc-green);
}

/* ---------- Error ---------- */

.nm-qc-error {
    margin: 14px 0 0;
    padding: 10px 12px;
    background: rgba(248, 113, 113, 0.08);
    border: 1px solid rgba(248, 113, 113, 0.35);
    border-radius: 10px;
    font-size: 0.88rem;
    color: var(--primary-red, #f87171);
}

.nm-qc-error[hidden] {
    display: none;
}

.nm-qc-dialog.has-error {
    animation: nm-qc-shake 0.35s ease;
}

/* ---------- Pay button ---------- */

.nm-qc-dialog .nm-qc-pay {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    min-height: 54px;
    margin: 20px 0 0;
    padding: 0 18px;
    overflow: hidden;
    background: linear-gradient(115deg, var(--qc-primary) 0%, #7b45f5 45%, var(--qc-accent) 100%);
    border: 0;
    border-radius: 14px;
    box-shadow: 0 10px 30px rgba(145, 94, 255, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.25);
    color: #ffffff;
    font-family: inherit;
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.nm-qc-dialog .nm-qc-pay:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 14px 36px rgba(145, 94, 255, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.nm-qc-dialog .nm-qc-pay:active:not(:disabled) {
    transform: translateY(0) scale(0.99);
}

.nm-qc-dialog .nm-qc-pay:disabled {
    cursor: default;
    opacity: 0.65;
}

.nm-qc-dialog .nm-qc-pay.is-loading {
    opacity: 0.9;
}

.nm-qc-pay-wallet {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.95);
    color: #0a0a0a;
}

.nm-qc-pay-wallet:empty {
    display: none;
}

.nm-qc-pay-wallet svg {
    width: 16px;
    height: 16px;
}

.nm-qc-pay-shine {
    position: absolute;
    top: 0;
    left: -60%;
    width: 40%;
    height: 100%;
    background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.35), transparent);
    transform: skewX(-20deg);
    pointer-events: none;
    animation: nm-qc-shine 3.2s ease-in-out infinite;
}

.nm-qc-dialog .nm-qc-pay.is-loading .nm-qc-pay-shine {
    animation-duration: 0.9s;
}

@keyframes nm-qc-shine {
    0% { left: -60%; }
    55%, 100% { left: 130%; }
}

/* ---------- Terms + trust ---------- */

.nm-qc-terms {
    margin: 14px 0 0;
    font-size: 0.8rem;
    line-height: 1.5;
    text-align: center;
    color: var(--qc-low);
}

.nm-qc-terms a {
    color: var(--qc-dim);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.nm-qc-terms a:hover {
    color: #ffffff;
}

.nm-qc-trust {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px 20px;
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px dashed rgba(255, 255, 255, 0.08);
    font-size: 0.8rem;
    color: var(--qc-dim);
}

.nm-qc-trust span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.nm-qc-trust svg {
    color: var(--qc-accent);
}

/* ---------- Mobile: bottom sheet ---------- */

@media (max-width: 520px) {
    .nm-qc-modal {
        align-items: flex-end;
        padding: 0;
    }

    .nm-qc-dialog {
        max-width: none;
        max-height: 92vh;
        max-height: 92dvh;
        padding: 26px 18px calc(18px + env(safe-area-inset-bottom, 0px));
        border-bottom: 0;
        border-radius: 24px 24px 0 0;
        transform: translateY(100%);
        filter: none;
        transition: transform 0.32s cubic-bezier(0.2, 0.9, 0.3, 1);
    }

    .nm-qc-dialog::after {
        /* grab handle */
        content: '';
        position: absolute;
        top: 9px;
        left: 50%;
        width: 40px;
        height: 4px;
        margin-left: -20px;
        border-radius: 4px;
        background: rgba(255, 255, 255, 0.18);
    }

    .nm-qc-dialog .nm-qc-title {
        font-size: 1.4rem;
    }

    .nm-qc-step {
        font-size: 0.74rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .nm-qc-modal,
    .nm-qc-dialog,
    .nm-qc-wallets-slider,
    .nm-qc-aura,
    .nm-qc-badge-dot,
    .nm-qc-pay-shine,
    .nm-qc-dialog.has-error,
    .nm-qc.is-shaking .nm-qc-buttons {
        transition: none;
        animation: none;
    }
}
