/*
 * Cart table layout.
 *
 * Selectors are anchored on `body.woocommerce-cart table.cart` instead of the
 * theme's `.woocommerce > form table.cart` chain. That direct-child chain does
 * not match the live cart markup, so every rule built on it — including the
 * parent theme's own cart styling — is dead. Anchoring on the body + table
 * classes that actually exist in the markup is what makes these rules take
 * effect.
 */

@media only screen and (min-width: 769px) {
    body.woocommerce-cart table.cart {
        table-layout: fixed !important;
    }

    body.woocommerce-cart table.cart thead th {
        padding: 14px 16px !important;
        vertical-align: middle !important;
    }

    body.woocommerce-cart table.cart th.product-remove,
    body.woocommerce-cart table.cart td.product-remove {
        width: 4% !important;
        text-align: center !important;
    }

    body.woocommerce-cart table.cart th.product-thumbnail,
    body.woocommerce-cart table.cart td.product-thumbnail {
        width: 14% !important;
        padding-right: 16px !important;
        padding-left: 16px !important;
        text-align: center !important;
    }

    body.woocommerce-cart table.cart tr.cart_item {
        height: 170px !important;
    }

    body.woocommerce-cart table.cart tr.cart_item > td {
        height: 170px !important;
        padding-top: 18px !important;
        padding-bottom: 18px !important;
        vertical-align: middle !important;
        line-height: 1.35 !important;
    }

    body.woocommerce-cart table.cart tr.cart_item td.product-thumbnail a,
    body.woocommerce-cart table.cart tr.cart_item td.product-thumbnail img {
        display: block !important;
        width: 130px !important;
        max-width: 130px !important;
        height: 130px !important;
        max-height: 130px !important;
        margin: 0 auto !important;
        object-fit: contain !important;
    }

    body.woocommerce-cart table.cart th.product-name,
    body.woocommerce-cart table.cart td.product-name {
        width: 38% !important;
        text-align: left !important;
    }

    body.woocommerce-cart table.cart tr.cart_item td.product-name a {
        display: inline-block !important;
        max-width: 340px !important;
        line-height: 1.35 !important;
    }

    body.woocommerce-cart table.cart th.product-price,
    body.woocommerce-cart table.cart td.product-price {
        width: 12% !important;
        text-align: center !important;
    }

    body.woocommerce-cart table.cart th.product-quantity,
    body.woocommerce-cart table.cart td.product-quantity {
        width: 20% !important;
        text-align: center !important;
    }

    body.woocommerce-cart table.cart tr.cart_item .mkd-quantity-buttons {
        margin: 0 auto !important;
    }

    body.woocommerce-cart table.cart tr.cart_item .mkd-quantity-buttons .mkd-quantity-label {
        display: none !important;
    }

    body.woocommerce-cart table.cart th.product-subtotal,
    body.woocommerce-cart table.cart td.product-subtotal {
        width: 12% !important;
        padding-right: 24px !important;
        text-align: right !important;
    }
}

/*
 * Cart actions row: "Go Back Shopping" link floated left (with the theme's
 * Linearicons left-arrow glyph) on the same level as the Update cart button.
 * The link is relocated into td.actions via the woocommerce_cart_actions hook.
 */
body.woocommerce-cart table.cart td.actions {
    display: table-cell !important;
    height: 108px !important;
    padding: 27px 48px !important;
    overflow: hidden !important; /* contain the floated children */
    text-align: left !important;
    vertical-align: middle !important;
    box-sizing: border-box !important;
}

body.woocommerce-cart table.cart td.actions .mkd-cart-go-back {
    float: left !important;
    display: inline-flex !important;
    align-items: center !important;
    height: 54px !important;
    margin: 0 !important;
    white-space: nowrap !important;
    font-size: 14px !important;
    line-height: 1 !important;
    color: #929292 !important;
}

body.woocommerce-cart table.cart td.actions .mkd-cart-go-back:before {
    content: "\e879" !important;
    font-family: "Linearicons-Free", sans-serif !important;
    font-size: 18px !important;
    line-height: 1 !important;
    margin-right: 8px !important;
    display: inline-block !important;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body.woocommerce-cart table.cart td.actions button[name="update_cart"],
body.woocommerce-cart table.cart td.actions input[name="update_cart"] {
    float: right !important;
    height: 54px !important;
    margin: 0 !important;
    padding: 0 32px !important;
    line-height: 54px !important;
    white-space: nowrap !important;
}

@media only screen and (max-width: 768px) {
    body.woocommerce-cart .woocommerce-cart-form {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    body.woocommerce-cart table.cart {
        min-width: 560px;
        table-layout: auto;
    }

    body.woocommerce-cart table.cart th.product-thumbnail,
    body.woocommerce-cart table.cart td.product-thumbnail,
    body.woocommerce-cart table.cart th.product-name,
    body.woocommerce-cart table.cart td.product-name,
    body.woocommerce-cart table.cart th.product-price,
    body.woocommerce-cart table.cart td.product-price,
    body.woocommerce-cart table.cart th.product-subtotal,
    body.woocommerce-cart table.cart td.product-subtotal {
        width: auto;
    }

    body.woocommerce-cart table.cart th.product-quantity,
    body.woocommerce-cart table.cart td.product-quantity {
        width: auto;
        min-width: 150px;
    }

    body.woocommerce-cart table.cart tr.cart_item .mkd-quantity-buttons .mkd-quantity-label {
        display: none !important;
    }
}

@media only screen and (max-width: 680px) {
    body.woocommerce-cart table.cart {
        min-width: 460px;
    }

    body.woocommerce-cart table.cart tr.cart_item td.product-name {
        text-align: left;
    }
}
