/* Field visibility only. The WooCommerce Checkout Block keeps its own UI. */
.wp-block-woocommerce-checkout .skavia-block-email-hidden,
.wp-block-woocommerce-checkout [data-skavia-optional-email="1"]:not([data-skavia-email-open="1"]),
.wp-block-woocommerce-checkout .wc-block-components-address-form__company,
.wp-block-woocommerce-checkout .wc-block-components-address-form__state,
.wp-block-woocommerce-checkout .wc-block-components-address-form__postcode,
.wp-block-woocommerce-checkout [data-skavia-source-phone="1"] {
    display: none !important;
}

.wp-block-woocommerce-checkout .skavia-email-toggle {
    display: inline-flex !important;
    align-items: center !important;
    min-height: 36px !important;
    margin: 0 0 8px !important;
    padding: 0 !important;
    border: 0 !important;
    color: var(--primary-color, #1d6f61) !important;
    background: transparent !important;
    font: inherit !important;
    font-weight: 600 !important;
    cursor: pointer !important;
}

.wp-block-woocommerce-checkout [data-skavia-contact-phone="1"] {
    display: block !important;
    width: 100% !important;
    margin-top: 0 !important;
    margin-bottom: 8px !important;
}

.wp-block-woocommerce-checkout .skavia-email-toggle:hover,
.wp-block-woocommerce-checkout .skavia-email-toggle:focus {
    color: var(--primary-color, #1d6f61);
    text-decoration: underline !important;
}

.wp-block-woocommerce-checkout .skavia-single-country {
    pointer-events: none !important;
    cursor: default !important;
}

/* Remove the compounded WooCommerce + theme gaps between address rows. */
.main-content .wp-block-woocommerce-checkout .wc-block-components-address-form {
    row-gap: 0 !important;
}

.main-content .wp-block-woocommerce-checkout .wc-block-components-address-form > .wc-block-components-text-input {
    margin-top: 0 !important;
    margin-bottom: 8px !important;
}

.main-content .wp-block-woocommerce-checkout .wc-block-components-address-form > .wc-block-components-address-form__address_1 {
    margin-top: 0 !important;
}

/* Keep City before Address 1, and Address 2 directly beneath Address 1. */
.wp-block-woocommerce-checkout .wc-block-components-address-form__city {
    order: 30 !important;
}

.wp-block-woocommerce-checkout .wc-block-components-address-form__address_1 {
    order: 40 !important;
}

.wp-block-woocommerce-checkout .wc-block-components-address-form__address_2,
.wp-block-woocommerce-checkout .wc-block-components-address-form__address_2-toggle,
.wp-block-woocommerce-checkout .wc-block-components-address-form__address_2-hidden-input {
    order: 50 !important;
}

.wp-block-woocommerce-checkout .wc-block-components-country-input {
    margin-left: -8px !important;
    padding: 0 0 10px 8px !important;
    margin-top: 15px !important;
}

.wp-block-woocommerce-checkout .wc-blocks-components-select .wc-blocks-components-select__label {
    background-color: white !important;
    margin-top: -19px !important;
    margin-left: 0 !important;
    transform: translateY(4px) !important;
    display: block !important;
    color: var(--checkout-placeholder-text-color) !important;
    font-style: var(--checkout-placeholder-text-font-style) !important;
    font-weight: var(--checkout-placeholder-font-weight) !important;
    font-size: var(--checkout-placeholder-font-size) !important;
    text-transform: var(--checkout-placeholder-text-transform) !important;
    font-family: var(--checkout-placeholder-text-font-family) !important;
}

/* Final label positions: this file loads after the legacy responsive rules. */
.wp-block-woocommerce-checkout .wc-block-components-form .wc-block-components-text-input > label {
    top: 34px !important;
}

.wp-block-woocommerce-checkout .wc-block-components-text-input.skavia-has-value > label:not(.wc-block-components-address-form__address_1.skavia-has-value > label) {
    margin-top: -37px !important;
}

.wp-block-woocommerce-checkout .wc-block-components-form .wc-block-components-address-form__address_1 > label {
    left: 12px !important;
}

.main-content .wp-block-woocommerce-checkout .wc-block-components-address-form__address_1.skavia-has-value > label {
    background-color: white !important;
    margin-top: -40px !important;
    margin-left: 0 !important;
}

.wp-block-woocommerce-checkout .wc-block-components-form .wc-block-components-address-form__address_2 > label {
    top: 28px !important;
}

.main-content .wp-block-woocommerce-checkout .wc-block-components-address-form__address_2.skavia-has-value > label {
    margin-top: -48px !important;
    margin-left: 0 !important;
}

@media (max-width: 800px) {
    .wp-block-woocommerce-checkout .wc-block-components-text-input.is-active label:not(.wc-block-components-address-form__address_1.is-active label, .wc-block-components-address-form__address_2.is-active label) {
        margin-top: -36px !important;
        margin-left: 0px !important;
        background-color: white !important;
    }

    .main-content .wp-block-woocommerce-checkout .wc-block-components-address-form__address_1.skavia-has-value > label {
        background-color: white !important;
        margin-top: -36px !important;
        margin-left: 2px !important;
    }

    .wp-block-woocommerce-checkout .wc-block-components-form .wc-block-components-address-form__address_2 > label {
        top: 29px !important;
    }

    .wp-block-woocommerce-checkout .wc-block-components-country-input .wc-blocks-components-select__label,
    .wp-block-woocommerce-checkout .wc-block-components-address-form__city.is-active > label,
    .wp-block-woocommerce-checkout .wc-block-components-address-form__city.skavia-has-value > label {
        background-color: white !important;
    }

    .wp-block-woocommerce-checkout #shipping-option,
    .wp-block-woocommerce-checkout #shipping-option .wc-block-components-checkout-step__container,
    .wp-block-woocommerce-checkout #shipping-option .wc-block-components-checkout-step__content,
    .wp-block-woocommerce-checkout #shipping-option .wc-block-components-shipping-rates-control {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
    }

}
