/*
 * Cosmo Pharm V33 commerce polish.
 * Final visual repair layer for Cart, Checkout, order pages and footer language control.
 * Loaded after V32 so it can correct legacy WooCommerce/Astra rules without touching commerce logic.
 */

body.cp-commerce-v32{
    --cp33-ink:#173d2d;
    --cp33-ink-2:#28583f;
    --cp33-gold:#b79a58;
    --cp33-gold-soft:#d8bd7a;
    --cp33-paper:#faf8f3;
    --cp33-paper-2:#f4f1ea;
    --cp33-line:#dfe5e1;
    --cp33-text:#555e59;
    --cp33-muted:#7a827e;
    --cp33-white:#fff;
}

/* =========================================================
   GLOBAL COMMERCE LANGUAGE
   ========================================================= */
body.cp-commerce-v32 .cp-v32-commerce-page{
    overflow:visible !important;
}

body.cp-commerce-v32 .woocommerce a,
body.cp-commerce-v32 .woocommerce a:visited{
    color:var(--cp33-ink-2);
}
body.cp-commerce-v32 .woocommerce a:hover,
body.cp-commerce-v32 .woocommerce a:focus{
    color:var(--cp33-gold);
}

/* V32 intentionally used a temporary red commerce accent. V33 returns the
   transaction path to the approved Cosmo Pharm green/gold system. */
body.cp-commerce-v32 .woocommerce a.button,
body.cp-commerce-v32 .woocommerce button.button,
body.cp-commerce-v32 .woocommerce input.button,
body.cp-commerce-v32 .wc-block-components-button{
    border-color:var(--cp33-ink) !important;
    background:var(--cp33-ink) !important;
    color:#fff !important;
}
body.cp-commerce-v32 .woocommerce a.button:hover,
body.cp-commerce-v32 .woocommerce button.button:hover,
body.cp-commerce-v32 .woocommerce input.button:hover,
body.cp-commerce-v32 .wc-block-components-button:hover{
    border-color:var(--cp33-gold) !important;
    background:var(--cp33-gold) !important;
    color:var(--cp33-ink) !important;
}

/* =========================================================
   CART, DESKTOP / TABLET
   ========================================================= */
body.cp-commerce-v32-cart .woocommerce-cart-form,
body.cp-commerce-v32-cart .woocommerce-cart-form table.shop_table,
body.cp-commerce-v32-cart .woocommerce-cart-form table.shop_table tbody,
body.cp-commerce-v32-cart .woocommerce-cart-form table.shop_table tr,
body.cp-commerce-v32-cart .woocommerce-cart-form table.shop_table td{
    min-width:0 !important;
    box-sizing:border-box !important;
}

body.cp-commerce-v32-cart .woocommerce-cart-form table.shop_table{
    overflow:visible !important;
}

body.cp-commerce-v32-cart .woocommerce-cart-form td.product-name{
    min-width:0 !important;
    overflow:hidden !important;
    text-align:left !important;
}
body.cp-commerce-v32-cart .woocommerce-cart-form td.product-name a,
body.cp-commerce-v32-cart .woocommerce-cart-form td.product-name span{
    display:block !important;
    width:100% !important;
    max-width:100% !important;
    overflow-wrap:anywhere !important;
    word-break:normal !important;
}

body.cp-commerce-v32-cart td.product-price,
body.cp-commerce-v32-cart td.product-subtotal,
body.cp-commerce-v32-cart .cart_totals .order-total th,
body.cp-commerce-v32-cart .cart_totals .order-total td,
body.cp-commerce-v32-cart .cart_totals .order-total .amount{
    color:var(--cp33-ink) !important;
}

body.cp-commerce-v32-cart .cart_totals{
    border-color:var(--cp33-line) !important;
    background:var(--cp33-paper) !important;
    box-shadow:none !important;
}
body.cp-commerce-v32-cart .cart_totals h2{
    margin:0 0 18px !important;
    padding:0 !important;
    border:0 !important;
    background:transparent !important;
    color:var(--cp33-ink) !important;
}
body.cp-commerce-v32-cart .cart_totals table.shop_table,
body.cp-commerce-v32-cart .cart_totals table.shop_table tbody,
body.cp-commerce-v32-cart .cart_totals table.shop_table tr,
body.cp-commerce-v32-cart .cart_totals table.shop_table th,
body.cp-commerce-v32-cart .cart_totals table.shop_table td{
    background:transparent !important;
}
body.cp-commerce-v32-cart .cart_totals table.shop_table td{
    overflow-wrap:anywhere !important;
}

body.cp-commerce-v32-cart .wc-proceed-to-checkout a.checkout-button,
body.cp-commerce-v32-cart .wc-block-cart__submit-button{
    border-color:var(--cp33-ink) !important;
    background:var(--cp33-ink) !important;
    color:#fff !important;
}
body.cp-commerce-v32-cart .wc-proceed-to-checkout a.checkout-button:hover,
body.cp-commerce-v32-cart .wc-block-cart__submit-button:hover{
    border-color:var(--cp33-gold) !important;
    background:var(--cp33-gold) !important;
    color:var(--cp33-ink) !important;
}

body.cp-commerce-v32-cart .coupon button,
body.cp-commerce-v32-cart .coupon .button{
    white-space:nowrap !important;
}

/* Cross-sells remain a restrained desktop-only discovery strip. */
body.cp-commerce-v32-cart .cross-sells{
    clear:both !important;
    overflow:visible !important;
}
body.cp-commerce-v32-cart .cross-sells > h2{
    padding:0 !important;
    background:transparent !important;
}
body.cp-commerce-v32-cart .cross-sells ul.products li.product{
    min-width:0 !important;
    overflow:hidden !important;
}
body.cp-commerce-v32-cart .cross-sells ul.products li.product .star-rating{
    display:none !important;
}
body.cp-commerce-v32-cart .cross-sells ul.products li.product .woocommerce-loop-product__title,
body.cp-commerce-v32-cart .cross-sells ul.products li.product h2,
body.cp-commerce-v32-cart .cross-sells ul.products li.product h3{
    display:-webkit-box !important;
    min-height:0 !important;
    max-height:68px !important;
    overflow:hidden !important;
    -webkit-box-orient:vertical !important;
    -webkit-line-clamp:3 !important;
    overflow-wrap:anywhere !important;
}
body.cp-commerce-v32-cart .cross-sells ul.products li.product .price,
body.cp-commerce-v32-cart .cross-sells ul.products li.product .price .amount{
    color:var(--cp33-ink) !important;
}
body.cp-commerce-v32-cart .cross-sells ul.products li.product .button{
    border-color:var(--cp33-ink) !important;
    background:var(--cp33-ink) !important;
    color:#fff !important;
}

/* =========================================================
   CHECKOUT, DESKTOP / TABLET
   ========================================================= */
body.cp-commerce-v32-checkout form.checkout.woocommerce-checkout,
body.cp-commerce-v32-checkout #customer_details,
body.cp-commerce-v32-checkout #order_review,
body.cp-commerce-v32-checkout #order_review table.shop_table{
    min-width:0 !important;
    box-sizing:border-box !important;
}

body.cp-commerce-v32-checkout #order_review{
    border-color:var(--cp33-line) !important;
    background:var(--cp33-paper) !important;
    box-shadow:none !important;
}
body.cp-commerce-v32-checkout #order_review table.shop_table th,
body.cp-commerce-v32-checkout #order_review table.shop_table td{
    overflow-wrap:anywhere !important;
}
body.cp-commerce-v32-checkout #order_review table.shop_table .amount,
body.cp-commerce-v32-checkout #order_review .order-total th,
body.cp-commerce-v32-checkout #order_review .order-total td,
body.cp-commerce-v32-checkout #order_review .order-total .amount{
    color:var(--cp33-ink) !important;
}

body.cp-commerce-v32-checkout #payment{
    color:var(--cp33-text) !important;
}
body.cp-commerce-v32-checkout #payment div.payment_box{
    border-color:var(--cp33-line) !important;
    background:#fff !important;
}
body.cp-commerce-v32-checkout #payment a,
body.cp-commerce-v32-checkout .woocommerce-privacy-policy-link,
body.cp-commerce-v32-checkout .woocommerce-terms-and-conditions-link{
    color:var(--cp33-ink-2) !important;
    text-decoration:underline !important;
    text-underline-offset:2px !important;
}

/* Terms checkbox: predictable alignment instead of a floating Woo checkbox. */
body.cp-commerce-v32-checkout #payment .woocommerce-form__label-for-checkbox,
body.cp-commerce-v32-checkout #payment label.checkbox{
    display:grid !important;
    grid-template-columns:22px minmax(0,1fr) !important;
    gap:11px !important;
    align-items:start !important;
    width:100% !important;
    margin:0 !important;
    color:var(--cp33-ink) !important;
    font:600 13px/1.55 Arial,sans-serif !important;
}
body.cp-commerce-v32-checkout #payment .woocommerce-form__label-for-checkbox input[type="checkbox"],
body.cp-commerce-v32-checkout #payment label.checkbox input[type="checkbox"]{
    grid-column:1 !important;
    width:20px !important;
    min-width:20px !important;
    height:20px !important;
    margin:2px 0 0 !important;
    accent-color:var(--cp33-ink) !important;
}
body.cp-commerce-v32-checkout #payment .woocommerce-form__label-for-checkbox span,
body.cp-commerce-v32-checkout #payment label.checkbox span{
    grid-column:2 !important;
    min-width:0 !important;
}

body.cp-commerce-v32-checkout #place_order,
body.cp-commerce-v32-checkout .wc-block-components-button.wc-block-components-checkout-place-order-button{
    border-color:var(--cp33-ink) !important;
    background:var(--cp33-ink) !important;
    color:#fff !important;
}
body.cp-commerce-v32-checkout #place_order:hover,
body.cp-commerce-v32-checkout .wc-block-components-button.wc-block-components-checkout-place-order-button:hover{
    border-color:var(--cp33-gold) !important;
    background:var(--cp33-gold) !important;
    color:var(--cp33-ink) !important;
}

/* Some checkout extensions inject a plain “Back to Cart” link. */
body.cp-commerce-v32-checkout .cp-v32-commerce-content a[href*="/cart"],
body.cp-commerce-v32-checkout .cp-v32-commerce-content a[href*="cart/"]{
    color:var(--cp33-ink-2) !important;
    font-weight:600 !important;
    text-decoration:none !important;
}

/* =========================================================
   ORDER RECEIVED / ORDER PAY
   ========================================================= */
body.cp-commerce-v32-order-received .woocommerce .amount,
body.cp-commerce-v32-order-pay .woocommerce .amount{
    color:var(--cp33-ink) !important;
}
body.cp-commerce-v32-order-received .cp-v32-continue-shopping,
body.cp-commerce-v32-order-pay .woocommerce #place_order{
    border-color:var(--cp33-ink) !important;
    background:var(--cp33-ink) !important;
    color:#fff !important;
}

/* =========================================================
   FOOTER LANGUAGE CONTROL
   The native Weglot control stays functional. V33 only guarantees that one
   current-language name is visible after older repair layers have run.
   ========================================================= */
body.cp-global-shell .cp-footer-language .cp-v20-language-text,
body.cp-global-shell .cp-footer-language .cp-v19-language-label,
body.cp-global-shell .cp-footer-language .cp-v18-language-label,
body.cp-global-shell .cp-footer-language .cp-language-current-label,
body.cp-global-shell .cp-footer-language [data-cp-language-label]{
    display:none !important;
}
body.cp-global-shell .cp-footer-language .cp-v33-language-name{
    display:inline !important;
    flex:0 1 auto !important;
    min-width:0 !important;
    overflow:hidden !important;
    color:#173d2d !important;
    font:500 14px/1.2 Arial,sans-serif !important;
    white-space:nowrap !important;
    text-overflow:ellipsis !important;
}

/* =========================================================
   RESPONSIVE COMMERCE
   ========================================================= */
@media (max-width:860px){
    body.cp-commerce-v32-cart .cart_totals{
        width:100% !important;
        max-width:none !important;
    }
    body.cp-commerce-v32-checkout #order_review{
        width:100% !important;
        max-width:none !important;
    }
}

@media (max-width:767px){
    /* Commerce pages are tasks. Keep the editorial hero but remove wasted height. */
    body.cp-commerce-v32 .cp-v32-commerce-hero{
        padding:28px 0 26px !important;
    }
    body.cp-commerce-v32 .cp-v32-commerce-hero h1{
        font-size:34px !important;
        line-height:1.02 !important;
    }
    body.cp-commerce-v32 .cp-v32-commerce-intro{
        margin-top:10px !important;
        font-size:14px !important;
        line-height:1.5 !important;
    }
    body.cp-commerce-v32 .cp-v32-commerce-main{
        padding:28px 0 54px !important;
    }

    /* ---------------- CART ITEM CARD ---------------- */
    body.cp-commerce-v32-cart .woocommerce-cart-form table.shop_table,
    body.cp-commerce-v32-cart .woocommerce-cart-form table.shop_table tbody{
        display:block !important;
        width:100% !important;
        margin:0 !important;
        padding:0 !important;
    }
    body.cp-commerce-v32-cart .woocommerce-cart-form table.shop_table thead{
        display:none !important;
    }
    body.cp-commerce-v32-cart .woocommerce-cart-form table.shop_table tr.cart_item{
        position:relative !important;
        display:grid !important;
        grid-template-columns:88px minmax(0,1fr) !important;
        grid-template-rows:auto auto auto !important;
        column-gap:16px !important;
        row-gap:8px !important;
        width:100% !important;
        min-width:0 !important;
        margin:0 !important;
        padding:18px 0 20px !important;
        border:0 !important;
        border-bottom:1px solid var(--cp33-line) !important;
        background:#fff !important;
    }
    body.cp-commerce-v32-cart .woocommerce-cart-form table.shop_table tr.cart_item > td{
        display:block !important;
        width:auto !important;
        max-width:100% !important;
        min-width:0 !important;
        height:auto !important;
        margin:0 !important;
        padding:0 !important;
        float:none !important;
        clear:none !important;
        border:0 !important;
        background:transparent !important;
        text-align:left !important;
        box-sizing:border-box !important;
    }
    body.cp-commerce-v32-cart .woocommerce-cart-form td.product-thumbnail{
        grid-column:1 !important;
        grid-row:1 / span 3 !important;
        align-self:start !important;
    }
    body.cp-commerce-v32-cart .woocommerce-cart-form td.product-thumbnail a{
        display:block !important;
        width:88px !important;
        max-width:88px !important;
    }
    body.cp-commerce-v32-cart .woocommerce-cart-form td.product-thumbnail img{
        display:block !important;
        width:88px !important;
        max-width:88px !important;
        height:106px !important;
        margin:0 !important;
        padding:7px !important;
        object-fit:contain !important;
        background:#f7f7f5 !important;
    }
    body.cp-commerce-v32-cart .woocommerce-cart-form td.product-name{
        grid-column:2 !important;
        grid-row:1 !important;
        padding-right:34px !important;
        overflow:hidden !important;
    }
    body.cp-commerce-v32-cart .woocommerce-cart-form td.product-name a,
    body.cp-commerce-v32-cart .woocommerce-cart-form td.product-name span{
        display:-webkit-box !important;
        width:100% !important;
        max-width:100% !important;
        max-height:67px !important;
        overflow:hidden !important;
        color:var(--cp33-ink) !important;
        font:400 18px/1.23 Georgia,"Times New Roman",serif !important;
        -webkit-box-orient:vertical !important;
        -webkit-line-clamp:3 !important;
        overflow-wrap:anywhere !important;
    }

    /* Unit price duplicates the subtotal on mobile and was visually noisy. */
    body.cp-commerce-v32-cart .woocommerce-cart-form td.product-price{
        display:none !important;
    }
    body.cp-commerce-v32-cart .woocommerce-cart-form td.product-quantity{
        grid-column:2 !important;
        grid-row:2 !important;
        align-self:center !important;
    }
    body.cp-commerce-v32-cart .woocommerce-cart-form td.product-subtotal{
        grid-column:2 !important;
        grid-row:3 !important;
        display:flex !important;
        align-items:baseline !important;
        gap:8px !important;
        color:var(--cp33-ink) !important;
        font:700 15px/1.3 Arial,sans-serif !important;
        white-space:normal !important;
    }
    body.cp-commerce-v32-cart .woocommerce-cart-form td.product-subtotal::before{
        content:"Subtotal" !important;
        display:inline !important;
        float:none !important;
        color:var(--cp33-gold) !important;
        font:700 10px/1.2 Arial,sans-serif !important;
        letter-spacing:.11em !important;
        text-transform:uppercase !important;
    }
    body.cp-commerce-v32-cart .woocommerce-cart-form td.product-name::before,
    body.cp-commerce-v32-cart .woocommerce-cart-form td.product-price::before,
    body.cp-commerce-v32-cart .woocommerce-cart-form td.product-quantity::before{
        display:none !important;
        content:none !important;
    }
    body.cp-commerce-v32-cart .woocommerce-cart-form td.product-remove{
        position:absolute !important;
        z-index:3 !important;
        top:16px !important;
        right:0 !important;
        width:28px !important;
        max-width:28px !important;
        height:28px !important;
        padding:0 !important;
    }
    body.cp-commerce-v32-cart td.product-remove a.remove{
        width:28px !important;
        height:28px !important;
        border-color:#d5dcd8 !important;
        color:#78817c !important;
    }
    body.cp-commerce-v32-cart .quantity{
        display:inline-grid !important;
        grid-template-columns:34px 48px 34px !important;
        width:auto !important;
        max-width:116px !important;
    }
    body.cp-commerce-v32-cart .quantity .minus,
    body.cp-commerce-v32-cart .quantity .plus,
    body.cp-commerce-v32-cart .quantity .qty{
        height:40px !important;
        min-height:40px !important;
        font-size:14px !important;
    }

    /* Actions sit beneath the product cards, not inside their grid. */
    body.cp-commerce-v32-cart .woocommerce-cart-form table.shop_table tr:not(.cart_item),
    body.cp-commerce-v32-cart .woocommerce-cart-form table.shop_table td.actions{
        display:block !important;
        width:100% !important;
        max-width:none !important;
    }
    body.cp-commerce-v32-cart .woocommerce-cart-form td.actions{
        padding:18px 0 0 !important;
    }
    body.cp-commerce-v32-cart .coupon{
        display:grid !important;
        grid-template-columns:minmax(0,1fr) auto !important;
        gap:8px !important;
        width:100% !important;
    }
    body.cp-commerce-v32-cart .coupon #coupon_code{
        width:100% !important;
        min-width:0 !important;
    }
    body.cp-commerce-v32-cart .woocommerce-cart-form td.actions > button.button,
    body.cp-commerce-v32-cart .woocommerce-cart-form td.actions > input.button{
        width:100% !important;
        margin-top:10px !important;
    }

    body.cp-commerce-v32-cart .cart_totals{
        margin-top:28px !important;
        padding:20px 18px !important;
    }
    body.cp-commerce-v32-cart .cart_totals h2{
        font-size:26px !important;
    }
    body.cp-commerce-v32-cart .cart_totals table.shop_table th{
        width:33% !important;
        padding-right:10px !important;
        font-size:12px !important;
    }
    body.cp-commerce-v32-cart .cart_totals table.shop_table td{
        font-size:13px !important;
    }
    body.cp-commerce-v32-cart .wc-proceed-to-checkout a.checkout-button{
        min-height:54px !important;
        padding:15px 14px !important;
        font-size:13px !important;
        line-height:1.2 !important;
        white-space:normal !important;
        text-align:center !important;
    }

    /* Mobile cart must finish the purchase task, not open another product wall. */
    body.cp-commerce-v32-cart .cross-sells{
        display:none !important;
    }

    /* ---------------- CHECKOUT ---------------- */
    body.cp-commerce-v32-checkout #customer_details .col-2{
        margin-top:30px !important;
    }
    body.cp-commerce-v32-checkout #order_review_heading{
        margin-top:34px !important;
        margin-bottom:14px !important;
    }
    body.cp-commerce-v32-checkout #order_review{
        padding:20px 16px !important;
    }
    body.cp-commerce-v32-checkout #order_review table.shop_table th,
    body.cp-commerce-v32-checkout #order_review table.shop_table td{
        padding:11px 0 !important;
        font-size:13px !important;
        line-height:1.4 !important;
    }
    body.cp-commerce-v32-checkout #order_review table.shop_table th.product-name,
    body.cp-commerce-v32-checkout #order_review table.shop_table td.product-name{
        width:62% !important;
        padding-right:10px !important;
    }
    body.cp-commerce-v32-checkout #order_review table.shop_table th.product-total,
    body.cp-commerce-v32-checkout #order_review table.shop_table td.product-total{
        width:38% !important;
    }
    body.cp-commerce-v32-checkout #payment ul.payment_methods > li{
        font-size:13px !important;
    }
    body.cp-commerce-v32-checkout #payment div.payment_box{
        padding:13px 14px !important;
        font-size:13px !important;
    }
    body.cp-commerce-v32-checkout #payment .place-order{
        padding-top:18px !important;
        font-size:13px !important;
        line-height:1.55 !important;
    }
    body.cp-commerce-v32-checkout #payment .woocommerce-privacy-policy-text,
    body.cp-commerce-v32-checkout #payment .woocommerce-terms-and-conditions-wrapper{
        font-size:13px !important;
        line-height:1.55 !important;
    }
    body.cp-commerce-v32-checkout #place_order{
        min-height:54px !important;
        margin-top:16px !important;
        padding:15px 14px !important;
        font-size:13px !important;
    }
    body.cp-commerce-v32-checkout .cp-v32-commerce-content a[href*="/cart"],
    body.cp-commerce-v32-checkout .cp-v32-commerce-content a[href*="cart/"]{
        display:inline-block !important;
        margin-top:12px !important;
        font-size:13px !important;
    }
}

@media (max-width:430px){
    body.cp-commerce-v32 .cp-v32-commerce-shell{
        width:calc(100% - 30px) !important;
    }
    body.cp-commerce-v32-cart .woocommerce-cart-form table.shop_table tr.cart_item{
        grid-template-columns:78px minmax(0,1fr) !important;
        column-gap:13px !important;
    }
    body.cp-commerce-v32-cart .woocommerce-cart-form td.product-thumbnail a,
    body.cp-commerce-v32-cart .woocommerce-cart-form td.product-thumbnail img{
        width:78px !important;
        max-width:78px !important;
    }
    body.cp-commerce-v32-cart .woocommerce-cart-form td.product-thumbnail img{
        height:98px !important;
    }
    body.cp-commerce-v32-cart .woocommerce-cart-form td.product-name a,
    body.cp-commerce-v32-cart .woocommerce-cart-form td.product-name span{
        font-size:17px !important;
    }
    body.cp-commerce-v32-cart .coupon{
        grid-template-columns:1fr !important;
    }
    body.cp-commerce-v32-cart .coupon button,
    body.cp-commerce-v32-cart .coupon .button{
        width:100% !important;
    }
}
