/**
 * MiMusE Cart Theme
 * Version: 0.23.0
 *
 * Presentation only.
 * Does not implement or alter RQ / LINE / Checkout entitlement logic.
 */

/* --------------------------------------------------
   Cart page shell
-------------------------------------------------- */

body.woocommerce-cart main.site-main,
body.woocommerce-cart .site-main {
	width: min(calc(100% - 40px), var(--mimuse-container));
	margin-inline: auto;
	padding-top: 38px;
	padding-bottom: 68px;
}

body.woocommerce-cart .entry-header,
body.woocommerce-cart .woocommerce-cart-form,
body.woocommerce-cart .cart-collaterals {
	box-sizing: border-box;
}

body.woocommerce-cart .entry-title,
body.woocommerce-cart h1.page-title {
	margin: 0 0 30px;
	font-size: clamp(30px, 3vw, 40px);
	line-height: 1.15;
	color: var(--mimuse-text);
}

/* Clear classic Woo floats without changing plugin markup. */
body.woocommerce-cart .woocommerce::after {
	content: "";
	display: block;
	clear: both;
}

/* --------------------------------------------------
   Classic cart layout — Desktop
-------------------------------------------------- */

body.woocommerce-cart .woocommerce-cart-form {
	float: left !important;
	width: calc(68% - 16px) !important;
	margin: 0 !important;
}

body.woocommerce-cart .cart-collaterals {
	float: right !important;
	width: calc(32% - 16px) !important;
	margin: 0 !important;
}

body.woocommerce-cart .cart-collaterals .cart_totals {
	float: none !important;
	width: 100% !important;
	margin: 0 !important;
	padding: 22px;
	border: 1px solid var(--mimuse-border);
	border-radius: 10px;
	background: #fff;
	box-sizing: border-box;
}

body.woocommerce-cart .cart-collaterals .cart_totals > h2 {
	margin: 0 0 18px;
	font-size: 24px;
	line-height: 1.25;
}

/* --------------------------------------------------
   Cart table
-------------------------------------------------- */

body.woocommerce-cart table.shop_table.cart {
	width: 100%;
	margin: 0;
	border: 1px solid var(--mimuse-border) !important;
	border-radius: 10px;
	border-collapse: separate !important;
	border-spacing: 0;
	background: #fff;
	overflow: hidden;
}

body.woocommerce-cart table.shop_table.cart th {
	padding: 14px 16px !important;
	border: 0 !important;
	border-bottom: 1px solid var(--mimuse-border) !important;
	background: #fafafa;
	color: var(--mimuse-muted);
	font-size: 13px;
	font-weight: 600;
	text-align: left;
}

body.woocommerce-cart table.shop_table.cart td {
	padding: 16px !important;
	border: 0 !important;
	border-bottom: 1px solid var(--mimuse-border) !important;
	background: #fff;
	vertical-align: middle;
}

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

body.woocommerce-cart td.product-thumbnail {
	width: 104px;
}

body.woocommerce-cart td.product-thumbnail img {
	display: block;
	width: 84px !important;
	height: 84px !important;
	max-width: 84px !important;
	object-fit: contain;
	object-position: center;
	border-radius: 7px;
	background: #f6f8f8;
}

body.woocommerce-cart td.product-name a {
	color: var(--mimuse-text);
	font-weight: 600;
	text-decoration: none;
}

body.woocommerce-cart td.product-name a:hover {
	color: var(--mimuse-action);
}

body.woocommerce-cart td.product-price,
body.woocommerce-cart td.product-subtotal {
	white-space: nowrap;
	font-weight: 600;
}

body.woocommerce-cart td.product-subtotal {
	color: var(--mimuse-action);
}

body.woocommerce-cart td.product-remove {
	width: 46px;
	text-align: center;
}

body.woocommerce-cart td.product-remove a.remove {
	display: inline-grid !important;
	place-items: center;
	width: 34px !important;
	height: 34px !important;
	border: 1px solid var(--mimuse-border);
	border-radius: 999px;
	background: #fff;
	color: var(--mimuse-muted) !important;
	font-size: 22px !important;
	line-height: 1 !important;
	text-decoration: none;
}

body.woocommerce-cart td.product-remove a.remove:hover {
	border-color: var(--mimuse-action);
	background: #fff !important;
	color: var(--mimuse-action) !important;
}

/* Quantity */
body.woocommerce-cart .quantity .qty {
	width: 74px !important;
	height: 42px;
	padding: 0 8px;
	border: 1px solid var(--mimuse-border);
	border-radius: 7px;
	background: #fff;
	color: var(--mimuse-text);
	text-align: center;
	font: inherit;
}

/* --------------------------------------------------
   Cart actions / coupon
-------------------------------------------------- */

body.woocommerce-cart table.shop_table.cart td.actions {
	padding: 16px !important;
	background: #fafafa;
}

body.woocommerce-cart table.shop_table.cart td.actions .coupon {
	display: flex;
	align-items: center;
	gap: 8px;
}

body.woocommerce-cart table.shop_table.cart td.actions .coupon label {
	position: absolute !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
}

body.woocommerce-cart table.shop_table.cart td.actions .coupon .input-text {
	width: 190px !important;
	height: 42px;
	margin: 0 !important;
	padding: 0 12px !important;
	border: 1px solid var(--mimuse-border) !important;
	border-radius: 7px;
	background: #fff;
	font: inherit;
}

body.woocommerce-cart table.shop_table.cart td.actions button.button,
body.woocommerce-cart table.shop_table.cart td.actions input.button {
	min-height: 42px !important;
	padding: 0 16px !important;
	border: 1px solid var(--mimuse-border) !important;
	border-radius: 7px !important;
	background: #fff !important;
	color: var(--mimuse-text) !important;
	font: inherit;
	font-weight: 600 !important;
}

body.woocommerce-cart table.shop_table.cart td.actions button.button:hover,
body.woocommerce-cart table.shop_table.cart td.actions input.button:hover {
	border-color: var(--mimuse-action) !important;
	color: var(--mimuse-action) !important;
}

/* --------------------------------------------------
   Cart totals
-------------------------------------------------- */

body.woocommerce-cart .cart_totals table.shop_table {
	margin: 0 0 18px;
	border: 0 !important;
	border-collapse: collapse;
}

body.woocommerce-cart .cart_totals table.shop_table th,
body.woocommerce-cart .cart_totals table.shop_table td {
	padding: 12px 0 !important;
	border: 0 !important;
	border-bottom: 1px solid var(--mimuse-border) !important;
	background: transparent !important;
}

body.woocommerce-cart .cart_totals table.shop_table th {
	width: 44%;
	color: var(--mimuse-muted);
	font-weight: 500;
	text-align: left;
}

body.woocommerce-cart .cart_totals table.shop_table td {
	text-align: right;
	font-weight: 600;
}

body.woocommerce-cart .cart_totals .order-total th,
body.woocommerce-cart .cart_totals .order-total td {
	padding-top: 16px !important;
	border-bottom: 0 !important;
	font-size: 18px;
	color: var(--mimuse-text);
}

body.woocommerce-cart .cart_totals .order-total td {
	color: var(--mimuse-action);
}

/*
 * Commerce package may intentionally expose Woo Checkout.
 * Style it if it exists; do not force-show or force-hide it here.
 */
body.woocommerce-cart .wc-proceed-to-checkout {
	padding: 0 !important;
}

body.woocommerce-cart .wc-proceed-to-checkout a.checkout-button {
	display: flex !important;
	align-items: center;
	justify-content: center;
	width: 100%;
	min-height: 48px;
	margin: 0 !important;
	padding: 0 18px !important;
	border: 1px solid var(--mimuse-action) !important;
	border-radius: 8px !important;
	background: var(--mimuse-action) !important;
	color: var(--mimuse-action-text) !important;
	font-size: 15px !important;
	font-weight: 700 !important;
	line-height: 1 !important;
	text-decoration: none;
}

body.woocommerce-cart .wc-proceed-to-checkout a.checkout-button:hover {
	border-color: var(--mimuse-action-hover) !important;
	background: var(--mimuse-action-hover) !important;
}

/* --------------------------------------------------
   Notices / empty cart
-------------------------------------------------- */

body.woocommerce-cart .woocommerce-notices-wrapper {
	margin-bottom: 18px;
}

body.woocommerce-cart .woocommerce-message,
body.woocommerce-cart .woocommerce-info,
body.woocommerce-cart .woocommerce-error {
	border: 1px solid var(--mimuse-border);
	border-top: 3px solid var(--mimuse-action);
	border-radius: 8px;
	background: #fff;
}

body.woocommerce-cart .cart-empty {
	margin-bottom: 18px;
}

body.woocommerce-cart .return-to-shop .button {
	display: inline-flex !important;
	align-items: center;
	justify-content: center;
	min-height: 44px;
	padding: 0 18px !important;
	border: 1px solid var(--mimuse-action) !important;
	border-radius: 8px !important;
	background: var(--mimuse-action) !important;
	color: var(--mimuse-action-text) !important;
	text-decoration: none;
}

/* --------------------------------------------------
   Woo Blocks compatibility
-------------------------------------------------- */

body.woocommerce-cart .wc-block-cart {
	margin-top: 18px;
}

body.woocommerce-cart .wc-block-cart-items,
body.woocommerce-cart .wc-block-components-sidebar {
	border-color: var(--mimuse-border);
}

body.woocommerce-cart .wc-block-cart__submit-button {
	border-radius: 8px;
	background: var(--mimuse-action);
	color: var(--mimuse-action-text);
}

/* --------------------------------------------------
   Responsive safety — final mobile review comes next
-------------------------------------------------- */

@media (max-width: 900px) {

	body.woocommerce-cart main.site-main,
	body.woocommerce-cart .site-main {
		width: min(calc(100% - 32px), var(--mimuse-container));
		padding-top: 26px;
		padding-bottom: 50px;
	}

	body.woocommerce-cart .woocommerce-cart-form,
	body.woocommerce-cart .cart-collaterals {
		float: none !important;
		width: 100% !important;
	}

	body.woocommerce-cart .cart-collaterals {
		margin-top: 22px !important;
	}

}

@media (max-width: 600px) {

	body.woocommerce-cart main.site-main,
	body.woocommerce-cart .site-main {
		width: min(calc(100% - 24px), var(--mimuse-container));
	}

	/*
	 * Classic Woo table becomes a vertical card-like layout.
	 * Woo adds data-title attributes for price/quantity/subtotal.
	 */
	body.woocommerce-cart table.shop_table.cart thead {
		display: none;
	}

	body.woocommerce-cart table.shop_table.cart,
	body.woocommerce-cart table.shop_table.cart tbody,
	body.woocommerce-cart table.shop_table.cart tr,
	body.woocommerce-cart table.shop_table.cart td {
		display: block;
		width: 100% !important;
		box-sizing: border-box;
	}

	body.woocommerce-cart table.shop_table.cart tr.cart_item {
		position: relative;
		padding: 12px;
		border-bottom: 1px solid var(--mimuse-border);
	}

	body.woocommerce-cart table.shop_table.cart tr.cart_item td {
		padding: 7px 0 !important;
		border: 0 !important;
		text-align: left !important;
	}

	body.woocommerce-cart td.product-remove {
		position: absolute;
		top: 10px;
		right: 10px;
		z-index: 2;
	}

	body.woocommerce-cart td.product-thumbnail {
		padding-right: 44px !important;
	}

	body.woocommerce-cart td.product-thumbnail img {
		width: 92px !important;
		height: 92px !important;
		max-width: 92px !important;
	}

	body.woocommerce-cart table.shop_table.cart td[data-title]::before {
		content: attr(data-title) ": ";
		margin-right: 8px;
		color: var(--mimuse-muted);
		font-weight: 500;
	}

	body.woocommerce-cart table.shop_table.cart td.actions {
		padding: 12px !important;
	}

	body.woocommerce-cart table.shop_table.cart td.actions .coupon {
		display: grid;
		grid-template-columns: 1fr;
	}

	body.woocommerce-cart table.shop_table.cart td.actions .coupon .input-text,
	body.woocommerce-cart table.shop_table.cart td.actions .coupon button,
	body.woocommerce-cart table.shop_table.cart td.actions > button {
		width: 100% !important;
	}

	body.woocommerce-cart table.shop_table.cart td.actions > button {
		margin-top: 8px !important;
	}

	body.woocommerce-cart .cart-collaterals .cart_totals {
		padding: 18px;
	}

}

@media (prefers-reduced-motion: reduce) {

	body.woocommerce-cart a,
	body.woocommerce-cart button {
		transition: none !important;
	}

}


/* --------------------------------------------------
   MiMusE 0.23.1 — Cart Responsive / Mobile Completion
   Covers WooCommerce Cart Block used on the live site,
   while preserving the Classic Cart fallback.
-------------------------------------------------- */

@media (max-width: 900px) {

	/* Live Woo Cart Block: stack products above totals. */
	body.woocommerce-cart .wc-block-cart {
		display: block !important;
	}

	body.woocommerce-cart .wc-block-cart__main,
	body.woocommerce-cart .wc-block-cart__sidebar {
		width: 100% !important;
		max-width: none !important;
		margin: 0 !important;
		padding-left: 0 !important;
		padding-right: 0 !important;
	}

	body.woocommerce-cart .wc-block-cart__sidebar {
		margin-top: 22px !important;
	}

	body.woocommerce-cart .wc-block-components-sidebar-layout {
		display: block !important;
	}

	body.woocommerce-cart .wc-block-components-main,
	body.woocommerce-cart .wc-block-components-sidebar {
		width: 100% !important;
		max-width: none !important;
		padding-left: 0 !important;
		padding-right: 0 !important;
	}

	body.woocommerce-cart .wc-block-components-sidebar {
		margin-top: 22px !important;
	}

	/* Totals card */
	body.woocommerce-cart .wc-block-cart__sidebar,
	body.woocommerce-cart .wc-block-components-sidebar {
		border: 1px solid var(--mimuse-border);
		border-radius: 10px;
		background: #fff;
		box-sizing: border-box;
	}

	body.woocommerce-cart .wc-block-cart__sidebar > *,
	body.woocommerce-cart .wc-block-components-sidebar > * {
		box-sizing: border-box;
	}

}

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

@media (max-width: 600px) {

	body.woocommerce-cart main.site-main,
	body.woocommerce-cart .site-main {
		width: min(calc(100% - 24px), var(--mimuse-container));
		padding-top: 20px;
		padding-bottom: 42px;
	}

	body.woocommerce-cart .entry-title,
	body.woocommerce-cart h1.page-title {
		margin-bottom: 22px;
		font-size: 28px;
	}

	/* Woo Blocks item list */
	body.woocommerce-cart .wc-block-cart-items {
		margin: 0 !important;
		border: 1px solid var(--mimuse-border) !important;
		border-radius: 9px;
		background: #fff;
		overflow: hidden;
	}

	body.woocommerce-cart .wc-block-cart-items thead {
		display: none !important;
	}

	body.woocommerce-cart .wc-block-cart-items tbody,
	body.woocommerce-cart .wc-block-cart-items tr,
	body.woocommerce-cart .wc-block-cart-items td {
		box-sizing: border-box;
	}

	body.woocommerce-cart .wc-block-cart-items__row {
		position: relative;
		display: grid !important;
		grid-template-columns: 82px minmax(0, 1fr) !important;
		column-gap: 12px !important;
		row-gap: 6px !important;
		padding: 14px !important;
		border-bottom: 1px solid var(--mimuse-border) !important;
	}

	body.woocommerce-cart .wc-block-cart-items__row:last-child {
		border-bottom: 0 !important;
	}

	body.woocommerce-cart .wc-block-cart-item__image {
		grid-column: 1 !important;
		width: 82px !important;
		min-width: 82px !important;
		padding: 0 !important;
		align-self: start;
	}

	body.woocommerce-cart .wc-block-cart-item__image img {
		display: block;
		width: 82px !important;
		height: 82px !important;
		max-width: 82px !important;
		object-fit: contain;
		object-position: center;
		border-radius: 7px;
		background: #f6f8f8;
	}

	body.woocommerce-cart .wc-block-cart-item__product {
		grid-column: 2 !important;
		min-width: 0 !important;
		padding: 0 !important;
	}

	body.woocommerce-cart .wc-block-components-product-name {
		display: block;
		margin: 0 34px 7px 0 !important;
		color: var(--mimuse-text) !important;
		font-size: 14px !important;
		line-height: 1.35 !important;
		font-weight: 600 !important;
		text-decoration: none !important;
		overflow-wrap: anywhere;
	}

	body.woocommerce-cart .wc-block-cart-item__prices,
	body.woocommerce-cart .wc-block-components-product-price {
		margin-bottom: 6px !important;
		font-size: 13px !important;
	}

	body.woocommerce-cart .wc-block-components-quantity-selector {
		min-height: 38px;
		margin: 8px 0 0 !important;
		border-color: var(--mimuse-border) !important;
		border-radius: 7px !important;
	}

	body.woocommerce-cart .wc-block-components-quantity-selector input {
		min-width: 42px;
		font-size: 14px !important;
	}

	body.woocommerce-cart .wc-block-cart-item__total {
		grid-column: 2 !important;
		width: 100% !important;
		padding: 4px 0 0 !important;
		text-align: left !important;
		font-size: 14px !important;
		font-weight: 700;
		color: var(--mimuse-action);
	}

	body.woocommerce-cart .wc-block-cart-item__remove-link {
		position: absolute !important;
		top: 12px;
		right: 12px;
		margin: 0 !important;
		font-size: 12px !important;
	}

	/* Coupon / totals */
	body.woocommerce-cart .wc-block-cart__sidebar,
	body.woocommerce-cart .wc-block-components-sidebar {
		margin-top: 18px !important;
		border-radius: 9px;
	}

	body.woocommerce-cart .wc-block-components-totals-wrapper,
	body.woocommerce-cart .wc-block-components-totals-coupon,
	body.woocommerce-cart .wc-block-cart__totals-title {
		padding-left: 14px !important;
		padding-right: 14px !important;
	}

	body.woocommerce-cart .wc-block-components-totals-item {
		padding-top: 12px !important;
		padding-bottom: 12px !important;
	}

	body.woocommerce-cart .wc-block-components-totals-item__label,
	body.woocommerce-cart .wc-block-components-totals-item__value {
		font-size: 14px;
	}

	body.woocommerce-cart .wc-block-components-totals-footer-item .wc-block-components-totals-item__label,
	body.woocommerce-cart .wc-block-components-totals-footer-item .wc-block-components-totals-item__value {
		font-size: 18px !important;
		font-weight: 700 !important;
	}

	body.woocommerce-cart .wc-block-components-totals-footer-item .wc-block-components-totals-item__value {
		color: var(--mimuse-action);
	}

	/* Native checkout if package exposes it. */
	body.woocommerce-cart .wc-block-cart__submit {
		margin: 0 !important;
		padding: 0 14px 14px !important;
	}

	body.woocommerce-cart .wc-block-cart__submit-container {
		padding: 0 !important;
	}

	body.woocommerce-cart .wc-block-cart__submit-button {
		display: flex !important;
		align-items: center;
		justify-content: center;
		width: 100% !important;
		min-height: 46px;
		border-radius: 8px !important;
		background: var(--mimuse-action) !important;
		color: var(--mimuse-action-text) !important;
		font-size: 14px !important;
		font-weight: 700 !important;
	}

	/* MiMusE LINE/RQ UI: visual only, never change its click/JS behavior. */
	body.woocommerce-cart [class*="mimuse-line"] button,
	body.woocommerce-cart [class*="mimuse-line"] .button,
	body.woocommerce-cart [class*="mimuse-request"] button,
	body.woocommerce-cart [class*="mimuse-request"] .button,
	body.woocommerce-cart a[class*="mimuse-line"],
	body.woocommerce-cart a[class*="mimuse-request"] {
		max-width: 100%;
		box-sizing: border-box;
	}

	/* Classic Cart fallback remains mobile-safe. */
	body.woocommerce-cart table.shop_table.cart td.product-name {
		padding-right: 42px !important;
	}

}

/* Common 390 / 375px phones */
@media (max-width: 420px) {

	body.woocommerce-cart main.site-main,
	body.woocommerce-cart .site-main {
		width: min(calc(100% - 20px), var(--mimuse-container));
	}

	body.woocommerce-cart .wc-block-cart-items__row {
		grid-template-columns: 72px minmax(0, 1fr) !important;
		column-gap: 10px !important;
		padding: 12px !important;
	}

	body.woocommerce-cart .wc-block-cart-item__image {
		width: 72px !important;
		min-width: 72px !important;
	}

	body.woocommerce-cart .wc-block-cart-item__image img {
		width: 72px !important;
		height: 72px !important;
		max-width: 72px !important;
	}

	body.woocommerce-cart .wc-block-components-product-name {
		font-size: 13px !important;
	}

	body.woocommerce-cart .wc-block-components-quantity-selector {
		max-width: 126px;
	}

}

/* Very narrow legacy phones */
@media (max-width: 359px) {

	body.woocommerce-cart .wc-block-cart-items__row {
		grid-template-columns: 64px minmax(0, 1fr) !important;
	}

	body.woocommerce-cart .wc-block-cart-item__image,
	body.woocommerce-cart .wc-block-cart-item__image img {
		width: 64px !important;
		min-width: 64px !important;
		height: 64px !important;
		max-width: 64px !important;
	}

}


/* --------------------------------------------------
   MiMusE 0.23.2 — Cart Mobile Subtotal / Remove Fix
   Fix the Woo Cart Block subtotal colliding with the remove control
   on 390/375px mobile layouts.
-------------------------------------------------- */

@media (max-width: 600px) {

	body.woocommerce-cart .wc-block-cart-items__row {
		align-items: start !important;
	}

	/* Keep product details in the content column. */
	body.woocommerce-cart .wc-block-cart-item__product {
		grid-column: 2 !important;
		grid-row: 1 !important;
		width: 100% !important;
		min-width: 0 !important;
		padding-right: 34px !important;
	}

	/*
	 * Woo's subtotal cell can retain desktop alignment rules.
	 * Put it on its own row below the product details instead.
	 */
	body.woocommerce-cart .wc-block-cart-item__total {
		position: static !important;
		grid-column: 2 !important;
		grid-row: 2 !important;
		justify-self: stretch !important;
		align-self: start !important;
		width: 100% !important;
		min-width: 0 !important;
		margin: 2px 0 0 !important;
		padding: 0 !important;
		text-align: left !important;
	}

	body.woocommerce-cart .wc-block-cart-item__total .wc-block-components-product-price,
	body.woocommerce-cart .wc-block-cart-item__total .wc-block-components-product-price__value,
	body.woocommerce-cart .wc-block-cart-item__total .wc-block-formatted-money-amount,
	body.woocommerce-cart .wc-block-cart-item__total .price {
		display: inline !important;
		position: static !important;
		float: none !important;
		margin: 0 !important;
		padding: 0 !important;
		text-align: left !important;
		white-space: nowrap !important;
		color: var(--mimuse-action) !important;
		font-size: 14px !important;
		font-weight: 700 !important;
	}

	body.woocommerce-cart .wc-block-cart-item__total::before {
		content: "รวม: ";
		display: inline;
		margin-right: 4px;
		color: var(--mimuse-muted);
		font-size: 12px;
		font-weight: 500;
	}

	/* Remove control gets its own protected corner. */
	body.woocommerce-cart .wc-block-cart-item__remove-link,
	body.woocommerce-cart button.wc-block-cart-item__remove-link {
		position: absolute !important;
		top: 12px !important;
		right: 12px !important;
		z-index: 4 !important;
		display: inline-flex !important;
		align-items: center !important;
		justify-content: center !important;
		width: 28px !important;
		min-width: 28px !important;
		height: 28px !important;
		margin: 0 !important;
		padding: 0 !important;
	}

}

/* Extra breathing room on common 390 / 375px phones. */
@media (max-width: 420px) {

	body.woocommerce-cart .wc-block-cart-item__product {
		padding-right: 30px !important;
	}

	body.woocommerce-cart .wc-block-cart-item__total {
		padding-right: 30px !important;
	}

}
