.wc-block-components-sidebar {
    width: auto;
    margin-top: 0;
}

.wc-block-checkout-empty {
    display: none;
}

body:has(.wp-block-woocommerce-empty-cart-block) {
    .wp-block-woocommerce-cart-header {
        display: none;
    }
}

.wp-block-woocommerce-empty-cart-block {
    padding-block: var(--wp--preset--spacing--100);

    .wp-block-buttons {
        padding-block-start: var(--wp--preset--spacing--80);
    }
}

.wc-block-cart__empty-cart__title {
    font-size: var(--wp--preset--font-size--x-large);
}

.wc-block-components-totals-wrapper {
    padding-top: 0;
    padding-bottom: 0;
}

.wp-block-woocommerce-checkout {
    margin-top: 0 !important;
    padding-top: 0;
}

:is(
.is-large,
.is-medium,
.is-small,
.is-mobile
) .wc-block-components-form .wc-block-components-checkout-step:after {
    display: none;
}

:is(
.is-large,
.is-medium,
.is-small,
.is-mobile
) .wc-block-checkout__sidebar.is-sticky {
    position: relative !important;
    top: 0 !important;
    margin-bottom: var(--wp--preset--spacing--80);
}

.wc-block-components-checkout-order-summary__content,
.wc-block-checkout__sidebar .wc-block-components-totals-footer-item {
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
}

.wc-block-components-totals-shipping {
    .wc-block-components-totals-item__label {
        flex-grow: 0;
        color: var(--wp--preset--color--accent-5);
        font-size: 16px;
        font-weight: 500;
        line-height: 1;
        padding-right: 5px;

        &::after {
            content: ":";
        }
    }

    .wc-block-components-totals-item__value {
        color: var(--wp--preset--color--contrast);
        font-size: 16px;
        font-weight: 700;
        line-height: 1;
    }

    .wc-block-components-totals-item {
        justify-content: end;

        .wc-block-components-formatted-money-amount {
            color: var(--wp--preset--color--contrast);
            font-size: 16px;
            font-weight: 700;
        }
    }
}

.wp-block-woocommerce-checkout-order-summary-shipping-block {
    @media screen and (max-width: 767px) {
        display: flex;
        justify-content: center;
        margin-block-end: var(--wp--preset--spacing--20);
    }
}

.wp-block-woocommerce-checkout-required-fields-info {
    @media screen and (max-width: 767px) {
        display: flex;
        justify-content: center;
        margin-block-start: var(--wp--preset--spacing--20);
    }
}

.wc-block-components-totals-footer-item {
    align-items: center;
    justify-content: flex-end;
    padding-left: 20px !important;
    padding-right: 0 !important;

    .wc-block-components-totals-item__label {
        color: var(--wp--preset--color--accent-5);
        font-size: 16px;
        font-weight: 600;
        line-height: 1;
        padding-right: 20px;
    }
}

.wc-block-components-form .wc-block-components-text-input.has-error label,
.wc-block-components-text-input.has-error label {
    color: var(--wp--preset--color--contrast);
}

.wc-block-components-totals-footer-item .wc-block-components-totals-item__label::after {
    content: ":";
}

.wp-block-woocommerce-checkout-order-summary-block .wc-block-components-formatted-money-amount,
.wc-block-components-totals-footer-item .wc-block-components-totals-item__value {
    color: var(--wp--preset--color--accent-1);
    font-size: 32px;
    font-weight: 700;
    line-height: 1;
}

.wc-block-components-form .wc-block-components-checkout-step {
    margin-bottom: 0;
}

.wc-block-checkout__payment-method.wp-block-woocommerce-checkout-payment-block.wc-block-components-checkout-step {
    margin-block: 20px;
    padding-block: var(--wp--preset--spacing--40);
    border-top: 1px solid var(--wp--preset--color--accent-4);
    border-bottom: 1px solid var(--wp--preset--color--accent-4);

    .wc-block-components-checkout-step__content {
        padding-top: 0;
    }
}

.wc-block-components-country-input {
    margin-top: 0;
}


/* Remove redundant fields */
#wc-guest-checkout-notice,
#order-notes,
#shipping-option,
/*#payment-method .wc-block-components-radio-control,*/
#shipping-fields .wc-block-components-checkout-step__description,
.wc-block-components-checkout-order-summary__title,
.wc-block-components-totals-item__description,
.wc-block-components-address-form__address_2-toggle,
.wc-block-components-checkout-return-to-cart-button,
.wc-block-components-checkout-step__title,
.wc-block-components-checkout-step__heading,
.wc-block-checkout__create-account,
.wc-block-checkout__contact-fields .wc-block-components-checkout-step__heading,
.wc-block-checkout__contact-fields .wc-block-components-checkout-step__description,
.wp-block-woocommerce-checkout-pickup-options-block,
.wp-block-woocommerce-checkout-order-summary-subtotal-block,
.wp-block-woocommerce-checkout-order-summary-cart-items-block,
.wp-block-woocommerce-checkout-contact-information-block .wc-block-components-checkout-step__heading,
.wp-block-woocommerce-checkout-contact-information-block .wc-block-components-checkout-step__description {
    display: none !important;
}

.wc-block-components-totals-wrapper,
.wp-block-woocommerce-checkout-order-summary-block,
.wp-block-woocommerce-checkout-order-summary-totals-block {
    border: none;
    padding-bottom: 0;
}

.wc-block-components-validation-error {
    color: var(--wp--preset--color--accent-1);
}

:is(
.is-medium,
.is-small,
.is-mobile
).wc-block-components-sidebar-layout .wc-block-checkout__main {
    padding: var(--wp--preset--spacing--80) var(--wp--preset--spacing--20) var(--wp--preset--spacing--60);
}

:is(
.is-large,
.is-medium,
.is-small,
.is-mobile
) .wp-block-woocommerce-checkout-order-summary-block .wc-block-components-checkout-order-summary__content {
    display: flex;
    column-gap: var(--wp--preset--spacing--20);

    @media screen and (max-width: 768px) {
        flex-direction: column;
    }
}

.wp-block-woocommerce-checkout-fields-block {
    padding: var(--wp--preset--spacing--80) var(--wp--preset--spacing--60) var(--wp--preset--spacing--60);
    background-color: #fff;
    border-radius: var(--wp--custom--border-radius--block);
}

.wc-block-components-sidebar-layout.wc-block-checkout {
    display: block;
}

.wc-block-checkout__form {
    margin: 0;
    max-width: 100%;
    gap: var(--wp--preset--spacing--20);
    display: grid;
    grid-template-columns: 1fr;
    grid-template-areas:
        'ship_email'
        'ship_country'
        'ship_first_name'
        'ship_last_name'
        'ship_company'
        'ship_address'
        'ship_city'
        'ship_state'
        'ship_zip'
        'ship_phone'
        'ship_billing'
        'ship_notes'
        'payment'
        'footer'
    ;
}

:has(.wp-block-woocommerce-checkout-billing-address-block) .wc-block-checkout__form {
    grid-template-areas:
        'ship_email'
        'ship_country'
        'ship_first_name'
        'ship_last_name'
        'ship_company'
        'ship_address'
        'ship_city'
        'ship_state'
        'ship_zip'
        'ship_phone'
        'ship_billing'
        'bill_description'
        'bill_country'
        'bill_first_name'
        'bill_last_name'
        'bill_company'
        'bill_address'
        'bill_city'
        'bill_state'
        'bill_zip'
        'bill_phone'
        'ship_notes'
        'payment'
        'footer'
    ;
}

@media screen and (min-width: 1025px) {
    .wc-block-checkout__form {
        grid-template-columns: repeat(2, 1fr);
        grid-template-areas:
            'ship_email ship_country'
            'ship_first_name ship_last_name'
            'ship_company ship_address'
            'ship_city ship_state'
            'ship_zip ship_phone'
            'ship_billing ship_billing'
            'ship_notes ship_notes'
            'payment payment'
            'footer footer'
        ;
        align-items: center;
    }

    :has(.wp-block-woocommerce-checkout-billing-address-block) .wc-block-checkout__form {
        grid-template-areas:
            'ship_email ship_country'
            'ship_first_name ship_last_name'
            'ship_company ship_address'
            'ship_city ship_state'
            'ship_zip ship_phone'
            'ship_billing ship_billing'
            'bill_description bill_description'
            'bill_country bill_country'
            'bill_first_name bill_last_name'
            'bill_company bill_address'
            'bill_city bill_state'
            'bill_zip bill_phone'
            'ship_notes ship_notes'
            'payment payment'
            'footer footer'
        ;
    }
}

@media screen and (min-width: 1280px) {
    .wc-block-checkout__form {
        grid-template-columns: repeat(6, 1fr);
        grid-template-areas:
            'ship_email ship_email ship_email ship_country ship_country ship_country'
            'ship_first_name ship_first_name ship_last_name ship_last_name ship_company ship_company'
            'ship_address ship_address ship_city ship_city ship_state ship_state'
            'ship_zip ship_zip ship_phone ship_phone ship_billing ship_billing'
            'ship_notes ship_notes ship_notes ship_notes ship_notes ship_notes'
            'payment payment payment payment payment payment'
            'footer footer footer footer footer footer'
        ;
    }

    :has(.wp-block-woocommerce-checkout-billing-address-block) .wc-block-checkout__form {
        grid-template-areas:
            'ship_email ship_email ship_email ship_country ship_country ship_country'
            'ship_first_name ship_first_name ship_last_name ship_last_name ship_company ship_company'
            'ship_address ship_address ship_city ship_city ship_state ship_state'
            'ship_zip ship_zip ship_phone ship_phone ship_billing ship_billing'
            'bill_description bill_description bill_description bill_description bill_description bill_description'
            'bill_country bill_country bill_first_name bill_first_name bill_last_name bill_last_name'
            'bill_company bill_company bill_address bill_address bill_city bill_city'
            'bill_state bill_state bill_zip bill_zip bill_phone bill_phone'
            'ship_notes ship_notes ship_notes ship_notes ship_notes ship_notes'
            'payment payment payment payment payment payment'
            'footer footer footer footer footer footer'
        ;
    }
}

:where(
.wc-block-checkout__contact-fields,
.wc-block-checkout__shipping-fields,
.wc-block-checkout__billing-fields
) {
    &.wc-block-components-checkout-step {
        display: contents !important;
    }

    :is(
        .wc-block-components-checkout-step,
        .wc-block-components-checkout-step__container,
        .wc-block-components-checkout-step__content,
        .wc-block-components-address-address-wrapper,
        .wc-block-components-address-form-wrapper,
        .wc-block-components-address-form,
        .wp-block-woocommerce-checkout-shipping-address-block
    ) {
        display: contents !important;
    }
}



:where(
.wc-block-components-form,
.wc-block-checkout__form
) :is(
.wc-block-components-checkout-step__content > div:empty,
.wc-block-components-form > div:empty,
fieldset:empty
) {
    display: none;
}

.wc-block-components-notices {
    display: none;
}

.wc-block-components-notice-banner {
    display: none;
}

.wp-block-woocommerce-checkout-order-summary-block.checkout-order-summary-block-fill-wrapper {
    display: none;
}

.wc-block-components-address-form__email { grid-area: ship_email; }

#shipping {
    grid-template-columns: subgrid;

    .wc-blocks-components-select__container label {
        display: none;
    }

    .wc-block-components-address-form__country { grid-area: ship_country; }
    .wc-block-components-address-form__first_name { grid-area: ship_first_name; }
    .wc-block-components-address-form__last_name { grid-area: ship_last_name; }
    .wc-block-components-address-form__company { grid-area: ship_company; }
    .wc-block-components-address-form__phone { grid-area: ship_phone; }
    .wc-block-components-address-form__address_1 { grid-area: ship_address; }
    .wc-block-components-address-form__city { grid-area: ship_city; }
    .wc-block-components-address-form__state { grid-area: ship_state; }
    .wc-block-components-address-form__postcode { grid-area: ship_zip; }
}

.wc-block-components-checkout-step__description { grid-area: bill_description; }
.wc-block-checkout__order-notes { grid-area: ship_notes; }
.wc-block-checkout__use-address-for-billing { grid-area: ship_billing; }
.wp-block-woocommerce-checkout-payment-block { grid-area: payment; }
.wp-block-woocommerce-checkout-footer { grid-area: footer; }
.google-recaptcha-info { grid-area: ship_notes; }

#billing {
    grid-template-columns: subgrid;

    .wc-blocks-components-select__container label {
        display: none;
    }

    .wc-block-components-address-form__country { grid-area: bill_country; }
    .wc-block-components-address-form__first_name { grid-area: bill_first_name; }
    .wc-block-components-address-form__last_name { grid-area: bill_last_name; }
    .wc-block-components-address-form__company { grid-area: bill_company; }
    .wc-block-components-address-form__phone { grid-area: bill_phone; }
    .wc-block-components-address-form__address_1 { grid-area: bill_address; }
    .wc-block-components-address-form__city { grid-area: bill_city; }
    .wc-block-components-address-form__state { grid-area: bill_state; }
    .wc-block-components-address-form__postcode { grid-area: bill_zip; }
}

.wc-block-checkout__use-address-for-billing {
    margin-top: 0;

    .wc-block-components-checkbox__mark,
    .wc-block-components-checkbox__input
    {
        display: none;
    }

    .wc-block-components-checkbox__label {
        --link--color: var(--wp--preset--color--accent-1);

        content: "<span class=\"wp-block-button is-style-button-link\"><span class=\"wp-element-button\">Explore How it Works</span></span>";
        padding-inline-start: 20px;

        &:hover {
            --link--color: var(--wp--preset--color--accent-2);
        }
    }
}

.wc-block-components-checkout-step__description {
    margin-block: 20px 0;
    padding-block: var(--wp--preset--spacing--40) 0;
    border-top: 1px solid var(--wp--preset--color--accent-4);
}

.wp-block-woocommerce-checkout-payment-block {
    .wc-blocks-components-select {
        margin-top: 0;
    }

    .wc-blocks-components-select__container {
        display: grid;
        gap: var(--wp--preset--spacing--20);
        align-items: center;
    }

    label {
        color: var(--wp--preset--color--accent-5);
        font-size: var(--wp--preset--font-size--x-small) !important;
        font-weight: 500;
    }
}

.wp-block-woocommerce-checkout-footer {
    display: flex;
    gap: 20px;
    justify-content: space-between;
    align-items: center;
}

.wc-block-checkout__actions {
    padding: 0;
}

@media screen and (min-width: 768px) {
    .wp-block-woocommerce-checkout-footer {
        gap: 40px;
    }
}

@media screen and (max-width: 1023px) {
    .wp-block-woocommerce-checkout-footer {
        flex-direction: column;
    }
}

@media screen and (min-width: 1024px) {
    .wp-block-woocommerce-checkout-contact-information-block {
        display: grid;
        grid-template-columns: subgrid;
        grid-column-start: 1;
        grid-column-end: 2;
        grid-row-start: 1;
        grid-row-end: 2;
    }

    .wp-block-woocommerce-checkout-billing-address-block,
    .wp-block-woocommerce-checkout-payment-block {
        display: grid;
        /*grid-column-start: 1;*/
        /*grid-column-end: 3;*/
        grid-template-columns: subgrid;
    }

    .wp-block-woocommerce-checkout-payment-block {
        .wc-block-components-checkout-step__container {
            grid-column: span 6;
        }

        .wc-blocks-components-select__container {
            grid-template-columns: 1fr 1fr;
        }
    }

    .wp-block-woocommerce-checkout-footer {
        .wp-block-woocommerce-checkout-order-summary-shipping-block {
            margin-inline-start: auto;
        }
    }

    .wp-block-woocommerce-checkout-required-fields-info { order: 1 }
    .wp-block-woocommerce-checkout-order-summary-shipping-block { order: 2 }
    .wp-block-woocommerce-checkout-actions-block { order: 3 }
}

@media screen and (min-width: 1280px) {
    .wp-block-woocommerce-checkout-billing-address-block,
    .wp-block-woocommerce-checkout-payment-block {
        /*grid-column-end: 4;*/
    }

    .wp-block-woocommerce-checkout-payment-block {
        .wc-blocks-components-select__container {
            grid-template-columns: 1fr 2fr;
        }
    }
}

.wp-block-woocommerce-checkout-required-fields-info {
    color: var(--wp--preset--color--accent-5);
    font-size: var(--wp--preset--font-size--x-small);
    font-weight: 500;
}

.wp-block-woocommerce-checkout-actions-block .wc-block-checkout__actions_row .wc-block-components-checkout-place-order-button--full-width {
    --link--color: #ffffff;
    --button--background: var(--wp--preset--color--accent-1);
    --arrow--width: 2px;
    --arrow--length: 40px;
    --arrow--height: 10px;
    --arrow--offset--x: 0;
    --arrow--offset--y: calc(-50% + 1px);
    --arrow--padding-inline-end: 87px;

    position: relative;
    min-height: 18px;
    padding: var(--wp--preset--spacing--20) var(--wp--preset--spacing--60);
    padding-inline-end: 115px;
    color: var(--link--color);
    background-color: var(--button--background);
    transition-property: background-color;
    transition-duration: var(--transition--duration);
    transition-timing-function: var(--transition--timing-function);

    &::before,
    &::after {
        --arrow--offset--x: -60px;

        content: '';
        display: block;
        position: absolute;
        top: calc(50% - 1px);
        right: 2px;
        border-style: solid;
        border-color: var(--link--color, rgba(0,0,0,0.5));
        transition-property: border-color, translate, scale;
        transition-duration: var(--transition--duration);
        transition-timing-function: var(--transition--timing-function);
    }

    &::before {
        width: var(--arrow--length, 40px);
        height: 0;
        border-width: var(--arrow--width, 2px) 0 0 0;
        transform-origin: 0% 50%;
        scale: var(--arrow--length--scale, 1) 1;
        translate: var(--arrow--offset--x, 0) var(--arrow--offset--y, -50%);
    }

    &::after {
        width: var(--arrow--height, 10px);
        height: var(--arrow--height, 10px);
        border-width: var(--arrow--width, 2px) var(--arrow--width, 2px) 0 0;
        transform-origin: 50% 50%;
        translate: var(--arrow--offset--x, 0) var(--arrow--offset--y, -50%);
        rotate: 45deg;
    }

    &:hover {
        --button--background: #000000;

        &::before {
            --arrow--length--scale: 1.25;
        }

        &::after {
            --arrow--offset--x: -50px;
        }
    }
}

.wp-block-woocommerce-checkout-actions-block .wc-block-checkout__actions_row .wc-block-components-checkout-place-order-button .wc-block-components-checkout-place-order-button__separator {
    margin: 0 5px 0 0;
}

.wc-block-components-sidebar-layout .wc-block-components-main {
    width: 100%;
    margin-block-start: var(--wp--preset--spacing--40);
}

:has(> .wc-blocks-components-select) {
    height: 100%;
}

.wc-block-components-state-input {
    .wc-blocks-components-select {
        margin-top: 0;

        select {
            line-height: 1.5;
        }
    }
}

.wc-blocks-components-select {
    height: 100%;

    .wc-blocks-components-select__container {
        height: 100%;

        select {
            padding: 20px 40px;
            font-size: 17px;
            border: 1px solid var(--wp--preset--color--accent-4);
            border-radius: var(--wp--custom--border-radius--button);
        }

        label {
            padding: 0;
        }
    }
}

.wc-block-components-form .wc-block-components-text-input input:-webkit-autofill,
.wc-block-components-form .wc-block-components-text-input.is-active input,
.wc-block-components-text-input input:-webkit-autofill,
.wc-block-components-text-input.is-active input {
    border: 1px solid var(--wp--preset--color--accent-2);
    outline: 1px solid var(--wp--preset--color--accent-2);
}

.wc-block-components-form .wc-block-components-text-input label,
.wc-block-components-text-input label {
    top: 34px;
    left: 20px;
    transform: translateY(-50%);
    padding: 0 20px;
    font-size: 17px;
    line-height: 1;
    background-color: #fff;
}

.wc-block-components-form .wc-block-components-text-input input:-webkit-autofill+label,
.wc-block-components-form .wc-block-components-text-input.is-active label,
.wc-block-components-text-input input:-webkit-autofill+label,
.wc-block-components-text-input.is-active label {
    display: none;
}

.wc-block-components-validation-error {
    display: none;
}

.wc-block-components-radio-control--highlight-checked {
    display: inline-block;
}

.wc-block-checkout__terms,
.wp-block-woocommerce-checkout-terms-block {
    grid-column-start: 1;
    grid-column-end: 3;
    padding-right: var(--wp--preset--spacing--40);
    font-size: 17px;
}

@media screen and (min-width: 1025px) {
    .wp-block-woocommerce-checkout-payment-block .wc-blocks-components-select .wc-blocks-components-select__container {
        label {
            padding-left: 40px;
        }
    }
}
