/* SuperShield Stripe Gate — embedded checkout (parent page). */

/* Strip WooCommerce's default .payment_box chrome (grey box, padding, arrow) so
   the card iframe uses the full column width. Scoped to this gateway only.
   WC styles this via `#payment div.payment_box` (id selector), so we must match
   that specificity + !important to win — a class-only rule loses to it. */
#payment div.payment_box.payment_method_supershield_stripe {
    padding: 0 !important;
    margin: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
}

#payment div.payment_box.payment_method_supershield_stripe::before {
    display: none !important;
}

.ss-sg-checkout {
    margin: 0.5em 0;
}

.ss-sg-checkout__description {
    margin: 0 0 0.75em;
}

/* Stage: skeleton and iframe stack in the same grid cell so they occupy the
   same spot and crossfade on swap — no layout jump when the real form appears. */
.ss-sg-checkout__stage {
    display: grid;
}

.ss-sg-checkout__stage > .ss-sg-checkout__frame,
.ss-sg-checkout__stage > .ss-sg-checkout__loading {
    grid-area: 1 / 1;
}

.ss-sg-checkout__frame {
    width: 100%;
    height: 180px; /* initial; JS grows this to fit on ss-sa:resize */
    border: 0;
    display: block;
    opacity: 1;
    transition: opacity 0.2s ease, height 0.15s ease;
}

/* Hidden but full-width while loading (never display:none — the Stripe Element
   inside needs the real width to measure and lay out correctly on first paint). */
.ss-sg-checkout--loading .ss-sg-checkout__frame {
    opacity: 0;
}

.ss-sg-checkout__frame--busy {
    opacity: 0.5;
    pointer-events: none;
}

/* Skeleton loader (Shopify-checkout style): mimics the Payment Element
   layout:tabs shape. Shown while .ss-sg-checkout--loading is on the container
   (from first render until the iframe posts ss-sa:ready; re-shown on re-mounts). */
.ss-sg-checkout__loading {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease, visibility 0s linear 0.2s;
    min-height: 180px; /* matches the iframe's initial height */
}

.ss-sg-checkout--loading .ss-sg-checkout__loading {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.15s ease;
}

.ss-sg-skeleton {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ss-sg-skeleton__tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 4px;
}

.ss-sg-skeleton__tab {
    flex: 1;
    max-width: 110px;
    height: 56px;
}

.ss-sg-skeleton__label {
    width: 92px;
    height: 12px;
}

.ss-sg-skeleton__field {
    height: 44px;
}

.ss-sg-skeleton__row {
    display: flex;
    gap: 12px;
}

.ss-sg-skeleton__row .ss-sg-skeleton__field {
    flex: 1;
}

/* Skeleton "bone": light grey block with a highlight band sweeping across. */
.ss-sg-skeleton__bone {
    display: block;
    border-radius: 6px;
    background-color: #e9ebee;
    background-image: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.65) 50%,
        rgba(255, 255, 255, 0) 100%
    );
    background-size: 200px 100%;
    background-repeat: no-repeat;
    background-position: -200px 0;
    animation: ss-sg-shimmer 1.4s ease-in-out infinite;
}

@keyframes ss-sg-shimmer {
    to {
        background-position: calc(100% + 200px) 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ss-sg-skeleton__bone {
        animation: none;
    }
}

/* Screen-reader-only text. */
.ss-sg-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.ss-sg-checkout__status {
    margin-top: 0.5em;
    font-size: 0.9em;
}

.ss-sg-checkout__status--error {
    color: #b32d2e;
}

.ss-sg-checkout__status--info {
    color: #1d2327;
}

.ss-sg-checkout__unavailable {
    color: #b32d2e;
}

/* "Place Order" busy state — set the instant the buyer submits, so the button
   visibly shows progress and can't be clicked again. */
.ss-sg-place-order--busy {
    opacity: 0.75;
    cursor: progress !important;
    pointer-events: none;
}

.ss-sg-btn-spinner {
    display: inline-block;
    box-sizing: border-box;
    width: 1em;
    height: 1em;
    margin-right: 0.5em;
    vertical-align: -0.15em;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: ss-sg-spin 0.8s linear infinite;
}

/* Inline 3DS / confirming overlay. */
.ss-sg-confirming {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 1em;
}

.ss-sg-confirming__spinner {
    width: 18px;
    height: 18px;
    border: 2px solid #c3c4c7;
    border-top-color: #2271b1;
    border-radius: 50%;
    animation: ss-sg-spin 0.8s linear infinite;
}

@keyframes ss-sg-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Full-screen "payment successful — completing your order" overlay. Raised by showConfirming() the
   moment a payment is confirmed (card inline OR an Express wallet popup), covering the short
   server-side gap before the redirect to the thank-you page so the checkout never looks frozen. */
#ss-sg-pay-wait {
    position: fixed;
    inset: 0;
    z-index: 2147483600;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.92);
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
#ss-sg-pay-wait.is-active { display: flex; }
#ss-sg-pay-wait .ss-sg-pay-wait__box {
    text-align: center;
    max-width: 340px;
    padding: 28px 32px;
}
#ss-sg-pay-wait .ss-sg-pay-wait__check {
    width: 46px;
    height: 46px;
    margin: 0 auto 14px;
    display: block;
}
#ss-sg-pay-wait .ss-sg-pay-wait__spinner {
    width: 44px;
    height: 44px;
    margin: 0 auto 18px;
    border: 4px solid #e6e6e9;
    border-top-color: #635bff;
    border-radius: 50%;
    animation: ss-sg-spin 0.8s linear infinite;
}
#ss-sg-pay-wait .ss-sg-pay-wait__title {
    font-size: 18px;
    font-weight: 600;
    color: #1a1a2e;
    margin: 0 0 6px;
}
#ss-sg-pay-wait .ss-sg-pay-wait__text {
    font-size: 14px;
    line-height: 1.5;
    color: #6b7280;
    margin: 0;
}

/* Hide redundant text description above the custom Payment Methods card */
.ss-sg-checkout__description {
    display: none !important;
}
body.woocommerce-checkout #payment div.payment_box.payment_method_supershield_stripe,
body #payment div.payment_box.payment_method_supershield_stripe,
body div.payment_box.payment_method_supershield_stripe {
    padding: 0 !important;
    margin: 0 !important;
    background: #f0f0f2 !important;
    box-shadow: none !important;
}
body div.payment_box.payment_method_supershield_stripe .ss-sg-checkout {
    margin: 0 !important;
    padding: 0 !important;
}
.ss-sg-checkout--loading .ss-sg-checkout__frame {
    opacity: 1 !important;
}
.ss-sg-checkout__loading {
    display: none !important;
}
.ss-sg-checkout__status:empty {
    display: none !important;
    margin: 0 !important;
}
.ss-sg-checkout__status:not(:empty) {
    margin: 0 !important;
    padding: 4px 14px 12px !important;
}
.ss-sg-checkout__frame {
    height: 300px;
}

/* WooCommerce Checkout Block styles */
.ss-sg-block-label {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}
.ss-sg-block-label__icons {
    display: inline-block;
    flex-shrink: 0;
}
.wc-block-components-radio-control-accordion-content .ss-sg-checkout,
.wc-block-checkout__payment-method .ss-sg-checkout {
    margin: 0 !important;
    padding: 0 !important;
    width: 100%;
}
.wc-block-components-checkout-place-order-button.ss-sg-place-order--busy {
    opacity: 0.75;
    cursor: progress !important;
    pointer-events: none;
}