/* Cart redesign - scoped to cart. Loaded only on is_cart(). */
	/*
	 * Cart: minimal header - same as checkout (logo + page title + divider; no promo, menu, search, icons).
	 * If Elementor renders the header location, default .site-header markup is skipped; this CSS does not apply.
	 */
	body.woocommerce-cart .header-promo {
		display: none !important;
	}
	body.woocommerce-cart .site-header .header-top,
	body.woocommerce-cart .site-header .header-bottom,
	body.woocommerce-cart .site-header .search-form-container,
	body.woocommerce-cart .site-header .user-account-icon-container,
	body.woocommerce-cart .site-header .shopping-cart-container,
	body.woocommerce-cart .site-header .title-container .tagline {
		display: none !important;
	}
	/* Duplicate page title from content (h1 now in header) */
	body.woocommerce-cart .entry .post-header {
		display: none !important;
	}

	/* Hide site footer on cart (same as checkout) */
	body.woocommerce-cart #site-footer {
		display: none !important;
	}

	/* ── Override parent theme constraints on cart ──────────────────── */
	.woocommerce-cart .entry,
	body.woocommerce-cart .entry,
	body.woocommerce-cart .site-content .entry {
		max-width: 100% !important;
		width: 100% !important;
	}
	/* Same horizontal rhythm as default .main-container (critical CSS uses 3.125vw).
	 * Do not add max-width here - it shifts the text breadcrumb vs other pages; cart
	 * width is constrained by .ms-cart-redesign (max-width: 1140px). */
	body.woocommerce-cart .main-container,
	.woocommerce-cart .main-container {
		padding: 0 3.125vw !important;
		max-width: none !important;
		margin-left: 0 !important;
		margin-right: 0 !important;
	}

	/* ── Progress stepper ─────────────────────────────────────────── */
	.woocommerce-cart .ms-cart-progress {
		display: flex;
		align-items: center;
		justify-content: center;
		gap: 0;
		max-width: none;
		width: 100%;
		margin: 0 0 32px;
		padding: 0;
		box-sizing: border-box;
	}
	.ms-progress-step {
		display: flex;
		flex-direction: column;
		align-items: center;
		gap: 6px;
		flex-shrink: 0;
	}
	.ms-progress-dot {
		width: 36px;
		height: 36px;
		border-radius: 50%;
		background: #e8e0d4;
		color: #999;
		display: flex;
		align-items: center;
		justify-content: center;
		font-size: 0.85em;
		transition: all 0.3s;
	}
	.ms-progress-active .ms-progress-dot {
		background: #8B1A1A;
		color: #fff;
		box-shadow: 0 2px 8px rgba(139, 26, 26, 0.25);
	}
	.ms-progress-label {
		font-size: 0.8em;
		font-weight: 600;
		color: #999;
		white-space: nowrap;
	}
	.ms-progress-active .ms-progress-label {
		color: #2C1810;
	}
	.ms-progress-done .ms-progress-dot {
		background: #C5942A;
		color: #fff;
	}
	.ms-progress-done .ms-progress-label {
		color: #C5942A;
	}
	a.ms-progress-step {
		text-decoration: none !important;
	}
	a.ms-progress-step:hover .ms-progress-dot {
		opacity: 0.85;
	}
	a.ms-progress-step:hover .ms-progress-label {
		color: #A67B1F;
	}
	.ms-progress-line {
		flex: 1;
		height: 2px;
		background: #e8e0d4;
		min-width: 40px;
		margin: 0 8px;
		margin-bottom: 22px;
	}
	.ms-progress-line--done {
		background: #C5942A;
	}

	/* ── Two-column grid layout ────────────────────────────────────── */
	.ms-cart-redesign {
		display: grid;
		grid-template-columns: 1fr;
		gap: 0;
		max-width: 1140px !important;
		margin: 0 auto;
	}
	@media (min-width: 769px) {
		.ms-cart-redesign {
			grid-template-columns: 1.5fr 1fr;
			gap: 28px;
			align-items: start;
		}
	}

	/* ── Main column ───────────────────────────────────────────────── */
	.ms-cart-main {
		min-width: 0;
	}

	/* ── Cart item cards ───────────────────────────────────────────── */
	.ms-cart-items {
		display: flex;
		flex-direction: column;
		gap: 16px;
		margin-bottom: 20px;
	}
	.ms-cart-item {
		background: #fff;
		border: 1px solid #e8e0d4;
		border-radius: 12px;
		padding: 20px;
		display: grid;
		grid-template-columns: 80px 1fr;
		grid-template-rows: auto;
		gap: 16px;
		position: relative;
		transition: opacity 0.3s, transform 0.3s;
	}
	.ms-cart-item.ms-removing {
		opacity: 0;
		transform: translateX(-20px);
		max-height: 0;
		padding-top: 0;
		padding-bottom: 0;
		margin-bottom: -16px;
		border-color: transparent;
		overflow: hidden;
		transition: all 0.4s ease;
	}

	/* Remove button */
	.ms-cart-item__remove {
		position: absolute;
		top: 12px;
		right: 12px;
		z-index: 2;
	}
	.ms-remove-btn {
		display: flex;
		align-items: center;
		justify-content: center;
		width: 28px;
		height: 28px;
		border-radius: 50%;
		background: #f5f0eb;
		color: #999 !important;
		font-size: 0.75em;
		text-decoration: none !important;
		transition: all 0.2s;
	}
	.ms-remove-btn:hover {
		background: #8B1A1A;
		color: #fff !important;
	}

	/* Product image */
	.ms-cart-item__image {
		grid-row: 1;
		grid-column: 1;
	}
	.ms-cart-item__image img {
		width: 80px;
		height: 80px;
		object-fit: cover;
		border-radius: 10px;
		border: 1px solid #f0ebe5;
	}
	.ms-cart-item__image a {
		display: block;
		line-height: 0;
	}

	/* Product details */
	.ms-cart-item__details {
		grid-row: 1;
		grid-column: 2;
		min-width: 0;
	}
	.ms-cart-item__name {
		font-family: "Lato", sans-serif;
		font-weight: 700;
		font-size: 1.05em;
		line-height: 1.3;
		margin-bottom: 4px;
		padding-right: 32px;
	}
	.ms-cart-item__name a {
		color: #2C1810 !important;
		text-decoration: none !important;
	}
	.ms-cart-item__name a:hover {
		color: #8B1A1A !important;
	}
	.ms-cart-item__meta {
		font-size: 0.85em;
		color: #6B5C50;
		margin-bottom: 6px;
	}
	.ms-cart-item__price {
		font-size: 0.95em;
		color: #3D2E22;
		margin-bottom: 10px;
	}
	.ms-cart-item__bottom {
		display: flex;
		align-items: center;
		justify-content: space-between;
		flex-wrap: wrap;
		gap: 8px;
	}
	.ms-cart-item__subtotal {
		font-weight: 700;
		font-size: 1.05em;
		color: #2C1810;
		white-space: nowrap;
	}

	/* Quantity controls */
	.ms-cart-item__quantity .quantity {
		display: inline-flex;
		align-items: center;
		border: 1px solid #d1ccc4;
		border-radius: 8px;
		overflow: hidden;
	}
	.ms-cart-item__quantity .quantity .qty {
		width: 44px;
		height: 38px;
		text-align: center;
		border: none;
		font-size: 0.95em;
		font-weight: 600;
		background: #fff;
		-moz-appearance: textfield;
		padding: 0;
	}
	.ms-cart-item__quantity .quantity .qty::-webkit-outer-spin-button,
	.ms-cart-item__quantity .quantity .qty::-webkit-inner-spin-button {
		-webkit-appearance: none;
		margin: 0;
	}
	.ms-qty-btn {
		width: 38px;
		height: 38px;
		display: flex;
		align-items: center;
		justify-content: center;
		background: #faf8f5;
		border: none;
		cursor: pointer;
		font-size: 1em;
		color: #3D2E22;
		transition: background 0.2s;
		padding: 0;
		line-height: 1;
		user-select: none;
	}
	.ms-qty-btn:hover {
		background: #e8e0d4;
	}
	.ms-qty-btn:active {
		background: #d1ccc4;
	}

	/* ── Coupon card ───────────────────────────────────────────────── */
	.ms-cart-coupon {
		background: #fff;
		border: 1px solid #e8e0d4;
		border-radius: 12px;
		padding: 16px 20px;
		margin-bottom: 16px;
	}
	.ms-coupon-toggle {
		background: none;
		border: none;
		cursor: pointer;
		font-size: 0.95em;
		font-weight: 600;
		color: #3D2E22;
		padding: 0;
		display: flex;
		align-items: center;
		gap: 8px;
		width: 100%;
	}
	.ms-coupon-toggle i {
		color: #C5942A;
	}
	.ms-coupon-arrow {
		margin-left: auto;
		font-size: 0.8em;
		transition: transform 0.2s;
	}
	.ms-coupon-toggle[aria-expanded="true"] .ms-coupon-arrow {
		transform: rotate(180deg);
	}
	.ms-coupon-form {
		margin-top: 12px;
	}
	.ms-coupon-form .coupon {
		display: flex;
		gap: 8px;
	}
	.ms-coupon-form .coupon .input-text {
		flex: 1;
		border: 1px solid #d1ccc4;
		border-radius: 8px;
		padding: 10px 12px;
		font-size: 0.95em;
		transition: border-color 0.2s;
	}
	.ms-coupon-form .coupon .input-text:focus {
		border-color: #8B1A1A;
		outline: none;
		box-shadow: 0 0 0 2px rgba(139, 26, 26, 0.1);
	}
	.ms-coupon-apply {
		background: #3D2E22 !important;
		color: #fff !important;
		border: none !important;
		border-radius: 8px !important;
		padding: 10px 20px !important;
		font-weight: 600 !important;
		font-size: 0.9em !important;
		cursor: pointer;
		white-space: nowrap;
		transition: background 0.2s;
	}
	.ms-coupon-apply:hover {
		background: #2C1810 !important;
	}

	/* Hidden update cart button (AJAX updates instead) */
	.ms-update-cart-btn,
	.ms-cart-redesign button[name="update_cart"] {
		position: absolute !important;
		width: 1px !important;
		height: 1px !important;
		overflow: hidden !important;
		clip: rect(0,0,0,0) !important;
		clip-path: inset(50%) !important;
		white-space: nowrap !important;
		border: 0 !important;
		padding: 0 !important;
		margin: -1px !important;
		opacity: 0 !important;
		pointer-events: none;
	}

	/* Continue shopping link */
	.ms-cart-continue {
		margin-top: 8px;
		margin-bottom: 24px;
	}
	.ms-continue-link {
		color: #8B1A1A !important;
		text-decoration: none !important;
		font-size: 0.9em;
		font-weight: 600;
		display: inline-flex;
		align-items: center;
		gap: 6px;
		transition: color 0.2s;
	}
	.ms-continue-link:hover {
		color: #6B1414 !important;
	}

	/* ── Sidebar (order summary) ───────────────────────────────────── */
	.ms-cart-sidebar {
		order: -1;
		margin-bottom: 24px;
	}
	@media (min-width: 769px) {
		.ms-cart-sidebar {
			order: 0;
			margin-bottom: 0;
		}
	}
	.ms-cart-sidebar .cart-collaterals {
		width: 100% !important;
		float: none !important;
	}
	.ms-cart-sidebar .cart_totals {
		background: #faf8f5;
		border: 1px solid #e8e0d4;
		border-radius: 12px;
		padding: 24px 20px;
		width: 100% !important;
		float: none !important;
	}
	@media (min-width: 769px) {
		.ms-cart-sidebar .cart_totals {
			position: sticky;
			top: 24px;
		}
	}

	.ms-sidebar-title {
		font-family: "Lato", sans-serif;
		font-size: 1.15em;
		font-weight: 700;
		margin: 0 0 4px 0;
		padding: 0;
		color: #2C1810;
	}
	.ms-cart-count {
		font-size: 0.85em;
		color: #6B5C50;
		margin: 0 0 16px 0;
	}

	.ms-summary-table {
		margin-bottom: 0 !important;
		border: none !important;
	}
	.ms-summary-table th,
	.ms-summary-table td {
		padding: 8px 0 !important;
		font-size: 0.9em;
		border: none !important;
		background: transparent !important;
	}
	.ms-summary-table .order-total th,
	.ms-summary-table .order-total td {
		font-size: 1.1em;
		font-weight: 700;
		border-top: 2px solid #c5942a !important;
		padding-top: 14px !important;
		color: #2C1810;
	}

	/* Proceed to checkout button */
	.ms-cart-sidebar .wc-proceed-to-checkout {
		padding: 0;
		margin-top: 20px;
	}
	.ms-cart-sidebar .wc-proceed-to-checkout .checkout-button {
		display: block;
		width: 100%;
		padding: 14px 24px !important;
		font-size: 1.1em !important;
		font-weight: 700 !important;
		letter-spacing: 0.02em;
		border-radius: 10px !important;
		text-align: center;
		text-transform: none !important;
		background: #8B1A1A !important;
		color: #fff !important;
		border: none !important;
		transition: background 0.2s, box-shadow 0.2s;
		box-shadow: 0 2px 8px rgba(139, 26, 26, 0.2);
	}
	.ms-cart-sidebar .wc-proceed-to-checkout .checkout-button:hover {
		background: #6B1414 !important;
		box-shadow: 0 4px 12px rgba(139, 26, 26, 0.3);
	}

	/* Trust signals */
	.ms-cart-sidebar .ms-trust-signals {
		display: flex;
		align-items: center;
		gap: 6px;
		font-size: 0.8em;
		color: #888;
		margin-top: 16px;
		justify-content: center;
		flex-wrap: wrap;
	}
	.ms-trust-lock {
		font-size: 1em;
	}
	.ms-trust-sep {
		color: #ccc;
	}

	/* ── Mobile collapsible sidebar ────────────────────────────────── */
	@media (max-width: 768px) {
		.ms-cart-sidebar .ms-sidebar-title {
			cursor: pointer;
			user-select: none;
			display: flex;
			align-items: center;
			justify-content: space-between;
			gap: 10px;
			flex-wrap: nowrap;
		}
		/* Match checkout order-summary chevrons (expanded = down, collapsed = right) */
		.ms-cart-sidebar .ms-sidebar-title::after {
			content: '\f078';
			font-family: 'Font Awesome 6 Free';
			font-weight: 900;
			font-style: normal;
			font-size: 1.2rem;
			line-height: 1;
			margin-left: auto;
			flex-shrink: 0;
			padding: 8px 6px;
			color: #8B1A1A;
			opacity: 0.9;
			transition: transform 0.2s ease, opacity 0.2s ease;
			-webkit-font-smoothing: antialiased;
		}
		.ms-cart-sidebar .ms-sidebar-title:hover::after {
			opacity: 1;
		}
		.ms-cart-sidebar.ms-collapsed .ms-sidebar-title::after {
			content: '\f054';
		}
		.ms-cart-sidebar.ms-collapsed .ms-cart-count,
		.ms-cart-sidebar.ms-collapsed .ms-summary-table,
		.ms-cart-sidebar.ms-collapsed .wc-proceed-to-checkout,
		.ms-cart-sidebar.ms-collapsed .ms-trust-signals {
			display: none;
		}
	}

	/* ── Sticky bottom CTA (mobile only) ───────────────────────────── */
	.ms-cart-sticky-cta {
		display: none;
	}
	@media (max-width: 768px) {
		.ms-cart-sticky-cta {
			display: block;
			position: fixed;
			bottom: 0;
			left: 0;
			right: 0;
			z-index: 999;
			background: #fff;
			border-top: 1px solid #e8e0d4;
			box-shadow: 0 -2px 12px rgba(0,0,0,0.08);
			padding: 12px 16px;
			padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
		}
		.ms-sticky-cta-inner {
			display: flex;
			align-items: center;
			justify-content: space-between;
			max-width: 600px;
			margin: 0 auto;
			gap: 16px;
		}
		.ms-sticky-cta-total {
			display: flex;
			flex-direction: column;
		}
		.ms-sticky-label {
			font-size: 0.75em;
			color: #6B5C50;
			text-transform: uppercase;
			letter-spacing: 0.05em;
		}
		.ms-sticky-amount {
			font-weight: 700;
			font-size: 1.15em;
			color: #2C1810;
		}
		.ms-sticky-checkout-btn {
			display: inline-flex;
			align-items: center;
			gap: 6px;
			background: #8B1A1A;
			color: #fff !important;
			padding: 12px 24px;
			border-radius: 10px;
			font-weight: 700;
			font-size: 1em;
			text-decoration: none !important;
			white-space: nowrap;
			transition: background 0.2s;
			box-shadow: 0 2px 8px rgba(139, 26, 26, 0.2);
		}
		.ms-sticky-checkout-btn:hover {
			background: #6B1414;
		}

		/* Extra bottom padding so sticky bar doesn't overlap content */
		.woocommerce-cart .entry {
			padding-bottom: 80px !important;
		}
	}

	/* ── Empty cart state ──────────────────────────────────────────── */
	.ms-cart-empty {
		text-align: center;
		padding: 60px 20px 80px;
		max-width: 480px;
		margin: 0 auto;
	}
	.ms-cart-empty__icon {
		font-size: 3.5em;
		color: #C5942A;
		margin-bottom: 20px;
		opacity: 0.8;
	}
	.ms-cart-empty__title {
		font-family: "Lato", sans-serif;
		font-weight: 900;
		font-size: 1.6em;
		color: #2C1810;
		margin: 0 0 12px 0;
	}
	.ms-cart-empty__text {
		font-size: 1.05em;
		color: #6B5C50;
		margin: 0 0 28px 0;
		line-height: 1.6;
	}
	.ms-cart-empty__cta {
		display: inline-flex;
		align-items: center;
		gap: 8px;
		background: #8B1A1A;
		color: #fff !important;
		padding: 14px 32px;
		border-radius: 10px;
		font-weight: 700;
		font-size: 1.05em;
		text-decoration: none !important;
		transition: background 0.2s, box-shadow 0.2s;
		box-shadow: 0 2px 8px rgba(139, 26, 26, 0.2);
	}
	.ms-cart-empty__cta:hover {
		background: #6B1414;
		box-shadow: 0 4px 12px rgba(139, 26, 26, 0.3);
	}

	/* ── Cross-sells section ───────────────────────────────────────── */
	.woocommerce-cart .cross-sells {
		clear: both;
		max-width: 1140px;
		margin: 40px auto 0;
		padding: 0 16px;
	}
	.woocommerce-cart .cross-sells > h2 {
		font-family: "Lato", sans-serif;
		font-weight: 900;
		font-size: 1.4em;
		color: #2C1810;
		margin-bottom: 20px;
	}
	.woocommerce-cart .cross-sells ul.products {
		display: grid !important;
		grid-template-columns: repeat(4, 1fr);
		gap: 20px;
		list-style: none;
		padding: 0;
		margin: 0;
	}
	@media (max-width: 768px) {
		.woocommerce-cart .cross-sells ul.products {
			grid-template-columns: repeat(2, 1fr);
			gap: 12px;
		}
	}
	.woocommerce-cart .cross-sells ul.products li.product {
		background: #fff;
		border: 1px solid #e8e0d4;
		border-radius: 12px;
		padding: 16px;
		text-align: center;
		transition: box-shadow 0.2s, border-color 0.2s;
	}
	.woocommerce-cart .cross-sells ul.products li.product:hover {
		border-color: #C5942A;
		box-shadow: 0 4px 16px rgba(0,0,0,0.06);
	}
	.woocommerce-cart .cross-sells ul.products li.product img {
		border-radius: 8px;
		margin-bottom: 10px;
	}
	.woocommerce-cart .cross-sells ul.products li.product .woocommerce-loop-product__title {
		font-size: 0.95em;
		font-weight: 700;
		margin-bottom: 6px;
	}
	.woocommerce-cart .cross-sells ul.products li.product .price {
		font-size: 0.9em;
		color: #3D2E22;
		margin-bottom: 10px;
	}
	.woocommerce-cart .cross-sells ul.products li.product .button {
		font-size: 0.85em;
		padding: 8px 16px;
		border-radius: 8px;
	}

	/* ── WooCommerce notices on cart ───────────────────────────────── */
	.woocommerce-cart .woocommerce-notices-wrapper {
		max-width: none;
		width: 100%;
		margin: 0 0 16px;
	}
	.woocommerce-cart .woocommerce-message,
	.woocommerce-cart .woocommerce-error,
	.woocommerce-cart .woocommerce-info {
		border-radius: 10px;
	}

	/* ── Whole-cart updating overlay during AJAX ────────────────────── */
	.ms-cart-redesign.ms-updating {
		pointer-events: none;
		opacity: 0.55;
		transition: opacity 0.2s;
	}

	/* ── AJAX notice bar (undo, coupon messages, etc.) ────────────── */
	.ms-ajax-notices {
		max-width: none;
		width: 100%;
		margin: 12px 0;
		padding: 0 16px;
		box-sizing: border-box;
	}
	.ms-ajax-notices .woocommerce-message::before,
	.ms-ajax-notices .woocommerce-error::before,
	.ms-ajax-notices .woocommerce-info::before {
		display: none;
	}
	.ms-ajax-notices .woocommerce-message {
		background: #fef8f0;
		border: 1px solid #d4a76a;
		border-left: 4px solid #8B1A1A;
		color: #4A3728;
		padding: 12px 16px;
		border-radius: 6px;
		margin-bottom: 8px;
		font-size: 0.95em;
		display: flex;
		align-items: center;
		justify-content: space-between;
		gap: 12px;
	}
	.ms-ajax-notices .woocommerce-message .restore-item {
		background: #8B1A1A;
		color: #fff;
		padding: 6px 16px;
		border-radius: 4px;
		text-decoration: none;
		font-weight: 600;
		font-size: 0.9em;
		white-space: nowrap;
		flex-shrink: 0;
		transition: background 0.2s;
	}
	.ms-ajax-notices .woocommerce-message .restore-item:hover {
		background: #a52a2a;
	}
	.ms-ajax-notices .woocommerce-error {
		background: #fef0f0;
		border: 1px solid #d4a0a0;
		border-left: 4px solid #c00;
		color: #4A3728;
		padding: 12px 16px;
		border-radius: 6px;
		margin-bottom: 8px;
	}
	.ms-ajax-notices .woocommerce-info {
		background: #f0f5fe;
		border: 1px solid #a0b8d4;
		border-left: 4px solid #2a5a8b;
		color: #4A3728;
		padding: 12px 16px;
		border-radius: 6px;
		margin-bottom: 8px;
	}

	/* ── Loading overlay on cart item during AJAX ──────────────────── */
	.ms-cart-item.ms-loading {
		pointer-events: none;
	}
	.ms-cart-item.ms-loading::after {
		content: '';
		position: absolute;
		inset: 0;
		background: rgba(255,255,255,0.6);
		border-radius: 12px;
		z-index: 3;
	}
	.ms-cart-item.ms-loading::before {
		content: '';
		position: absolute;
		top: 50%;
		left: 50%;
		width: 24px;
		height: 24px;
		margin: -12px 0 0 -12px;
		border: 3px solid #e8e0d4;
		border-top-color: #8B1A1A;
		border-radius: 50%;
		animation: ms-spin 0.6s linear infinite;
		z-index: 4;
	}

	/* ── Mobile cart item compact layout ────────────────────────────── */
	@media (max-width: 768px) {
		.ms-cart-item {
			grid-template-columns: 64px 1fr;
			gap: 12px;
			padding: 16px;
			border-radius: 10px;
		}
		.ms-cart-item__image img {
			width: 64px;
			height: 64px;
			border-radius: 8px;
		}
		.ms-cart-item__name {
			font-size: 0.95em;
		}
		.ms-cart-item__bottom {
			flex-direction: column;
			align-items: flex-start;
			gap: 8px;
		}
		.ms-cart-sidebar .cart_totals {
			padding: 18px 16px;
			border-radius: 10px;
		}
		.woocommerce-cart .ms-cart-progress {
			margin-bottom: 20px;
			padding: 0 16px;
		}
		.ms-progress-dot {
			width: 30px;
			height: 30px;
			font-size: 0.75em;
		}
		.ms-progress-label {
			font-size: 0.7em;
		}
		.ms-progress-line {
			min-width: 24px;
			margin-bottom: 18px;
		}
		.ms-qty-btn {
			width: 44px;
			height: 44px;
			font-size: 1.1em;
		}
		.ms-cart-item__quantity .quantity .qty {
			width: 48px;
			height: 44px;
			font-size: 1em;
		}
	}
