/**
 * All Flooring Square Footage Calculator — storefront styles.
 *
 * Deliberately neutral: inherits Avada's typography and colours rather than
 * imposing the Magento look. Sits stacked directly above the add-to-cart
 * button and collapses to a single column on narrow screens.
 */

.afsc-calculator {
    margin: 0 0 1.25em;
    padding: 1em;
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 3px;
    background: rgba(0, 0, 0, 0.02);
    max-width: 30em;
}

.afsc-calculator__field {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5em;
}

.afsc-calculator__label {
    font-weight: 600;
    margin: 0;
}

.afsc-calculator__input {
    width: 8em;
    max-width: 100%;
    margin: 0;
    padding: 0.4em 0.6em;
    line-height: 1.4;
}

/* Strip the spinner arrows — they invite click-stepping a decimal area. */
.afsc-calculator__input::-webkit-outer-spin-button,
.afsc-calculator__input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.afsc-calculator__input[type='number'] {
    -moz-appearance: textfield;
    appearance: textfield;
}

/**
 * The minimum note is informational, not a validation error: an empty field is
 * a legitimate order of the product minimum. Muted, never red.
 */
.afsc-calculator__note {
    margin: 0.6em 0 0;
    font-size: 0.9em;
    font-style: italic;
    opacity: 0.75;
}

.afsc-calculator__note[hidden] {
    display: none;
}

.afsc-calculator__readout {
    margin: 0.85em 0 0;
    padding: 0.85em 0 0;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.afsc-calculator__row {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.5em;
    margin: 0 0 0.4em;
}

.afsc-calculator__row:last-child {
    margin-bottom: 0;
}

.afsc-calculator__row dt {
    margin: 0;
    font-weight: 600;
}

.afsc-calculator__row dd {
    margin: 0;
    text-align: right;
}

.afsc-calculator__row--total {
    padding-top: 0.4em;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    font-size: 1.05em;
}

.afsc-calculator__row--total dd {
    font-weight: 700;
}

/**
 * The native quantity field is driven by the calculator, so showing it would
 * offer the customer a second, contradictory control. Hide it visually while
 * leaving it in the accessibility tree and in the submitted form data.
 *
 * `body.afsc-has-calculator` is printed by PHP, so the field is hidden on the
 * first paint rather than flashing until JavaScript adds its own class. The
 * `--synced` class remains as the JS-side belt to the PHP braces.
 */
body.afsc-has-calculator form.cart .quantity,
.quantity.afsc-quantity--synced {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    white-space: nowrap;
    border: 0;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
}

@media (max-width: 480px) {
    .afsc-calculator__field {
        flex-direction: column;
        align-items: stretch;
    }

    .afsc-calculator__input {
        width: 100%;
    }

    .afsc-calculator__row {
        flex-direction: column;
    }

    .afsc-calculator__row dd {
        text-align: left;
    }
}
