/**
 * Mohamed Saleh V2 — WooCommerce Cart
 * Isolated commerce presentation layer.
 * Version: 1.0.0
 */

/* ==========================================================
   01. PAGE SHELL
   ========================================================== */

body.ms-v2-cart {
    background: var(--ms-color-bg);
    color: var(--ms-color-body);
    font-family: var(--ms-font-sans);
}

body.ms-v2-cart *,
body.ms-v2-cart *::before,
body.ms-v2-cart *::after {
    box-sizing: border-box;
}

body.ms-v2-cart #content,
body.ms-v2-cart .site-content {
    background: var(--ms-color-bg);
}

body.ms-v2-cart .site-content > .ast-container {
    max-width: none;
    padding-inline: 0;
}

body.ms-v2-cart #primary {
    width: 100%;
    max-width: none;
    margin: 0;
}

body.ms-v2-cart .ast-article-single {
    padding: 0 !important;
    background: transparent !important;
}

body.ms-v2-cart .entry-header {
    display: none;
}

body.ms-v2-cart .entry-content {
    margin: 0;
}

body.ms-v2-cart .entry-content > .woocommerce {
    width: var(--ms-shell-content-width);
    margin-inline: auto;
    padding-block: clamp(32px, 4.5vw, 56px) clamp(56px, 7vw, 84px);
    direction: rtl;
}


/* ==========================================================
   02. CART INTRO
   ========================================================== */

body.ms-v2-cart .ms-v2-cart-intro {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 118px;
    align-items: center;
    gap: var(--ms-space-8);
    overflow: hidden;
    margin-bottom: var(--ms-space-6);
    padding: clamp(var(--ms-space-6), 3.4vw, var(--ms-space-px-34));
    border: 1px solid var(--ms-color-border);
    border-radius: var(--ms-radius-lg);
    background:
        radial-gradient(
            circle at 8% 12%,
            rgba(var(--ms-rgb-blue), .08),
            transparent 31%
        ),
        var(--ms-color-surface);
    box-shadow: var(--ms-shadow-sm, 0 6px 20px rgba(var(--ms-rgb-heading), .04));
}

body.ms-v2-cart .ms-v2-cart-intro::after {
    content: "";
    position: absolute;
    inset-inline-start: -48px;
    bottom: -88px;
    width: 184px;
    height: 184px;
    border: 1px solid rgba(var(--ms-rgb-blue), .13);
    border-radius: 50%;
    pointer-events: none;
}

body.ms-v2-cart .ms-v2-cart-intro__copy {
    position: relative;
    z-index: 1;
    min-width: 0;
}

body.ms-v2-cart .ms-v2-cart-intro__eyebrow {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    margin-bottom: var(--ms-space-3);
    padding: var(--ms-space-px-6) var(--ms-space-px-11);
    border: 1px solid rgba(var(--ms-rgb-blue), .15);
    border-radius: var(--ms-radius-pill);
    background: var(--ms-color-soft-blue);
    color: var(--ms-color-blue-hover);
    font-size: var(--ms-font-size-meta, .75rem);
    font-weight: var(--ms-font-weight-800);
    line-height: var(--ms-line-exact-1-5);
}

body.ms-v2-cart .ms-v2-cart-intro h1 {
    margin: 0;
    color: var(--ms-color-heading);
    font-size: var(--ms-font-size-h1, clamp(1.875rem, 3vw, 2.625rem));
    font-weight: var(--ms-font-weight-800);
    line-height: var(--ms-line-heading, 1.42);
    text-wrap: balance;
}

body.ms-v2-cart .ms-v2-cart-intro p {
    max-width: var(--ms-layout-max-px-720);
    margin: var(--ms-space-2) 0 0;
    color: var(--ms-color-body);
    font-size: var(--ms-font-size-body, 1rem);
    line-height: var(--ms-line-body, 1.85);
}

body.ms-v2-cart .ms-v2-cart-intro__icon {
    position: relative;
    z-index: 1;
    display: grid;
    width: 104px;
    height: 104px;
    place-items: center;
    justify-self: end;
    border: 1px solid rgba(var(--ms-rgb-blue), .18);
    border-radius: var(--ms-radius-lg);
    background: var(--ms-color-soft-blue);
}

body.ms-v2-cart .ms-v2-cart-intro__icon svg {
    width: 43px;
    height: 43px;
    stroke: var(--ms-color-blue);
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}


/* ==========================================================
   03. EMPTY CART
   ========================================================== */

body.ms-v2-cart .ms-v2-cart-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: var(--ms-container-reading);
    margin-inline: auto;
    padding: clamp(var(--ms-space-px-34), 5vw, var(--ms-space-px-52));
    border: 1px solid var(--ms-color-border);
    border-radius: var(--ms-radius-lg);
    background: var(--ms-color-surface);
    box-shadow: var(--ms-shadow-md, 0 14px 38px rgba(var(--ms-rgb-dark), .07));
    text-align: center;
}

body.ms-v2-cart .ms-v2-cart-empty__icon {
    display: grid;
    width: 84px;
    height: 84px;
    place-items: center;
    margin-bottom: var(--ms-space-5);
    border: 1px solid rgba(var(--ms-rgb-blue), .18);
    border-radius: var(--ms-radius-lg);
    background: var(--ms-color-soft-blue);
}

body.ms-v2-cart .ms-v2-cart-empty__icon svg {
    width: 37px;
    height: 37px;
    stroke: var(--ms-color-blue);
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

body.ms-v2-cart .ms-v2-cart-empty__content {
    max-width: var(--ms-layout-max-px-640);
}

body.ms-v2-cart .ms-v2-cart-empty__label {
    display: block;
    margin-bottom: var(--ms-space-2);
    color: var(--ms-color-orange-hover);
    font-size: var(--ms-font-size-small, .875rem);
    font-weight: var(--ms-font-weight-800);
}

body.ms-v2-cart .ms-v2-cart-empty h2 {
    margin: 0;
    color: var(--ms-color-heading);
    font-size: var(--ms-font-size-h2, clamp(1.5rem, 2.3vw, 2.125rem));
    font-weight: var(--ms-font-weight-800);
    line-height: var(--ms-line-heading, 1.42);
    text-wrap: balance;
}

body.ms-v2-cart .ms-v2-cart-empty p {
    margin: var(--ms-space-3) 0 0;
    color: var(--ms-color-body);
    font-size: var(--ms-font-size-body, 1rem);
    line-height: var(--ms-line-body, 1.85);
}

body.ms-v2-cart .ms-v2-cart-button {
    min-height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--ms-space-px-9);
    margin-top: var(--ms-space-6);
    padding: var(--ms-space-px-11) var(--ms-space-px-22);
    border: 1px solid transparent;
    border-radius: var(--ms-radius-sm);
    font-family: inherit;
    font-size: var(--ms-type-size-px-15);
    font-weight: var(--ms-font-weight-800);
    line-height: var(--ms-line-exact-1-4);
    text-decoration: none !important;
    box-shadow: none;
    transition:
        background var(--ms-motion-fast, 160ms ease),
        border-color var(--ms-motion-fast, 160ms ease),
        color var(--ms-motion-fast, 160ms ease),
        transform var(--ms-motion-fast, 160ms ease);
}

body.ms-v2-cart .ms-v2-cart-button svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

body.ms-v2-cart .ms-v2-cart-button--primary {
    border-color: var(--ms-color-orange);
    background: var(--ms-color-orange);
    color: var(--ms-color-white);
}

body.ms-v2-cart .ms-v2-cart-button--primary:hover,
body.ms-v2-cart .ms-v2-cart-button--primary:focus-visible {
    border-color: var(--ms-color-orange-hover);
    background: var(--ms-color-orange-hover);
    color: var(--ms-color-white);
    transform: translateY(-1px);
}

/* WooCommerce cart-empty.php still prints this compatibility fallback. */
body.ms-v2-cart .return-to-shop {
    display: none !important;
}


/* ==========================================================
   04. WOOCOMMERCE NOTICES
   ========================================================== */

body.ms-v2-cart .woocommerce-notices-wrapper {
    margin: 0;
}

body.ms-v2-cart :is(
    .woocommerce-message,
    .woocommerce-info,
    .woocommerce-error
) {
    margin: 0 0 var(--ms-space-5) !important;
    padding: var(--ms-space-px-15) var(--ms-space-px-17) !important;
    border: 1px solid var(--ms-color-border) !important;
    border-radius: var(--ms-radius-md);
    background: var(--ms-color-surface);
    color: var(--ms-color-body);
    box-shadow: none;
    line-height: var(--ms-line-exact-1-75);
}

body.ms-v2-cart .woocommerce-error {
    border-color: var(--ms-color-fn-cf28bd08f8) !important;
    background: var(--ms-palette-fff7f6);
}

body.ms-v2-cart :is(
    .woocommerce-message,
    .woocommerce-info,
    .woocommerce-error
)::before {
    position: static;
    display: inline-block;
    margin-inline-end: 8px;
    color: var(--ms-color-blue);
}

body.ms-v2-cart .woocommerce-error::before {
    color: var(--ms-color-danger);
}


/* ==========================================================
   05. POPULATED CART
   ========================================================== */

body.ms-v2-cart form.woocommerce-cart-form {
    margin: 0 0 var(--ms-space-6);
}

body.ms-v2-cart table.shop_table {
    width: 100%;
    margin: 0 !important;
    overflow: hidden;
    border: 1px solid var(--ms-color-border) !important;
    border-collapse: separate !important;
    border-spacing: 0;
    border-radius: var(--ms-radius-lg) !important;
    background: var(--ms-color-surface);
    box-shadow: var(--ms-shadow-sm, 0 6px 20px rgba(var(--ms-rgb-heading), .04));
}

body.ms-v2-cart table.shop_table :is(th, td) {
    padding: var(--ms-space-px-17) var(--ms-space-4) !important;
    border: 0 !important;
    border-bottom: 1px solid var(--ms-color-border) !important;
    vertical-align: middle;
    text-align: right;
}

body.ms-v2-cart table.shop_table thead th {
    background: var(--ms-color-soft-blue);
    color: var(--ms-color-heading);
    font-size: var(--ms-font-size-small, .875rem);
    font-weight: var(--ms-font-weight-800);
}

body.ms-v2-cart table.shop_table tr:last-child td {
    border-bottom: 0 !important;
}

body.ms-v2-cart table.cart .product-thumbnail {
    width: 94px;
}

body.ms-v2-cart table.cart .product-thumbnail img {
    width: 72px;
    height: 72px;
    object-fit: cover;
    border: 1px solid var(--ms-color-border);
    border-radius: var(--ms-radius-md);
    background: var(--ms-color-bg);
}

body.ms-v2-cart table.cart .product-name a {
    color: var(--ms-color-heading);
    font-weight: var(--ms-font-weight-800);
    text-decoration: none;
}

body.ms-v2-cart table.cart .product-name a:hover,
body.ms-v2-cart table.cart .product-name a:focus-visible {
    color: var(--ms-color-blue-hover);
}

body.ms-v2-cart table.cart :is(
    .product-price,
    .product-subtotal
) {
    color: var(--ms-color-heading);
    font-weight: var(--ms-font-weight-800);
}

body.ms-v2-cart table.cart .product-remove {
    width: 52px;
    text-align: center;
}

body.ms-v2-cart table.cart .product-remove a.remove {
    display: inline-grid;
    width: 36px;
    height: 36px;
    place-items: center;
    border: 1px solid var(--ms-color-fn-ad5722980c);
    border-radius: var(--ms-radius-sm);
    background: var(--ms-palette-fff7f6);
    color: var(--ms-color-danger) !important;
    font-size: var(--ms-type-size-px-22);
    line-height: var(--ms-line-exact-1);
    text-decoration: none;
}

body.ms-v2-cart table.cart .product-remove a.remove:hover,
body.ms-v2-cart table.cart .product-remove a.remove:focus-visible {
    border-color: var(--ms-color-danger);
    background: var(--ms-color-danger);
    color: var(--ms-color-white) !important;
}

body.ms-v2-cart .quantity .qty {
    width: 76px;
    min-height: 44px;
    padding: var(--ms-space-2) var(--ms-space-px-10);
    border: 1px solid var(--ms-color-border);
    border-radius: var(--ms-radius-sm);
    background: var(--ms-color-surface);
    color: var(--ms-color-heading);
    font: inherit;
    font-weight: var(--ms-font-weight-700);
    box-shadow: none;
}

body.ms-v2-cart .quantity .qty:focus {
    border-color: var(--ms-color-blue);
    outline: 3px solid rgba(var(--ms-rgb-blue), .14);
}


/* ==========================================================
   06. COUPON + CART ACTIONS
   ========================================================== */

body.ms-v2-cart table.cart td.actions {
    padding: var(--ms-space-px-17) !important;
    background: var(--ms-color-surface-subtle);
}

body.ms-v2-cart table.cart td.actions .coupon {
    display: inline-flex;
    align-items: center;
    gap: var(--ms-space-px-10);
}

body.ms-v2-cart table.cart td.actions .coupon .input-text {
    width: 210px !important;
    min-height: 46px;
    margin: 0 !important;
    padding: var(--ms-space-px-10) var(--ms-space-3) !important;
    border: 1px solid var(--ms-color-border) !important;
    border-radius: var(--ms-radius-sm) !important;
    background: var(--ms-color-surface);
    color: var(--ms-color-heading);
    font: inherit;
    box-shadow: none !important;
}

body.ms-v2-cart table.cart td.actions .coupon .input-text:focus {
    border-color: var(--ms-color-blue) !important;
    outline: 3px solid rgba(var(--ms-rgb-blue), .14);
}

body.ms-v2-cart table.cart td.actions :is(button.button, input.button) {
    min-height: 46px;
    padding: var(--ms-space-px-10) var(--ms-space-px-18) !important;
    border: 1px solid var(--ms-color-blue) !important;
    border-radius: var(--ms-radius-sm) !important;
    background: transparent !important;
    color: var(--ms-color-blue) !important;
    font-family: inherit;
    font-weight: var(--ms-font-weight-800);
    box-shadow: none !important;
}

body.ms-v2-cart table.cart td.actions :is(button.button, input.button):hover,
body.ms-v2-cart table.cart td.actions :is(button.button, input.button):focus-visible {
    background: var(--ms-color-soft-blue) !important;
    color: var(--ms-color-blue-hover) !important;
}

body.ms-v2-cart table.cart td.actions :is(button.button, input.button)[disabled] {
    opacity: .48;
    cursor: not-allowed;
}


/* ==========================================================
   07. TOTALS + CHECKOUT CTA
   ========================================================== */

body.ms-v2-cart .cart-collaterals {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(340px, 420px);
    gap: var(--ms-space-6);
    align-items: start;
    margin-top: var(--ms-space-6);
}

body.ms-v2-cart .cart-collaterals::before,
body.ms-v2-cart .cart-collaterals::after {
    display: none;
}

body.ms-v2-cart .cart-collaterals .cross-sells {
    width: 100% !important;
    float: none !important;
}

body.ms-v2-cart .cart-collaterals .cart_totals {
    grid-column: 2;
    width: 100% !important;
    float: none !important;
    position: sticky;
    top: calc(var(--ms-header-offset, 96px) + 18px);
    padding: var(--ms-space-6);
    border: 1px solid var(--ms-color-border);
    border-radius: var(--ms-radius-lg);
    background: var(--ms-color-surface);
    box-shadow: var(--ms-shadow-sm, 0 6px 20px rgba(var(--ms-rgb-heading), .04));
}

body.ms-v2-cart :is(
    .cart_totals h2,
    .cross-sells > h2
) {
    margin: 0 0 var(--ms-space-4);
    color: var(--ms-color-heading);
    font-size: var(--ms-font-size-h3, clamp(1.125rem, 1.7vw, 1.5rem));
    font-weight: var(--ms-font-weight-800);
    line-height: var(--ms-line-heading, 1.42);
}

body.ms-v2-cart .cart_totals table.shop_table {
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none;
}

body.ms-v2-cart .cart_totals table.shop_table :is(th, td) {
    padding: var(--ms-space-px-13) 0 !important;
    background: transparent;
    font-size: var(--ms-font-size-small, .875rem);
}

body.ms-v2-cart .cart_totals table.shop_table th {
    width: 44%;
    color: var(--ms-color-body);
    font-weight: var(--ms-font-weight-700);
}

body.ms-v2-cart .cart_totals table.shop_table td {
    color: var(--ms-color-heading);
    font-weight: var(--ms-font-weight-800);
    text-align: left;
}

body.ms-v2-cart .cart_totals .order-total :is(th, td) {
    padding-top: var(--ms-space-px-17) !important;
    color: var(--ms-color-heading);
    font-size: var(--ms-font-size-body);
    font-weight: var(--ms-font-weight-900);
}

body.ms-v2-cart .wc-proceed-to-checkout {
    padding: var(--ms-space-5) 0 0;
}

body.ms-v2-cart .wc-proceed-to-checkout a.checkout-button {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 52px;
    margin: 0 !important;
    padding: var(--ms-space-px-13) var(--ms-space-5) !important;
    border: 1px solid var(--ms-color-orange) !important;
    border-radius: var(--ms-radius-sm) !important;
    background: var(--ms-color-orange) !important;
    color: var(--ms-color-white) !important;
    font-family: inherit;
    font-size: var(--ms-type-size-px-16);
    font-weight: var(--ms-font-weight-800);
    line-height: var(--ms-line-exact-1-45);
    text-align: center;
    box-shadow: none !important;
}

body.ms-v2-cart .wc-proceed-to-checkout a.checkout-button:hover,
body.ms-v2-cart .wc-proceed-to-checkout a.checkout-button:focus-visible {
    border-color: var(--ms-color-orange-hover) !important;
    background: var(--ms-color-orange-hover) !important;
}


/* ==========================================================
   08. CROSS SELLS
   ========================================================== */

body.ms-v2-cart .cross-sells {
    padding: var(--ms-space-6);
    border: 1px solid var(--ms-color-border);
    border-radius: var(--ms-radius-lg);
    background: var(--ms-color-surface);
}

body.ms-v2-cart .cross-sells ul.products {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--ms-space-4);
    margin: 0;
}

body.ms-v2-cart .cross-sells ul.products::before,
body.ms-v2-cart .cross-sells ul.products::after {
    display: none;
}

body.ms-v2-cart .cross-sells ul.products li.product {
    width: 100% !important;
    margin: 0 !important;
    padding: var(--ms-space-px-14);
    border: 1px solid var(--ms-color-border);
    border-radius: var(--ms-radius-md);
    background: var(--ms-color-surface);
}

body.ms-v2-cart .cross-sells ul.products li.product img {
    border-radius: var(--ms-radius-10);
}

body.ms-v2-cart .cross-sells ul.products li.product .woocommerce-loop-product__title {
    color: var(--ms-color-heading);
    font-size: var(--ms-type-size-px-15);
    font-weight: var(--ms-font-weight-800);
}

body.ms-v2-cart .cross-sells ul.products li.product .button {
    border: 1px solid var(--ms-color-blue) !important;
    border-radius: var(--ms-radius-sm) !important;
    background: transparent !important;
    color: var(--ms-color-blue) !important;
    box-shadow: none !important;
}


/* ==========================================================
   09. ACCESSIBILITY
   ========================================================== */

body.ms-v2-cart :is(a, button, input):focus-visible {
    outline: 3px solid rgba(var(--ms-rgb-blue), .28);
    outline-offset: 3px;
}


/* ==========================================================
   10. TABLET
   ========================================================== */

@media (max-width: 921px) {
    body.ms-v2-cart .ms-v2-cart-intro {
        grid-template-columns: minmax(0, 1fr) 96px;
        gap: var(--ms-space-6);
    }

    body.ms-v2-cart .ms-v2-cart-intro__icon {
        width: 90px;
        height: 90px;
    }

    body.ms-v2-cart .cart-collaterals {
        grid-template-columns: 1fr;
    }

    body.ms-v2-cart .cart-collaterals .cart_totals {
        grid-column: auto;
        position: static;
    }
}


/* ==========================================================
   11. MOBILE
   ========================================================== */

@media (max-width: 767px) {
    body.ms-v2-cart .entry-content > .woocommerce {
        width: min(100% - 28px, var(--ms-container, 1240px));
        padding-top: var(--ms-space-px-22);
        padding-bottom: var(--ms-space-px-52);
    }

    body.ms-v2-cart .ms-v2-cart-intro {
        grid-template-columns: 1fr;
        gap: var(--ms-space-4);
        padding: var(--ms-space-px-22) var(--ms-space-5);
    }

    body.ms-v2-cart .ms-v2-cart-intro__icon {
        display: none;
    }

    body.ms-v2-cart .ms-v2-cart-empty {
        padding: var(--ms-space-px-34) var(--ms-space-5);
    }

    body.ms-v2-cart .ms-v2-cart-empty__icon {
        width: 74px;
        height: 74px;
    }

    body.ms-v2-cart .ms-v2-cart-button {
        width: 100%;
    }

    body.ms-v2-cart table.shop_table_responsive thead {
        display: none;
    }

    body.ms-v2-cart table.shop_table_responsive tbody tr {
        display: block;
        padding: var(--ms-space-3) var(--ms-space-px-14);
        border-bottom: 1px solid var(--ms-color-border);
    }

    body.ms-v2-cart table.shop_table_responsive tbody tr:last-child {
        border-bottom: 0;
    }

    body.ms-v2-cart table.shop_table_responsive tbody tr td {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: var(--ms-space-px-14);
        padding: var(--ms-space-px-11) 0 !important;
        border-bottom: 1px dashed var(--ms-color-fn-1458a3eca5) !important;
        text-align: left !important;
    }

    body.ms-v2-cart table.shop_table_responsive tbody tr td:last-child {
        border-bottom: 0 !important;
    }

    body.ms-v2-cart table.shop_table_responsive tbody tr td::before {
        float: none;
        color: var(--ms-color-muted-readable);
        font-size: var(--ms-font-size-meta, .75rem);
        font-weight: var(--ms-font-weight-700);
        text-align: right;
    }

    body.ms-v2-cart table.shop_table_responsive tbody tr td.product-remove,
    body.ms-v2-cart table.shop_table_responsive tbody tr td.product-thumbnail {
        display: none;
    }

    body.ms-v2-cart table.shop_table_responsive tbody tr td.product-name {
        align-items: flex-start;
        flex-direction: column;
    }

    body.ms-v2-cart table.cart td.actions {
        display: block !important;
        padding: var(--ms-space-4) !important;
    }

    body.ms-v2-cart table.cart td.actions::before {
        display: none !important;
    }

    body.ms-v2-cart table.cart td.actions .coupon {
        display: grid;
        grid-template-columns: 1fr;
        width: 100%;
        margin-bottom: var(--ms-space-3);
    }

    body.ms-v2-cart table.cart td.actions .coupon .input-text,
    body.ms-v2-cart table.cart td.actions .coupon button.button,
    body.ms-v2-cart table.cart td.actions > :is(button.button, input.button) {
        width: 100% !important;
        margin: 0 !important;
    }

    body.ms-v2-cart .cart-collaterals {
        gap: var(--ms-space-px-18);
        margin-top: var(--ms-space-px-18);
    }

    body.ms-v2-cart :is(
        .cart-collaterals .cart_totals,
        .cross-sells
    ) {
        padding: var(--ms-space-5) var(--ms-space-px-17);
    }

    body.ms-v2-cart .cross-sells ul.products {
        grid-template-columns: 1fr;
    }
}


/* ==========================================================
   12. REDUCED MOTION
   ========================================================== */

@media (prefers-reduced-motion: reduce) {
    body.ms-v2-cart *,
    body.ms-v2-cart *::before,
    body.ms-v2-cart *::after {
        scroll-behavior: auto !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}
