/* Cascina Bonfiglio — SEZIONE: Pagamento (Figma 58:3980).
   Canvas 1728. Layout grid 708/708 gap 21, padding_x 146.
   Tutti i testi: Nunito Sans. Misure pixel-perfect dal Figma. */

.cb-pagamento {
    padding: 65px 0 108px;
    background: #ffffff;
    color: #000;
    font-family: var(--cb-font-body);
}
.cb-pagamento__inner {
    max-width: 1438px;
    margin: 0 auto;
    padding: 0 64px;  /* allineato col header (.cb-topbar__inner padding interno) */
    box-sizing: border-box;
}

/* ---- Grid (2 colonne uguali full-width inner, gap 21 come Figma) ---- */
.cb-pagamento__grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 21px;
    align-items: start;
}
.cb-pagamento__main { display: flex; flex-direction: column; gap: 25px; }
.cb-pagamento__side { display: flex; flex-direction: column; gap: 18px; }

/* ---- Head ---- */
.cb-pagamento__head { margin: 0 0 32px; padding: 0 2px; }
.cb-pagamento__title {
    margin: 0;
    font-family: var(--cb-font-body);
    font-size: 38px;
    line-height: 47px;
    font-weight: 400;
    letter-spacing: 1.1743px;
    color: #000;
}
.cb-pagamento__count {
    margin: 0;
    font-family: var(--cb-font-body);
    font-size: 18px;
    line-height: 25px;
    font-weight: 400;
    color: #000;
}

/* ---- Card (Figma 55:2842 / 59:4348 / 55:2906) ---- */
.cb-pag-card {
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 20px;
    padding: 20px 40px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    box-sizing: border-box;
}
.cb-pag-card--no-bg { background: transparent; }
.cb-pag-card__title {
    margin: 0;
    font-family: var(--cb-font-body);
    font-size: 26px;
    line-height: 36px;
    font-weight: 700;
    color: #000;
}

/* Row 2 colonne (gap 20 come Figma) */
.cb-pag-card__row { display: flex; gap: 20px; align-items: flex-start; width: 100%; }
.cb-pag-card__row--2 > * { flex: 1 1 303px; min-width: 0; }
.cb-pag-card__row > .form-row { flex: 1 1 0; min-width: 0; }

/* ---- Field (label sopra 14 bold uppercase, input sotto 14 regular) ---- */
.cb-pag-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
}
.cb-pag-field > span,
.cb-pag-field > label {
    font-family: var(--cb-font-body);
    font-size: 14px;
    line-height: 25px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: #000;
}
.cb-pag-field input,
.cb-pag-field select,
.cb-pag-field textarea {
    width: 100%;
    height: 39px;
    padding: 10px;
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 10px;
    background: #ffffff;
    font-family: var(--cb-font-body);
    font-size: 14px;
    font-weight: 400;
    line-height: 1;
    color: #000;
    outline: none;
    box-sizing: border-box;
}
.cb-pag-field input::placeholder { color: rgba(0, 0, 0, 0.3); }
.cb-pag-field input:focus,
.cb-pag-field select:focus { border-color: var(--cb-green); }

/* Override sfondo grigio default WooCommerce sul box payment. */
#add_payment_method #payment,
.woocommerce-cart #payment,
.woocommerce-checkout #payment {
    background: transparent;
    border-radius: 5px;
}

/* Payment box (descrizione metodo, es. "Paga con PayPal."): visibile SOLO se
   il metodo precedente e' .is-selected. Default WC lo lascia sempre visibile
   quando il JS non scatta. */
.cb-pag-method .payment_box { display: none !important; }
.cb-pag-method__row.is-selected + .payment_box { display: block !important; }

/* "è un regalo?" checkbox row (Figma 59:4344) */
.cb-pag-gift {
    display: flex;
    align-items: center;
    gap: 5px;
    height: 20px;
    padding: 0 10px;
    margin: 0;
    font-family: var(--cb-font-body);
    font-size: 14px;
    font-weight: 400;
    color: #000;
    cursor: pointer;
}
.cb-pag-gift input { width: 14px; height: 14px; accent-color: var(--cb-green); margin: 0; }

/* ---- Payment methods (Figma 55:2908..55:3048) ---- */
.cb-pag-method { display: flex; flex-direction: column; gap: 10px; }
.cb-pag-method__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 69px;
    padding: 20px;
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 10px;
    background: #ffffff;
    cursor: pointer;
    box-sizing: border-box;
    margin: 0;
}
.cb-pag-method__row.is-selected,
.cb-pag-method__row:has(input:checked) { border-color: #a8c780; }
.cb-pag-method__row input[type="radio"] { position: absolute; opacity: 0; pointer-events: none; }

.cb-pag-method__radio {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1.5px solid rgba(0, 0, 0, 0.2);
    background: #fff;
    flex-shrink: 0;
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.cb-pag-method__row input[type="radio"]:checked + .cb-pag-method__radio { border-color: #a8c780; }
.cb-pag-method__row input[type="radio"]:checked + .cb-pag-method__radio::after {
    content: "";
    width: 16px;
    height: 16px;
    background: #a8c780;
    border-radius: 50%;
}
.cb-pag-method__text {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    margin-left: 13px;
    line-height: 1;
}
.cb-pag-method__text strong {
    font-family: var(--cb-font-body);
    font-size: 16px;
    font-weight: 700;
    color: #000;
}
.cb-pag-method__text em {
    font-family: var(--cb-font-body);
    font-size: 12px;
    font-weight: 400;
    font-style: normal;
    color: #000;
    margin-top: 2px;
}
.cb-pag-method__icons { display: inline-flex; align-items: center; gap: 10px; flex-shrink: 0; }
.cb-pag-method__icon {
    background: #fff5e6;
    border-radius: 5px;
    height: 24px;
    padding: 0 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.cb-pag-method__icon img,
.cb-pag-method__icon svg { display: block; }

/* Strip 6 loghi pagamento (mirror del footer) — sopra la lista gateway WC */
.cb-pag-methods-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 6px;
    padding: 0;
    list-style: none;
    background: transparent;
    align-items: center;
}
.cb-pag-methods-strip .cb-footer__pay-pill {
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.12);
}
.cb-pag-methods-strip .cb-footer__pay-pill--wide span { color: #000; }

/* SSL note in payment card (Figma 55:3099) */
.cb-pag-ssl {
    display: flex;
    align-items: center;
    gap: 5px;
    height: 20px;
    padding: 0 10px;
    margin: 0;
    font-family: var(--cb-font-body);
    font-size: 11px;
    line-height: 1;
    color: #000;
}
.cb-pag-ssl svg { flex-shrink: 0; }

/* ---- Riepilogo (Figma 55:3113) ---- */
.cb-pag-sum {
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 20px;
    padding: 20px 40px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 25px;
}
.cb-pag-sum__title {
    margin: 0;
    font-family: var(--cb-font-body);
    font-size: 26px;
    line-height: 36px;
    font-weight: 700;
    color: #000;
}

/* Items: cream rows 628x139 (Figma 55:3132 etc) */
.cb-pag-sum__items {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 25px;
}
.cb-pag-row {
    display: flex;
    align-items: center;
    gap: 11.425px;
    height: 139px;
    padding: 20px;
    background: #fff5e6;
    border-radius: 11.425px;
    box-sizing: border-box;
}
.cb-pag-row__media {
    width: 99.394px;
    height: 95.966px;
    border-radius: 11.425px;
    overflow: hidden;
    flex-shrink: 0;
    background: #f5efe6;
}
.cb-pag-row__media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cb-pag-row__info {
    flex: 1 1 auto;
    height: 118px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
}
.cb-pag-row__title {
    margin: 0;
    font-family: var(--cb-font-body);
    font-size: 20.564px;
    line-height: 1.15;
    font-weight: 700;
    color: #000;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
    padding-right: 0px;
}
.cb-pag-row__unit {
    margin: 0;
    height: 44px;
    display: flex;
    align-items: center;
    font-family: var(--cb-font-body);
    font-size: 22.162px;
    line-height: 1;
    font-weight: 400;
    letter-spacing: 1.24px;
    color: #000;
}
.cb-pag-row__qty {
    width: 125px;
    height: 31px;
    padding: 5px 10px;
    border: 1px solid #b2b2b2;
    border-radius: 50px;
    background: transparent;
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    box-sizing: border-box;
}
.cb-pag-row__qty .cb-pag-row__qty-value {
    font-family: var(--cb-font-body);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.354px;
    text-transform: uppercase;
    color: #000;
    line-height: 1;
}
.cb-pag-row__qty .cb-pag-row__qty-sign {
    width: 11px;
    height: 11px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--cb-green);
    flex-shrink: 0;
}
.cb-pag-row__qty .cb-pag-row__qty-sign svg { display: block; }
.cb-pag-row__qty button {
    background: transparent;
    border: 0;
    width: 11px;
    height: 11px;
    padding: 0;
    cursor: pointer;
    color: var(--cb-green);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.cb-pag-row__price {
    width: 102px;
    height: 99px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
    gap: 11px;
    text-align: right;
}
.cb-pag-row__amount {
    margin: 0;
    font-family: var(--cb-font-body);
    font-size: 20.564px;
    line-height: 1;
    font-weight: 700;
    color: #000;
}
.cb-pag-row__remove {
    background: transparent;
    border: 0;
    padding: 4px;
    margin: 0;
    color: #666;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: color .15s;
    border-radius: 4px;
}
.cb-pag-row__remove:hover { color: #c0392b; background: rgba(192, 57, 43, .08); }
.cb-pag-row__remove svg { display: block; }

/* Coupon (Figma 55:3196) — width 628 = input 475 + gap 11 + button 142 */
.cb-pagamento .cb-pag-sum__coupon,
form.cb-pag-sum__coupon.checkout_coupon,
form.cb-pag-sum__coupon.woocommerce-form-coupon {
    display: flex !important;
    align-items: center;
    gap: 11px;
    height: 54px;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    width: 100%;
    box-sizing: border-box;
}
.cb-pag-sum__coupon input,
.cb-pag-sum__coupon input.input-text {
    flex: 1 1 auto;
    height: 54px;
    padding: 10px;
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 10px;
    font-family: var(--cb-font-body);
    font-size: 18px;
    font-weight: 400;
    line-height: 1;
    background: #ffffff;
    color: #000;
    outline: none;
    box-sizing: border-box;
    margin: 0;
    box-shadow: none;
}
.cb-pag-sum__coupon input::placeholder,
.cb-pag-sum__coupon input.input-text::placeholder { color: rgba(0, 0, 0, 0.3); opacity: 1; }
.cb-pag-sum__coupon input:focus,
.cb-pag-sum__coupon input.input-text:focus { border-color: #a8c780; }
.cb-pag-sum__coupon button,
.cb-pag-sum__coupon button.button {
    flex: 0 0 115px;
    width: 115px;
    height: 54px;
    background: #000000 !important;
    color: #ffffff !important;
    border: 0;
    border-radius: 10px;
    font-family: var(--cb-font-body);
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.7037px;
    cursor: pointer;
    margin: 0;
    padding: 0;
    box-shadow: none;
    text-shadow: none;
    text-transform: none;
    line-height: 54px;
    text-align: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    transition: background .2s ease;
}
.cb-pag-sum__coupon button:hover,
.cb-pag-sum__coupon button.button:hover { background: #2a2a2a !important; }

/* Coupon inline feedback message (success/error) */
.cb-pag-sum__coupon-msg {
    flex: 1 1 100%;
    margin: 6px 0 0;
    font-family: var(--cb-font-body);
    font-size: 13px;
    line-height: 1.35;
    letter-spacing: 0.4px;
    color: rgba(0, 0, 0, 0.7);
}
.cb-pag-sum__coupon-msg.is-error { color: #b00020; }
.cb-pag-sum__coupon-msg.is-success { color: #2e7d32; }

/* Sconto applicato: pulsante rimuovi inline */
.cb-pag-sum__line--discount .cb-pag-sum__label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.cb-pag-sum__coupon-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    padding: 0;
    border: 1px solid rgba(0, 0, 0, 0.25);
    border-radius: 50%;
    background: transparent;
    color: rgba(0, 0, 0, 0.7);
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.cb-pag-sum__coupon-remove:hover {
    background: #1a1a1a;
    color: #fff;
    border-color: #1a1a1a;
}
.cb-pag-sum__line--discount .cb-pag-sum__value { color: #2e7d32; font-weight: 600; }

/* Totals lines (Figma 55:3199) */
.cb-pag-sum__lines {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 0;
}
.cb-pag-sum__line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-family: var(--cb-font-body);
    font-size: 18px;
    line-height: 47px;
    font-weight: 400;
    letter-spacing: 1.1743px;
    color: #000;
    padding-top: 10px;
    border-top: 1px solid rgba(0, 0, 0, 0.15);
}
.cb-pag-sum__line:first-child { padding-top: 10px; }
.cb-pag-sum__line .cb-pag-sum__value { text-align: right; }
.cb-pag-sum__line .cb-pag-sum__value b { font-weight: 700; }
.cb-pag-sum__line--total {
    font-size: 24px;
}
.cb-pag-sum__line--total .cb-pag-sum__label { font-weight: 700; }

/* CTA Paga ora (Figma 55:3214) */
.cb-pag-sum__cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    height: 55px;
    background: #a8c780;
    color: #ffffff;
    border: 0;
    border-radius: 100px;
    font-family: var(--cb-font-body);
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.7037px;
    cursor: pointer;
    transition: background .2s ease;
}
.cb-pag-sum__cta::before {
    content: "";
    display: inline-block;
    width: 11px;
    height: 13px;
    background-color: #ffffff;
    -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 11 13'><rect x='1' y='6' width='9' height='6' rx='1' fill='black'/><path d='M3 6V3a2.5 2.5 0 015 0v3' fill='none' stroke='black' stroke-width='1.4'/></svg>");
            mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 11 13'><rect x='1' y='6' width='9' height='6' rx='1' fill='black'/><path d='M3 6V3a2.5 2.5 0 015 0v3' fill='none' stroke='black' stroke-width='1.4'/></svg>");
    -webkit-mask-repeat: no-repeat;
            mask-repeat: no-repeat;
    -webkit-mask-position: center;
            mask-position: center;
    flex-shrink: 0;
}
.cb-pag-sum__cta > svg { display: none; }
.cb-pag-sum__cta:hover { background: #95b56e; }
.cb-pag-sum__cta[disabled] { opacity: 0.6; cursor: wait; }
/* Fix critico: alcuni gateway/JS (FunnelKit, Stripe) nascondono il submit
   quando selezionano un metodo che usa flusso proprio (es. PayPal smart button).
   Forziamo la visibilità del bottone "Paga ora" sempre. */
#place_order,
button[name="woocommerce_checkout_place_order"],
.cb-pag-sum__cta {
    display: inline-flex !important;
    visibility: visible !important;
    opacity: 1 !important;
}
#place_order[disabled],
.cb-pag-sum__cta[disabled] { opacity: 0.6 !important; }

/* Privacy (Figma 55:3225) */
.cb-pag-sum__legal {
    margin: 0;
    font-family: var(--cb-font-body);
    font-size: 11px;
    line-height: 1;
    font-weight: 400;
    color: #000;
    text-align: center;
}
.cb-pag-sum__legal a { color: #000; text-decoration: underline; }

/* ---- Delivery card (Figma 59:4300) — INTERNA al .cb-pag-sum, sotto il privacy ---- */
.cb-pag-delivery {
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    width: 100%;
    padding: 25px;
    background: rgba(168, 199, 128, 0.15);
    border-radius: 10px;
    box-sizing: border-box;
    text-align: left;
}
.cb-pag-delivery__text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
    text-align: left;
}
.cb-pag-delivery__kicker {
    margin: 0;
    font-family: var(--cb-font-body);
    font-size: 14px;
    line-height: 47px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: #000;
    height: 26px;
    display: flex;
    align-items: center;
}
.cb-pag-delivery__date {
    margin: 0;
    font-family: var(--cb-font-body);
    font-size: 24px;
    line-height: 1;
    font-weight: 700;
    letter-spacing: -1px;
    color: #a8c780;
    height: 33px;
    display: flex;
    align-items: center;
}
.cb-pag-delivery__note {
    margin: 0;
    font-family: var(--cb-font-body);
    font-size: 18px;
    line-height: 1;
    font-weight: 400;
    letter-spacing: 0.8952px;
    color: #000;
}

/* ============ WooCommerce overrides per i campi nativi ============ */
.cb-pagamento .form-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 0;
    padding: 0;
    width: 100%;
}
.cb-pagamento .form-row label:not(.cb-pag-gift):not(.cb-pag-method__row) {
    font-family: var(--cb-font-body);
    font-size: 14px;
    line-height: 25px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: #000;
    margin: 0;
    padding: 0;
}
.cb-pagamento .form-row .required { color: #000; text-decoration: none; }
.cb-pagamento .form-row .optional { color: rgba(0,0,0,0.4); font-size: 12px; text-transform: none; }
.cb-pagamento .form-row input.input-text,
.cb-pagamento .form-row textarea,
.cb-pagamento .form-row select,
.cb-pagamento .select2-container .select2-selection--single {
    width: 100%;
    height: 39px;
    padding: 10px;
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 10px;
    background: #fff;
    font-family: var(--cb-font-body);
    font-size: 14px;
    font-weight: 400;
    color: #000;
    line-height: 1;
    box-shadow: none;
    box-sizing: border-box;
}
.cb-pagamento .form-row textarea { height: auto; min-height: 80px; resize: vertical; }
.cb-pagamento .form-row input.input-text::placeholder { color: rgba(0,0,0,0.3); }
.cb-pagamento .form-row input.input-text:focus,
.cb-pagamento .form-row textarea:focus,
.cb-pagamento .form-row select:focus { border-color: #a8c780; outline: none; }
.cb-pagamento .select2-container--default .select2-selection--single { padding: 0 10px; }
.cb-pagamento .select2-container--default .select2-selection--single .select2-selection__rendered { line-height: 37px; padding: 0; color: #000; }
.cb-pagamento .select2-container--default .select2-selection--single .select2-selection__arrow { height: 37px; }
.cb-pagamento .form-row.woocommerce-invalid input.input-text,
.cb-pagamento .form-row.woocommerce-invalid select { border-color: #c00; }

/* PPCP / WC notices nascosti */
.cb-pagamento .ppc-button-wrapper,
.cb-pagamento [id^="ppcp-button-"],
.cb-pagamento [id^="ppc-button-"],
.cb-pagamento .ppcp-button-loading,
.cb-pagamento .ppcp-no-applepay,
.cb-pagamento .ppcp-button-applepay { display: none !important; }
.cb-pagamento .woocommerce-info,
.cb-pagamento .woocommerce-message,
.cb-pagamento .woocommerce-NoticeGroup { display: none !important; }

/* Payment box (PayPal description) inline */
.cb-pagamento .payment_box {
    margin: 8px 0 0;
    padding: 12px 16px;
    border-radius: 10px;
    background: rgba(168, 199, 128, 0.08);
    font-family: var(--cb-font-body);
    font-size: 13px;
    color: #333;
}
.cb-pagamento .payment_box p { margin: 0; }

/* Checkbox "Salva le informazioni di pagamento" (Stripe/FunnelKit save token):
   affianca checkbox e label sulla stessa riga. Usa :has() per matchare qualunque
   markup di gateway (woocommerce-SavedPaymentMethods-saveNew, wfacp, fkwcs, ecc.). */
.cb-pagamento .payment_box .woocommerce-SavedPaymentMethods-saveNew,
.cb-pagamento .payment_box p:has(> input[type="checkbox"]),
.cb-pagamento .payment_box label:has(> input[type="checkbox"]),
.cb-pagamento .payment_box .form-row:has(input[type="checkbox"]) {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    margin: 12px 0 0 !important;
    text-align: left !important;
    flex-wrap: nowrap !important;
}
.cb-pagamento .payment_box .woocommerce-SavedPaymentMethods-saveNew label,
.cb-pagamento .payment_box p:has(> input[type="checkbox"]) label,
.cb-pagamento .payment_box label:has(> input[type="checkbox"]) {
    margin: 0 !important;
    font-size: 12px !important;
    line-height: 1.35 !important;
    text-transform: none !important;
    letter-spacing: 0 !important;
    color: #333 !important;
    cursor: pointer !important;
    font-weight: 400 !important;
    flex: 1 1 auto !important;
}
.cb-pagamento .payment_box input[type="checkbox"] {
    width: 18px !important;
    height: 18px !important;
    flex: 0 0 18px !important;
    margin: 0 !important;
    accent-color: #a8c780 !important;
    cursor: pointer !important;
    vertical-align: middle !important;
}
/* Nascondi eventuali <br> che spezzerebbero la riga checkbox+label. */
.cb-pagamento .payment_box br { display: none !important; }
.cb-pagamento .payment_box .StripeElement,
.cb-pagamento .payment_box .__PrivateStripeElement,
.cb-pagamento .payment_box iframe {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

/* ---- Responsive ---- */
@media (max-width: 1500px) {
    .cb-pagamento__inner { padding: 0 30px; }
    .cb-pagamento__grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
    .cb-pag-sum__coupon input { flex: 1 1 auto; width: auto; }
}
@media (max-width: 1100px) {
    .cb-pagamento__grid { grid-template-columns: 1fr; }
    .cb-pag-delivery { width: auto; margin: 0; }
}

@media (max-width: 1024px) {
    .cb-pagamento { padding: 40px 0 80px; }
    .cb-pagamento__inner { padding: 0 30px; }
    .cb-pagamento__title { font-size: 28px; line-height: 36px; }
    .cb-pag-card { padding: 20px 24px; }
    /* Anche a tablet: form row in colonna verticale (battendo float WC). */
    .cb-pag-card__row { flex-direction: column !important; gap: 12px !important; width: 100%; }
    .cb-pag-card__row > *,
    .cb-pag-card__row .form-row,
    .cb-pag-card__row .form-row-first,
    .cb-pag-card__row .form-row-last,
    .cb-pag-card__row .form-row-wide {
        width: 100% !important;
        max-width: 100% !important;
        float: none !important;
        min-width: 0 !important;
    }
}

@media (max-width: 768px) {
    /* Delivery box: kicker su 2 righe + date sotto. Tolgo line-height/height
       fissi del desktop che causavano overlap "GIORNO/Mercoledì 20 Maggio". */
    .cb-pag-delivery { padding: 16px; }
    .cb-pag-delivery__kicker {
        line-height: 1.3;
        height: auto;
        font-size: 12px;
        letter-spacing: 0.6px;
        margin-bottom: 6px;
    }
    .cb-pag-delivery__date {
        line-height: 1.2;
        height: auto;
        font-size: 20px;
        letter-spacing: -0.3px;
    }
    .cb-pag-delivery__note {
        line-height: 1.4;
        font-size: 14px;
        letter-spacing: 0.3px;
        margin-top: 6px;
    }

    .cb-pagamento { padding: 24px 0 60px; }
    .cb-pagamento__inner { padding: 0 16px; }
    .cb-pagamento__title { font-size: 22px; line-height: 30px; letter-spacing: 0.5px; }
    .cb-pagamento__count { font-size: 13px; }
    .cb-pagamento__head { margin: 0 0 18px; }
    .cb-pagamento__main { gap: 16px; }
    .cb-pagamento__side { gap: 14px; }

    .cb-pag-card {
        padding: 16px;
        gap: 12px;
        border-radius: 14px;
        width: 100%;
        max-width: 100%;
        min-width: 0;
        box-sizing: border-box;
        overflow: hidden;                /* taglia eventuali figli che eccedono (es. select2 buggati) */
    }
    .cb-pag-card__title { font-size: 17px; line-height: 22px; }
    .cb-pag-card__row {
        flex-direction: column;
        gap: 12px;
        width: 100%;
        min-width: 0;
    }
    .cb-pag-card .form-row,
    .cb-pag-card__row > p,
    .cb-pag-card__row > .form-row,
    .cb-pag-card__row .form-row-first,
    .cb-pag-card__row .form-row-last,
    .cb-pag-card__row .form-row-wide {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        float: none !important;          /* WooCommerce mette float left/right sui first/last */
        box-sizing: border-box;
        margin: 0;
    }
    .cb-pag-card input,
    .cb-pag-card select,
    .cb-pag-card textarea,
    .cb-pag-card .select2-container {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box;
    }
    /* Label "è un regalo? — spedisci..." su mobile: checkbox + testo affiancati,
       il testo wrappa internamente al suo spazio (mai sbordato). */
    .cb-pag-gift {
        display: flex !important;
        flex-direction: row !important;
        align-items: flex-start !important;
        flex-wrap: nowrap !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        height: auto !important;
        padding: 6px 0 !important;
        gap: 8px !important;
        font-size: 13px !important;
        line-height: 1.3 !important;
        box-sizing: border-box;
    }
    .cb-pag-gift input { flex: 0 0 14px !important; width: 14px !important; margin: 2px 0 0 !important; }
    .cb-pag-gift span {
        flex: 1 1 0 !important;
        min-width: 0 !important;
        max-width: 100% !important;
        word-wrap: break-word;
        overflow-wrap: anywhere;
    }

    .cb-pag-field > span,
    .cb-pag-field > label { font-size: 12px; line-height: 1.3; }
    .cb-pag-field input,
    .cb-pag-field select,
    .cb-pag-field textarea { height: 42px; font-size: 14px; padding: 8px 12px; }

    /* Payment methods */
    .cb-pag-method__row { height: auto; min-height: 56px; padding: 12px 14px; gap: 10px; }
    .cb-pag-method__radio { width: 24px; height: 24px; }
    .cb-pag-method__row input[type="radio"]:checked + .cb-pag-method__radio::after { width: 12px; height: 12px; }
    .cb-pag-method__text strong { font-size: 14px; }
    .cb-pag-method__text em { font-size: 11px; }
    .cb-pag-method__icons { gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
    .cb-pag-method__icon { height: 20px; padding: 0 6px; }
    .cb-pag-method__icon img,
    .cb-pag-method__icon svg { max-height: 14px; width: auto; }

    /* Riepilogo — layout 3-colonne pixel-perfect dal Figma 75:3622 */
    .cb-pag-sum { padding: 20px; gap: 25px; border-radius: 20px; }
    .cb-pag-sum__title { font-size: 26px; line-height: 36px; }
    .cb-pag-sum__items { gap: 0; }
    .cb-pag-row {
        height: auto;
        flex-wrap: nowrap;
        padding: 16.5px !important;
        gap: 9.4px;
        border-radius: 9.43px;
        align-items: center;
        margin-block-end: 10px;
    }
    .cb-pag-row__media { width: 66px; height: 63.5px; border-radius: 9.43px; flex-shrink: 0; }
    .cb-pag-row__info {
        flex: 1 1 auto;
        height: auto;
        display: flex;
        flex-direction: column;
        justify-content: center;
        gap: 4px;
        min-width: 0;
    }
    .cb-pag-row__title {
        font-size: 14.85px;
        line-height: 1.15;
        white-space: normal;
        font-weight: 700;
        /* Annulla clamp 2 righe del default: mostra titolo intero su mobile. */
        display: block;
        -webkit-line-clamp: unset;
        -webkit-box-orient: unset;
        overflow: visible;
    }
    .cb-pag-row__unit { font-size: 13.2px; height: auto; margin: 0; letter-spacing: 1.02px; }
    .cb-pag-row__qty {
        width: 64px;
        height: 19.8px;
        padding: 4px 8px;
        border-width: 0.825px;
    }
    .cb-pag-row__qty .cb-pag-row__qty-value { font-size: 8.25px; }
    .cb-pag-row__qty .cb-pag-row__qty-sign { width: 7.4px; height: 7.4px; }
    .cb-pag-row__qty .cb-pag-row__qty-sign svg { width: 7.4px; height: 7.4px; }
    .cb-pag-sum__legal {
        margin: 0;
        font-family: var(--cb-font-body);
        font-size: 11px;
        line-height: 18px;
        font-weight: 400;
        color: #000;
        text-align: left;
    }
    .cb-pag-row__price {
        width: auto;
        min-width: 65px;
        height: auto;
        flex-direction: column;
        gap: 9px;
        align-items: flex-end;
        justify-content: center;
        margin-left: auto;
        flex-shrink: 0;
    }
    .cb-pag-row__amount { font-size: 14.85px; font-weight: 700; }
    .cb-pag-row__remove { font-size: 11.55px; letter-spacing: 1.02px; }

    /* Coupon su mobile: input + bottone affiancati, ridotti per non sbordare. */
    .cb-pag-sum__coupon {
        display: flex !important;
        flex-direction: row;
        flex-wrap: nowrap;
        height: auto;
        gap: 6px;
        visibility: visible !important;
        opacity: 1 !important;
        max-height: none !important;
        align-items: stretch;
        width: 100%;
        min-width: 0;
        box-sizing: border-box;
    }
    .cb-pag-sum__coupon input,
    .cb-pag-sum__coupon input.input-text {
        flex: 1 1 0;
        width: auto;
        min-width: 0;
        height: 44px;
        font-size: 14px;
        padding: 8px 10px;
    }
    .cb-pag-sum__coupon button,
    .cb-pag-sum__coupon button.button {
        flex: 0 0 90px;
        width: 90px;
        padding: 0;
        height: 44px;
        font-size: 14px;
        border-radius: 10px;
        display: inline-flex !important;
    }
    .cb-pag-sum__coupon[hidden] { display: flex !important; }
    .cb-pag-ssl { font-size: 11px; }

    /* Form: i campi devono stare uno sotto l'altro senza spazio bianco fantasma.
       Su mobile la row diventa flex-direction:column: il child non deve usare
       flex:1 1 0 (basis 0 → collapsa a h=0 in column flex senza altezza definita).
       Usa flex:0 0 auto così la riga prende l'altezza naturale del contenuto. */
    .cb-pag-card__row { width: 100%; }
    .cb-pag-card__row > .form-row,
    .cb-pag-card__row > * { flex: 0 0 auto; width: 100%; min-width: 0; }
    .cb-pag-card__row.cb-pag-card__row--2 > * { flex: 0 0 auto; min-width: 0; width: 100%; }
    /* Override WC defaults: .form-row-first / .form-row-last sono 47% di default */
    .cb-pagamento .form-row.form-row-first,
    .cb-pagamento .form-row.form-row-last,
    .cb-pagamento .form-row.form-row-wide { width: 100%; float: none; }
    .cb-pagamento .form-row { margin: 0; padding: 0; min-height: 0; display: flex; flex-direction: column; gap: 4px; }
    .cb-pagamento .form-row label { line-height: 1.3; min-height: 0; display: block; }
    .cb-pagamento .form-row .woocommerce-input-wrapper { display: block; width: 100%; }

    /* Spazio in fondo alla pagina per non far coprire il bottone "Paga ora"
       dalla sticky bar mobile (.cb-cart-stickybar è fixed bottom su <640px). */
    .cb-pagamento { padding-bottom: 96px; }

    /* Strip pagamenti compatta su mobile */
    .cb-pag-methods-strip { gap: 6px; justify-content: flex-start; }
    .cb-pag-methods-strip .cb-footer__pay-pill { padding: 4px 8px; }
}

@media (max-width: 480px) {
    /* Margini ridotti su mobile stretto: la card non deve uscire dai bordi. */
    .cb-pagamento__inner { padding: 0 12px; }
    .cb-pag-card { padding: 14px 14px; width: 100%; box-sizing: border-box; }
    .cb-pag-method__icons { width: 100%; justify-content: flex-start; padding-left: 36px; margin-top: 6px; }
    .cb-pag-method__row { flex-wrap: wrap; }
}

/* ===== Modal post "Paga ora" (success / error) v1.19.43 ===== */
/* Riutilizza .cb-thankyou-modal* da thankyou.css. */
.cb-pay-modal__spinner {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 3px solid rgba(168, 199, 128, .25);
    border-top-color: var(--cb-green, #a8c780);
    animation: cb-pay-spin .9s linear infinite;
    display: inline-block;
    margin-top: 8px;
}
@keyframes cb-pay-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
    .cb-pay-modal__spinner { animation: none; }
}

.cb-pay-modal__icon-error {
    display: inline-flex; align-items: center; justify-content: center;
    width: 56px; height: 56px;
    margin: 0;
}
.cb-pay-modal__icon-error svg { display: block; }
