/* ------------------------------------------------------------------
   WGE cart - structural only. No fonts, no brand colours: everything
   inherits from best-shop so this drops in without a restyle.
   ------------------------------------------------------------------ */

.wge-cart {
    --wge-thumb: 80px;
    --wge-rule: rgba(0, 0, 0, .1);
    margin: 0 0 1.5rem;
}

.wge-cart__head,
.wge-cart__item {
    display: grid;
    align-items: center;
    gap: .5rem 1rem;
    grid-template-columns: var(--wge-thumb) minmax(0, 1fr) 6.5em 7.5em 6.5em 1.9em;
    grid-template-areas: "thumb name price quantity subtotal remove";
}

.wge-cart__head {
    grid-template-areas: ". name price quantity subtotal .";
    padding-bottom: .5rem;
    border-bottom: 1px solid var(--wge-rule);
    font-size: .8125rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    opacity: .65;
}

.wge-cart__item {
    padding: .9rem 0;
    border-bottom: 1px solid var(--wge-rule);
}

.wge-cart .product-thumbnail { grid-area: thumb; }
.wge-cart .product-name      { grid-area: name; min-width: 0; }
.wge-cart .product-price     { grid-area: price; text-align: right; }
.wge-cart .product-quantity  { grid-area: quantity; }
.wge-cart .product-subtotal  { grid-area: subtotal; text-align: right; font-weight: 600; }
.wge-cart .product-remove    { grid-area: remove; text-align: right; }

.wge-cart .product-thumbnail img {
    display: block;
    width: var(--wge-thumb);
    height: var(--wge-thumb);
    object-fit: cover;
    border-radius: 3px;
}

.wge-cart .product-name a { text-decoration: none; }
.wge-cart .backorder_notification {
    margin: .3rem 0 0;
    font-size: .85em;
    opacity: .7;
}

.wge-cart .product-remove a.remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.9em;
    height: 1.9em;
    line-height: 1;
    font-size: 1.05rem;
    border-radius: 50%;
    text-decoration: none;
    color: inherit;
    opacity: .5;
    transition: opacity .15s, background-color .15s;
}
.wge-cart .product-remove a.remove:hover,
.wge-cart .product-remove a.remove:focus-visible {
    opacity: 1;
    background: var(--wge-rule);
}

.wge-cart .quantity input.qty {
    width: 100%;
    max-width: 5.5em;
    padding: .4em;
    text-align: center;
}

/* Actions row ------------------------------------------------------- */

.wge-cart-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: 1rem 0 1.5rem;
}
.wge-cart-actions .coupon {
    display: flex;
    gap: .5rem;
    flex: 1 1 20rem;
}
.wge-cart-actions .coupon #coupon_code {
    flex: 1 1 auto;
    min-width: 0;
}

/* Totals ------------------------------------------------------------ */

.cart-collaterals {
    max-width: 26rem;
    margin-left: auto;
}
.cart_totals table.shop_table {
    width: 100%;
    border-collapse: collapse;
}
.cart_totals table.shop_table th,
.cart_totals table.shop_table td {
    padding: .6rem 0;
    border: 0;
    border-bottom: 1px solid var(--wge-rule, rgba(0, 0, 0, .1));
    text-align: left;
    font-weight: 400;
}
.cart_totals table.shop_table td { text-align: right; }
.cart_totals .order-total th,
.cart_totals .order-total td {
    font-size: 1.1em;
    font-weight: 700;
    border-bottom: 0;
}

/* Mobile ------------------------------------------------------------ */

@media (max-width: 640px) {
    .wge-cart { --wge-thumb: 68px; }
    .wge-cart__head { display: none; }

    .wge-cart__item {
	grid-template-columns: var(--wge-thumb) minmax(0, 1fr) auto;
	grid-template-areas:
	    "thumb name     remove"
	    "thumb price    subtotal"
	    "thumb quantity subtotal";
	align-items: start;
	row-gap: .45rem;
    }

    .wge-cart .product-price {
	text-align: left;
	font-size: .9em;
	opacity: .7;
    }
    .wge-cart .product-subtotal { align-self: end; }
    .wge-cart .quantity input.qty { max-width: 4.5em; }

    .wge-cart-actions {
	flex-direction: column;
	align-items: stretch;
    }
    .wge-cart-actions .coupon { flex: 1 1 auto; }
    .wge-cart-actions button[name="update_cart"] { width: 100%; }

    .cart-collaterals {
	max-width: none;
	margin-left: 0;
    }
}
/* ------------------------------------------------------------------
   "Complete your order" cross-sells (inc/wge-cart-crosssell.php).

   The totals box is pinned right at 26rem, which left the rest of the
   row empty on desktop. .cart-collaterals becomes a two-column grid so
   the cross-sells occupy that space instead of stacking below.

   When no cross-sells are found the totals box is the only child, and
   :only-child keeps it in the right-hand column rather than letting it
   stretch across the full width.
   ------------------------------------------------------------------ */

.wge-cart-crosssell {
    min-width: 0;
}

.wge-cart-crosssell__title {
    margin: 0 0 1rem;
    font-size: 1.25rem;
    line-height: 1.2;
}

/* The card grid. style.css sizes .products li for the shop archive, which is
   far taller than this context needs — same override the front page rows make
   for .wge-row-products. Target .wge-thumb, never `img`, or the absolutely
   positioned hover image collapses (see CLAUDE.md, "Product cards"). */
.wge-cart-crosssell ul.products {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

/* WooCommerce's clearfix pseudo-elements become grid ITEMS once the list is a
   grid — two invisible cells that make auto-fit see more content than there is
   and stop it collapsing the spare track. The front page rows already kill
   these; this grid did not, which is why four products laid out across five
   columns. */
.wge-cart-crosssell ul.products::before,
.wge-cart-crosssell ul.products::after {
    content: none;
}

.wge-cart-crosssell ul.products li.product {
    width: auto;
    margin: 0;
    padding: 0;
    float: none;
}

.wge-cart-crosssell ul.products li.product > .woocommerce-LoopProduct-link {
    min-height: 0;
}

.wge-cart-crosssell .wge-thumb {
    display: block;
    aspect-ratio: 1 / 1;
}

.wge-cart-crosssell .woocommerce-loop-product__title {
    font-size: 13px;
    line-height: 1.3;
}

@media (min-width: 900px) {
    .cart-collaterals {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 26rem;
        gap: 2.5rem;
        align-items: start;
        max-width: none;
        margin-left: 0;
    }

    .cart-collaterals > .cart_totals:only-child {
        grid-column: 2;
    }
}
