/* ═══════════════════════════════════════════════════════
   Product Page - Payment Section Layout
   Clean, hierarchical structure for add-to-cart and
   payment options. Professional B2B aesthetic.

   Spacing rhythm: 8 · 12 · 16 · 24px
   ═══════════════════════════════════════════════════════ */

/* ── PRIMARY ACTION ZONE ────────────────────────────── */
.catalog-product-view .box-tocart {
    clear: both;                   /* Clear any floats */
    width: 100%;
}

.catalog-product-view .box-tocart .fieldset {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    flex-wrap: wrap;
}

.catalog-product-view .box-tocart .field.qty {
    margin: 0;
    flex-shrink: 0;
}

.catalog-product-view .box-tocart .actions {
    flex: 1;
    margin: 0;
    min-width: 180px;
}

.catalog-product-view .box-tocart .action.primary.tocart {
    width: 100%;
    height: 48px;
    font-size: 15px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* ── EXPRESS CHECKOUT SECTION ─────────────────────── */
.catalog-product-view .product-express-checkout {
    clear: both;                   /* Clear any floated elements above */
    width: 100%;
    margin-top: 24px;
    padding: 16px;
    border: 1px solid #e0e0e0;
    background: #f8f8f8;
    margin-bottom: 24px;
    box-sizing: border-box;
}

/* Divider label — centred with lines either side */
.catalog-product-view .product-express-checkout__divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: -28px 16px 16px;      /* Pull up into the border like a legend */
    font-size: 11px;
    color: #6b6b6b;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
    line-height: 1;
}

.catalog-product-view .product-express-checkout__divider > span {
    flex-shrink: 0;
    padding: 0 8px;
    background: #f8f8f8;          /* Match container bg so it masks the border */
}

.catalog-product-view .product-express-checkout__divider::before,
.catalog-product-view .product-express-checkout__divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #d0d0d0;
}

/* Stripe renders all wallet buttons (Link, GPay, Klarna) inside #payment-request-button.
   The Stripe JS creates iframes in a row — we just ensure the container fills our box.

   IMPORTANT: yttheme.css and m2-styles-m.css have aggressive rules on
   .catalog-product-view .payment-request-button that try to position it
   next to Add to Cart with margin-left:-100px. We must override everything. */
.catalog-product-view .product-express-checkout__buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Full reset of all theme positioning on Stripe button when inside our container */
.catalog-product-view .product-express-checkout .payment-request-button,
.catalog-product-view .product-express-checkout__buttons .payment-request-button {
    margin: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    width: 100% !important;
    max-width: none !important;
    float: none !important;
    position: static !important;
}

.catalog-product-view .product-express-checkout__buttons #payment-request-button {
    width: 100% !important;
    min-height: 40px;
}

/* ── BUY NOW PAY LATER SECTION ───────────────────── */
.catalog-product-view .product-bnpl {
    clear: both;
    width: 100%;
    margin-top: 0;                 /* Express checkout already has margin-bottom */
    padding-top: 16px;
    border-top: 1px solid #e0e0e0;
    box-sizing: border-box;
}

.catalog-product-view .product-bnpl__label {
    margin: 0 0 12px;
    font-size: 13px;
    color: #6b6b6b;
    font-weight: 400;
}

/* Stripe payment method messaging (Klarna/Clearpay badges) */
.catalog-product-view .product-bnpl__options #payment-method-messaging-element {
    margin-bottom: 12px;
}

/* PayPal / Braintree button containers */
.catalog-product-view .product-bnpl__options .paypal-paylater-banner {
    margin-top: 12px;
}

/* PayPal buttons wrapper — side-by-side row */
.catalog-product-view .product-bnpl__paypal-buttons {
    display: flex;
    gap: 12px;
    margin-top: 12px;
}

/* Each PayPal button wrapper takes equal width */
.catalog-product-view .product-bnpl__paypal-buttons > .paypal,
.catalog-product-view .product-bnpl__paypal-buttons > .paypal-credit,
.catalog-product-view .product-bnpl__paypal-buttons > .paypal-paylater {
    flex: 1;
    margin: 0 !important;
    padding: 0 !important;
}

/* Inner Braintree button div fills its wrapper */
.catalog-product-view .product-bnpl__paypal-buttons .action-braintree-paypal-logo {
    width: 100% !important;
    min-height: 40px;
}

/* PayPal/Braintree paylater messaging container — remove vendor padding */
.catalog-product-view .product-bnpl__options .paypal-braintree-paylater-message-container-pdp {
    padding: 0 !important;
}

/* ── HIDE OLD STYLES ──────────────────────────────── */
.catalog-product-view .klarna-section {
    display: none !important;
}

/* ── RESPONSIVE ───────────────────────────────────── */
@media (max-width: 767px) {
    .catalog-product-view .box-tocart .fieldset {
        flex-direction: column;
        align-items: stretch;
    }

    .catalog-product-view .box-tocart .field.qty {
        width: 100%;
    }

    .catalog-product-view .box-tocart .actions {
        min-width: 0;
    }

    .catalog-product-view .product-express-checkout {
        margin-top: 16px;
        margin-bottom: 16px;
        padding: 12px;
    }

    .catalog-product-view .product-express-checkout__divider {
        margin: -24px 8px 12px;
    }

    .catalog-product-view .product-bnpl__paypal-buttons {
        flex-direction: column;
    }
}

@media (min-width: 768px) {
    .catalog-product-view .box-tocart .fieldset .field.qty {
        flex: 0 0 auto;
    }
}
