/* WooCommerce retains field labels, validation and commerce actions.
   Additive styles: cart/checkout only, after the theme and native Blocks. */
:is(body.woocommerce-cart,body.woocommerce-checkout) .wc-block-components-text-input :is(input[type="text"],input[type="email"],input[type="tel"],input[type="number"]),
:is(body.woocommerce-cart,body.woocommerce-checkout) .wc-blocks-components-select__select,
:is(body.woocommerce-cart,body.woocommerce-checkout) .wc-block-components-textarea {
    border: 1px solid #7d899b !important;
    border-radius: 12px !important;
    min-height: 52px;
    box-shadow: 0 1px 2px rgb(16 24 40 / 4%);
}
:is(body.woocommerce-cart,body.woocommerce-checkout) .wc-block-components-text-input :is(input[type="text"],input[type="email"],input[type="tel"],input[type="number"]),
:is(body.woocommerce-cart,body.woocommerce-checkout) .wc-blocks-components-select__select {
    height: 52px;
}
:is(body.woocommerce-cart,body.woocommerce-checkout) .wc-block-components-text-input input:focus,
:is(body.woocommerce-cart,body.woocommerce-checkout) .wc-blocks-components-select__select:focus,
:is(body.woocommerce-cart,body.woocommerce-checkout) .wc-block-components-textarea:focus {
    border-color: #4f46e5 !important;
    box-shadow: 0 0 0 4px rgb(79 70 229 / 16%) !important;
    outline: 2px solid #4f46e5 !important;
    outline-offset: 2px;
}
:is(body.woocommerce-cart,body.woocommerce-checkout) .wc-block-components-text-input.has-error input,
:is(body.woocommerce-cart,body.woocommerce-checkout) :is(input,select,textarea)[aria-invalid="true"] {
    border-color: #b42318 !important;
}
:is(body.woocommerce-cart,body.woocommerce-checkout) .wc-block-components-radio-control__option {
    border: 1px solid #7d899b !important;
    border-radius: 12px;
    background: #fff;
}
:is(body.woocommerce-cart,body.woocommerce-checkout) .wc-block-components-radio-control__option:has(input:checked) {
    border-color: #4f46e5 !important;
    background: #f5f6ff;
}
:is(body.woocommerce-cart,body.woocommerce-checkout) .wc-block-components-radio-control__option:has(input:focus-visible) {
    outline: 2px solid #4f46e5;
    outline-offset: 3px;
}
/* Native highlight wrappers otherwise draw a second dark, square frame.
   The option's visible border and keyboard outline remain the controls. */
:is(body.woocommerce-cart,body.woocommerce-checkout) .wc-block-components-radio-control-accordion-option {
    border-radius: 12px;
    box-shadow: none !important;
}
:is(body.woocommerce-cart,body.woocommerce-checkout) .wc-block-components-radio-control-accordion-option + .wc-block-components-radio-control-accordion-option {
    margin-top: 8px;
}
:is(body.woocommerce-cart,body.woocommerce-checkout) :is(.wc-block-components-radio-control--highlight-checked,.wc-block-components-radio-control-accordion-option,.wc-block-components-radio-control__option)::after {
    border-color: transparent !important;
    background-color: transparent !important;
}
/* The payment method and its native panel share one frame. Hosted fields stay untouched. */
body.woocommerce-checkout .wc-block-checkout__payment-method .wc-block-components-radio-control-accordion-option {
    min-width: 0;
    border: 1px solid #7d899b !important;
    border-radius: 12px;
    background: #fff;
}
body.woocommerce-checkout .wc-block-checkout__payment-method .wc-block-components-radio-control-accordion-option + .wc-block-components-radio-control-accordion-option {
    margin-top: 12px;
}
body.woocommerce-checkout .wc-block-checkout__payment-method .wc-block-components-radio-control-accordion-option:has(> label input:checked) {
    border-color: #4f46e5 !important;
    box-shadow: 0 0 0 1px #4f46e5 !important;
}
body.woocommerce-checkout .wc-block-checkout__payment-method .wc-block-components-radio-control-accordion-option > .wc-block-components-radio-control__option {
    min-height: 54px;
    margin: 0;
    border: 0 !important;
    border-radius: 11px;
}
body.woocommerce-checkout .wc-block-checkout__payment-method .wc-block-components-radio-control-accordion-option:has(> .wc-block-components-radio-control-accordion-content) > .wc-block-components-radio-control__option {
    border-end-start-radius: 0;
    border-end-end-radius: 0;
}
body.woocommerce-checkout .wc-block-checkout__payment-method .wc-block-components-radio-control__label {
    font-weight: 600;
}
body.woocommerce-checkout .wc-block-checkout__payment-method .wc-block-components-radio-control-accordion-content {
    padding: 14px 16px 16px;
    border-block-start: 1px solid #e5e9f4;
    border-radius: 0 0 11px 11px;
    background: #fff;
}
body.woocommerce-checkout .wc-block-checkout__payment-method .wc-block-components-radio-control-accordion-option:has(> label input:focus-visible) {
    outline: 2px solid #4f46e5;
    outline-offset: 4px;
}
body.woocommerce-checkout .wc-block-checkout__payment-method .wc-block-components-radio-control__option:has(input:focus-visible) {
    outline: 0;
}
body.woocommerce-checkout .wc-block-checkout__payment-method .wc-block-components-radio-control-accordion-option:has(input[value="ppcp-gateway"]:checked) .wc-block-components-radio-control-accordion-content p {
    margin: 0;
    text-align: start;
}
body.woocommerce-checkout .wc-block-checkout__payment-method .wc-block-components-radio-control-accordion-option:has(input[value="ppcp-gateway"]:checked) .wc-block-components-radio-control-accordion-content p + p {
    margin-block-start: 8px;
}
:is(body.woocommerce-cart,body.woocommerce-checkout) :is(.wc-block-components-checkout-place-order-button,.wc-block-cart__submit-button) {
    min-height: 56px;
    border: 1px solid #4f46e5 !important;
    border-radius: 12px !important;
    background: #4f46e5 !important;
    color: #fff !important;
    font-weight: 700 !important;
}
:is(body.woocommerce-cart,body.woocommerce-checkout) :is(.wc-block-components-checkout-place-order-button,.wc-block-cart__submit-button):hover:not(:disabled) {
    border-color: #4338ca !important;
    background: #4338ca !important;
}
:is(body.woocommerce-cart,body.woocommerce-checkout) :is(.wc-block-components-checkout-place-order-button,.wc-block-cart__submit-button,.wc-block-cart-item__remove-link):focus-visible {
    outline: 2px solid #4f46e5 !important;
    outline-offset: 3px;
}
body.woocommerce-checkout .wc-block-components-order-summary-item__individual-prices,
body.woocommerce-checkout .wc-block-components-order-summary-item__individual-prices .wc-block-components-product-price__value {
    color: #667085 !important;
    font-size: 12.5px !important;
    line-height: 1.5 !important;
}
/* D12: this same button calls the native cart store, now below the name. */
body.woocommerce-checkout .ds-checkout-remove-badge {
    position: static !important;
    inset: auto !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    width: fit-content !important;
    max-width: 100% !important;
    min-width: 44px !important;
    height: auto !important;
    min-height: 44px !important;
    margin: 0 !important;
    padding: 2px 0 !important;
    border: 0 !important;
    border-radius: 4px !important;
    background: transparent !important;
    color: #475467 !important;
    font: inherit !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    line-height: 1.5 !important;
    text-align: start !important;
    text-decoration: underline !important;
    text-underline-offset: 3px;
    box-shadow: none !important;
    transform: none !important;
    z-index: auto !important;
}
body.woocommerce-checkout .ds-checkout-remove-badge:hover:not(:disabled) {
    background: transparent !important;
    color: #b42318 !important;
}
body.woocommerce-checkout .ds-checkout-remove-badge:focus-visible {
    background: transparent !important;
    color: #475467 !important;
    outline: 2px solid #4f46e5 !important;
    outline-offset: 2px;
}
body.woocommerce-checkout .ds-checkout-remove-badge:disabled {
    opacity: .65 !important;
    cursor: wait;
}

/* Product links keep the approved summary typography and image size. */
body.woocommerce-checkout .wc-block-components-product-name .ds-product-page-link {
    color: inherit;
    font: inherit;
    text-decoration: none;
}
body.woocommerce-checkout .wc-block-components-product-name .ds-product-page-link:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
}
body.woocommerce-checkout .ds-product-page-link:focus-visible {
    outline: 2px solid #4f46e5;
    outline-offset: 3px;
    border-radius: 4px;
}
body.woocommerce-checkout .ds-product-image-link {
    display: block;
    line-height: 0;
    border-radius: inherit;
    max-width: 100%;
}
body.woocommerce-checkout .wc-block-components-order-summary-item__total-price .wc-block-cart-item__total-price-and-sale-badge-wrapper {
    align-items: flex-start !important;
}

/* DamaSoft: indicatore acquisto approvato. Definizione canonica unica. */
.ds-commerce-flow[data-ds-commerce-flow] {
    --ds-flow-number-size: 2.25rem;
    --ds-flow-gap: 1rem;
    --ds-flow-line-clearance: 0.5rem;
    --ds-flow-line-color: #dce3f0;
    --ds-flow-ink: #5b667b;
    --ds-flow-current: #4338ca;
    --ds-flow-blue: #2563eb;
    --ds-flow-done: #176458;
    position: relative;
    isolation: isolate;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: stretch;
    gap: var(--ds-flow-gap);
    box-sizing: border-box;
    inline-size: 100%;
    min-inline-size: 0;
    margin: 0 0 1.5rem;
    padding: 1rem 1.25rem;
    overflow: visible;
    border: 1px solid #e1e6f0;
    border-radius: 1.25rem;
    background: #fff;
    color: var(--ds-flow-ink);
    box-shadow: 0 6px 20px rgba(15, 23, 42, 0.035);
}

/* Conserva il comportamento nativo anche dopo AJAX sul carrello. */
.ds-commerce-flow[data-ds-commerce-flow][hidden] {
    display: none !important;
}

/* La vecchia linea unica sul contenitore non viene riutilizzata. */
.ds-commerce-flow[data-ds-commerce-flow]::before {
    content: none;
    display: none;
}

.ds-commerce-flow[data-ds-commerce-flow] > .ds-commerce-step {
    position: relative;
    z-index: auto;
    box-sizing: border-box;
    min-inline-size: 0;
    min-block-size: 0;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: none;
    box-shadow: none;
    overflow: visible;
}

.ds-commerce-flow[data-ds-commerce-flow] > .ds-commerce-step::after {
    content: none;
    display: none !important;
}

/* Due segmenti: il bordo di ciascun numero rimane libero per 8 px. */
.ds-commerce-flow[data-ds-commerce-flow] > .ds-commerce-step:not(:last-child)::after {
    content: "";
    display: block !important;
    position: absolute;
    z-index: 0;
    top: calc(var(--ds-flow-number-size) / 2 + 0.25rem - 1px);
    /* Coordinate logiche: stessa distanza anche nella direzione RTL. */
    left: auto;
    right: auto;
    inset-inline-start: calc(50% + var(--ds-flow-number-size) / 2 + var(--ds-flow-line-clearance));
    inset-inline-end: calc(-50% - var(--ds-flow-gap) + var(--ds-flow-number-size) / 2 + var(--ds-flow-line-clearance));
    height: 2px;
    border: 0;
    border-radius: 999px;
    background: var(--ds-flow-line-color);
    box-shadow: none;
    pointer-events: none;
}

.ds-commerce-flow[data-ds-commerce-flow] > .ds-commerce-step.is-done:not(:last-child)::after {
    background: linear-gradient(90deg, var(--ds-flow-current), var(--ds-flow-blue));
}

.ds-commerce-flow[data-ds-commerce-flow] > .ds-commerce-step > :is(a, span) {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: var(--ds-flow-number-size) auto;
    align-content: start;
    align-items: start;
    justify-items: center;
    gap: 0.625rem;
    box-sizing: border-box;
    inline-size: 100%;
    block-size: 100%;
    min-inline-size: 0;
    min-height: 0;
    min-block-size: 0;
    margin: 0;
    padding: 0.25rem 0 0.375rem;
    border: 0;
    border-radius: 0.75rem;
    background: transparent;
    color: var(--ds-flow-ink);
    font-family: inherit;
    text-align: center;
    text-decoration: none !important;
    box-shadow: none;
    outline: none;
    transform: none;
    transition: none;
}

.ds-commerce-flow[data-ds-commerce-flow] > .ds-commerce-step > :is(a, span) > b {
    position: relative;
    z-index: 1;
    display: grid;
    place-items: center;
    box-sizing: border-box;
    flex: none;
    inline-size: var(--ds-flow-number-size);
    block-size: var(--ds-flow-number-size);
    width: var(--ds-flow-number-size);
    height: var(--ds-flow-number-size);
    margin: 0;
    padding: 0;
    border: 1px solid #d8e0ec;
    border-radius: 0.75rem;
    background: #f6f8fc;
    /* Specificità e priorità restano circoscritte al solo indicatore nativo. */
    color: var(--ds-flow-ink) !important;
    font-size: 0.9375rem !important;
    font-style: normal;
    font-weight: 750;
    line-height: 1 !important;
    box-shadow: none;
}

.ds-commerce-flow[data-ds-commerce-flow] > .ds-commerce-step > :is(a, span) > b .ds-svg-icon {
    width: 1rem;
    height: 1rem;
}

.ds-commerce-flow[data-ds-commerce-flow] > .ds-commerce-step > :is(a, span) > em {
    display: grid;
    place-items: center;
    box-sizing: border-box;
    inline-size: 100%;
    min-inline-size: 0;
    min-block-size: 2.7em;
    max-width: none;
    margin: 0;
    padding: 0;
    overflow: visible;
    color: inherit !important;
    font-size: 0.875rem !important;
    font-style: normal;
    font-weight: 700;
    line-height: 1.35 !important;
    letter-spacing: normal;
    white-space: normal;
    overflow-wrap: anywhere;
    text-overflow: clip;
    text-decoration: none !important;
}

.ds-commerce-flow[data-ds-commerce-flow] > .ds-commerce-step.is-current > :is(a, span) {
    color: var(--ds-flow-current);
}

.ds-commerce-flow[data-ds-commerce-flow] > .ds-commerce-step.is-current > :is(a, span) > b {
    border-color: var(--ds-flow-current);
    background: linear-gradient(135deg, var(--ds-flow-current), var(--ds-flow-blue));
    color: #fff !important;
    box-shadow: 0 4px 12px rgba(67, 56, 202, 0.15);
}

.ds-commerce-flow[data-ds-commerce-flow] > .ds-commerce-step.is-current > :is(a, span) > em {
    font-weight: 750;
}

.ds-commerce-flow[data-ds-commerce-flow] > .ds-commerce-step.is-done > a {
    color: #243247;
}

.ds-commerce-flow[data-ds-commerce-flow] > .ds-commerce-step.is-done > a > b {
    border-color: #cce6dc;
    background: #ecf7f3;
    color: var(--ds-flow-done) !important;
    box-shadow: none;
}

.ds-commerce-flow[data-ds-commerce-flow] > .ds-commerce-step.is-done > a:hover {
    color: var(--ds-flow-current);
}

.ds-commerce-flow[data-ds-commerce-flow] > .ds-commerce-step > a:focus-visible {
    outline: 3px solid var(--ds-flow-current);
    outline-offset: 3px;
}

@media (max-width: 640px) {
    .ds-commerce-flow[data-ds-commerce-flow] {
        --ds-flow-number-size: 1.875rem;
        --ds-flow-gap: 0.375rem;
        --ds-flow-line-clearance: 0.375rem;
        padding: 0.75rem 0.5rem;
        border-radius: 1.125rem;
    }

    .ds-commerce-flow[data-ds-commerce-flow] > .ds-commerce-step > :is(a, span) {
        gap: 0.5rem;
    }

    .ds-commerce-flow[data-ds-commerce-flow] > .ds-commerce-step > :is(a, span) > em {
        font-size: 0.8125rem !important;
    }
}

/* Reflow molto stretto (es. 320 px fisici a zoom 200%): solo la geometria
 * dei numeri si compatta; i testi mantengono 13 px e possono crescere. */
@media (max-width: 240px) {
    .ds-commerce-flow[data-ds-commerce-flow] {
        --ds-flow-number-size: 1.5rem;
        --ds-flow-gap: 0.25rem;
        --ds-flow-line-clearance: 0.125rem;
        padding: 0.5rem 0.25rem;
    }
}

/* Nessun'altezza massima o taglio: con testo/zoom maggiore i tre passi crescono. */
/* Fine indicatore acquisto DamaSoft. */

/* Only the recovery portal's extra wrapper: keep the native totals spacing. */
[data-damasoft-order-meta-recovery] > .wc-block-components-totals-wrapper {
    padding: 0;
    margin: 0;
    border: 0;
}
