/*
 * My DIY Blinds — Commerce UX Polish v1.0.0
 *
 * Safety rule: do not redefine Woo Blocks' cart grid/flex/column structure.
 * Changes below are limited to individual headings/rows/text plus product-page
 * interaction presentation.
 */

:root {
    --mydiy-plum: #582C4D;
    --mydiy-rose: #A36769;
    --mydiy-blush: #D4B9B2;
    --mydiy-rule: rgba(88, 44, 77, .18);
    --mydiy-muted: #756B70;
}

/* -------------------------------------------------------------------------
   CART — keep the restored native Woo Cart block intact.
   ------------------------------------------------------------------------- */

body.woocommerce-cart .page-header {
    padding-top: 34px !important;
    margin-bottom: 30px !important;
}

body.woocommerce-cart .page-header .entry-title,
body.woocommerce-cart h1.entry-title {
    color: var(--mydiy-plum) !important;
    font-size: 44px !important;
    line-height: 1.08 !important;
    letter-spacing: -0.02em !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
}

/*
 * Hello Elementor gives the saved Cart block `.alignwide`, which moves it
 * exactly 80px outside the normal site-main edge. Move ONLY the title by that
 * same amount. No cart/block geometry is changed.
 */
@media (min-width: 768px) {
    body.woocommerce-cart .page-header .entry-title,
    body.woocommerce-cart h1.entry-title {
        position: relative !important;
        left: -80px !important;
    }
}

/* Match the CART TOTALS title rail to PRODUCT/TOTAL rail height. */
@media (min-width: 768px) {
    body.woocommerce-cart .wc-block-cart__totals-title,
    body.woocommerce-cart .wc-block-components-title.wc-block-cart__totals-title {
        box-sizing: border-box !important;
        height: 56px !important;
        min-height: 56px !important;
        margin: 0 !important;
        padding: 0 !important;
        display: flex !important;
        align-items: center !important;
        border-top: 1px solid var(--mydiy-rule) !important;
        border-bottom: 1px solid var(--mydiy-rule) !important;
        line-height: 1.2 !important;
    }
}

/* The right TOTAL column already gives the useful line total. The price below
 * the product name is redundant and is what made each item look priced twice. */
@media (min-width: 768px) {
    body.woocommerce-cart .wc-block-cart-item__prices {
        display: none !important;
    }
}

/* Add a truthful tax context beneath Estimated total without modifying totals. */
body.woocommerce-cart .wc-block-components-totals-footer-item .wc-block-components-totals-item__label::after,
body.woocommerce-cart .wc-block-cart__totals-footer .wc-block-components-totals-item__label::after {
    display: block;
    margin-top: 4px;
    color: var(--mydiy-muted);
    font-size: 12px;
    font-weight: 400;
    line-height: 1.3;
    letter-spacing: 0;
    text-transform: none;
}
body.woocommerce-cart.mydiy-cart-tax-inclusive .wc-block-components-totals-footer-item .wc-block-components-totals-item__label::after,
body.woocommerce-cart.mydiy-cart-tax-inclusive .wc-block-cart__totals-footer .wc-block-components-totals-item__label::after {
    content: "Includes GST";
}
body.woocommerce-cart.mydiy-cart-tax-exclusive .wc-block-components-totals-footer-item .wc-block-components-totals-item__label::after,
body.woocommerce-cart.mydiy-cart-tax-exclusive .wc-block-cart__totals-footer .wc-block-components-totals-item__label::after {
    content: "GST calculated at checkout";
}

/* -------------------------------------------------------------------------
   CHECKOUT — side cart must not cover/push checkout.
   ------------------------------------------------------------------------- */

body.woocommerce-checkout .xoo-wsc-modal,
body.woocommerce-checkout .xoo-wsc-basket {
    display: none !important;
}

/* -------------------------------------------------------------------------
   SINGLE PRODUCT — small vertical-rhythm correction only.
   ------------------------------------------------------------------------- */

@media (min-width: 768px) {
    body.single-product div.product {
        position: relative;
        margin-top: -24px !important;
    }
}

@media (max-width: 767px) {
    body.single-product div.product {
        position: relative;
        margin-top: -12px !important;
    }
}

/* Static presentation label on Uni CPO's dynamic price display. Uni CPO updates
 * the amount itself; this label never has to be rewritten after calculation. */
body.single-product [id^="uni_cpo_pricedisplay_"]::before,
body.single-product [id*="uni_cpo_pricedisplay_"]::before,
body.single-product .uni-module-dynamic_notice[id*="pricedisplay"]::before {
    content: "YOUR PRICE";
    display: block;
    margin: 0 0 5px;
    color: var(--mydiy-plum);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: .08em;
    text-transform: uppercase;
}

/* Required-options helper placed beside the real Woo/Uni CPO cart controls. */
body.single-product .mydiy-atc-required-note {
    flex: 0 0 100%;
    width: 100%;
    margin: 0 0 10px;
    color: var(--mydiy-plum);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.35;
}

body.single-product .mydiy-atc-proxy {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 52px;
    padding: 12px 24px;
    border: 1px solid var(--mydiy-blush);
    border-radius: 0;
    background: var(--mydiy-blush);
    color: var(--mydiy-plum);
    font: inherit;
    font-weight: 600;
    letter-spacing: .04em;
    text-align: center;
    text-transform: uppercase;
    cursor: pointer;
    transition: background-color .18s ease, color .18s ease, border-color .18s ease;
}
body.single-product .mydiy-atc-proxy:hover,
body.single-product .mydiy-atc-proxy:focus-visible {
    border-color: var(--mydiy-plum);
    background: var(--mydiy-plum);
    color: #fff;
    outline: none;
}

/* Only hide the real button while Uni CPO itself has it disabled. It remains in
 * the DOM with its state untouched; the proxy exists solely so a user can ask
 * the form to show/scroll to the missing required option. */
body.single-product form.cart.mydiy-atc-proxy-active {
    flex-wrap: wrap;
}
body.single-product form.cart.mydiy-atc-proxy-active .single_add_to_cart_button:disabled {
    display: none !important;
}
body.single-product form.cart:not(.mydiy-atc-proxy-active) .mydiy-atc-proxy,
body.single-product form.cart:not(.mydiy-atc-proxy-active) .mydiy-atc-required-note {
    display: none !important;
}

body.single-product .single_add_to_cart_button.mydiy-atc-loading {
    cursor: wait;
    opacity: .82;
}
body.single-product .single_add_to_cart_button.mydiy-atc-added {
    background: var(--mydiy-plum) !important;
    border-color: var(--mydiy-plum) !important;
    color: #fff !important;
}

@media (max-width: 767px) {
    body.woocommerce-cart .page-header {
        padding-top: 24px !important;
        margin-bottom: 22px !important;
    }
    body.woocommerce-cart .page-header .entry-title,
    body.woocommerce-cart h1.entry-title {
        left: auto !important;
        font-size: 36px !important;
        letter-spacing: -0.015em !important;
    }

    body.woocommerce-cart .wc-block-cart__totals-title,
    body.woocommerce-cart .wc-block-components-title.wc-block-cart__totals-title {
        border-top: 1px solid var(--mydiy-rule) !important;
    }

    body.single-product .mydiy-atc-proxy {
        width: 100%;
        min-height: 50px;
    }
}
