/**
 * VPure cart page.
 *
 * Premium presentation over native WooCommerce cart markup. Loaded on
 * is_cart() only. See inc/cart.php and woocommerce/cart/cart.php.
 */

/* The shortcode wrapper inherits a narrow theme constraint (~720px);
   release it so .vp-cart (1240px, centered) controls the page width. */
body.woocommerce-cart div.woocommerce {
	max-width: none;
}

/* The page template prints its own H1 ("Cart"); the VPure heading
   inside .vp-cart is canonical, so the generic one stays hidden here. */
body.woocommerce-cart .entry-header {
	display: none;
}

/* ============================================
   Scaffold
   ============================================ */

.vp-cart {
	max-width: 1240px;
	margin-inline: auto;
	padding: 20px 24px 72px;
}

.vp-cart .shop-breadcrumb {
	margin-bottom: 24px;
}

.vp-cart__heading {
	margin-bottom: 36px;
}

.vp-cart__title {
	margin: 0 0 10px;
	font-family: var(--font-display);
	font-size: clamp(2.5rem, 4vw, 3rem);
	font-weight: 700;
	line-height: 1.1;
	color: var(--color-text);
}

.vp-cart__count {
	margin: 0;
	font-family: var(--font-body);
	font-size: 0.875rem;
	color: var(--color-text-muted);
}

/* ============================================
   Notices (native WooCommerce, VPure skin)
   ============================================ */

.vp-cart .woocommerce-message,
.vp-cart .woocommerce-error,
.vp-cart .woocommerce-info,
.vp-cart__notices .woocommerce-message,
.vp-cart__notices .woocommerce-error,
.vp-cart__notices .woocommerce-info {
	border: 0;
	border-left: 4px solid;
	border-radius: 12px;
	padding: 14px 18px;
	font-family: var(--font-body);
	font-size: 0.9375rem;
	margin: 0 0 20px;
	list-style: none;
}

.vp-cart .woocommerce-message,
.vp-cart__notices .woocommerce-message {
	border-color: var(--color-accent-green);
	background: #f0f7e8;
	color: var(--color-text);
}

.vp-cart .woocommerce-error,
.vp-cart__notices .woocommerce-error {
	border-color: var(--color-primary);
	background: #fdf0f0;
	color: var(--color-text);
}

.vp-cart .woocommerce-info,
.vp-cart__notices .woocommerce-info {
	border-color: var(--color-text-muted);
	background: var(--color-surface);
	color: var(--color-text);
}

.vp-cart .woocommerce-message a,
.vp-cart .woocommerce-error a,
.vp-cart .woocommerce-info a {
	color: var(--color-primary);
	font-weight: 700;
}

/* ============================================
   Layout
   ============================================ */

.vp-cart__grid {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(320px, 360px);
	gap: 48px;
	align-items: start;
}

/* ============================================
   Cart items (rows, not tables)
   ============================================ */

.vp-cart__list {
	margin: 0;
	padding: 0;
	list-style: none;
}

.vp-cart-item {
	display: grid;
	grid-template-columns: 112px minmax(0, 1fr);
	gap: 24px;
	padding: 24px 0;
	border-top: 1px solid var(--color-border);
	transition: opacity var(--transition-fast);
}

.vp-cart-item:last-child {
	border-bottom: 1px solid var(--color-border);
}

.vp-cart-item.is-loading {
	opacity: 0.55;
	pointer-events: none;
}

.vp-cart-item__image-link {
	display: block;
	width: 112px;
	aspect-ratio: 1 / 1;
	border-radius: 12px;
	overflow: hidden;
	background: var(--color-surface);
}

.vp-cart-item__image-link img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: contain;
}

.vp-cart-item__body {
	min-width: 0;
}

.vp-cart-item__top {
	display: flex;
	justify-content: space-between;
	align-items: flex-start;
	gap: 16px;
}

.vp-cart-item__info {
	min-width: 0;
}

.vp-cart-item__name {
	margin: 0 0 6px;
	font-family: var(--font-body);
	font-size: 1.0625rem;
	font-weight: 700;
	line-height: 1.35;
}

.vp-cart-item__name a {
	color: var(--color-text);
	text-decoration: none;
}

.vp-cart-item__name a:hover {
	color: var(--color-primary);
}

.vp-cart-item dl.variation {
	display: flex;
	flex-direction: column;
	gap: 4px;
	margin: 0 0 8px;
	font-size: 0.8125rem;
	color: var(--color-text-muted);
}

.vp-cart-item dl.variation .variation__row {
	display: flex;
	flex-wrap: wrap;
	gap: 4px 8px;
}

.vp-cart-item dl.variation dt,
.vp-cart-item dl.variation dd {
	margin: 0;
	padding: 0;
}

.vp-cart-item dl.variation dd {
	font-weight: 700;
	color: var(--color-text);
}

.vp-cart-item__price {
	display: flex;
	align-items: baseline;
	flex-wrap: wrap;
	column-gap: 8px;
	margin: 0;
	font-size: 1rem;
	font-weight: 700;
	color: var(--color-primary);
}

.vp-cart-item__price del,
.vp-cart-item__mrp {
	position: relative;
	display: inline-block;
	font-size: 0.8em;
	font-weight: 400;
	color: var(--color-text-muted);
	text-decoration: none;
}

.vp-cart-item__price del::after,
.vp-cart-item__mrp::after {
	content: "";
	position: absolute;
	left: -2px;
	right: -2px;
	top: 50%;
	height: 1px;
	background: currentColor;
	opacity: 0.85;
	transform: rotate(-8deg);
	transform-origin: center;
	pointer-events: none;
}

.vp-cart-item__price ins {
	text-decoration: none;
	order: -1;
}

.backorder_notification {
	font-size: 0.8125rem;
	color: var(--color-text-muted);
	margin: 6px 0 0;
}

.vp-cart-item__remove {
	flex: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	border-radius: 50%;
	color: var(--color-text-muted);
	transition:
		color var(--transition-fast),
		background-color var(--transition-fast);
}

.vp-cart-item__remove svg {
	width: 18px;
	height: 18px;
}

.vp-cart-item__remove:hover {
	color: var(--color-primary);
	background: var(--color-surface);
}

.vp-cart-item__remove:focus-visible {
	outline: 2px solid var(--color-primary);
	outline-offset: 2px;
}

.vp-cart-item__bottom {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	margin-top: 14px;
}

/* Stepper (mirrors the single-product control). */
.vp-qty {
	display: inline-flex;
	align-items: stretch;
	border: 1px solid var(--color-border);
	border-radius: 10px;
	background: var(--color-white);
	overflow: hidden;
}

.vp-qty__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 42px;
	min-height: 44px;
	padding: 0;
	border: 0;
	background: transparent;
	color: var(--color-text);
	cursor: pointer;
	transition:
		background-color var(--transition-fast),
		color var(--transition-fast);
}

.vp-qty__btn svg {
	width: 15px;
	height: 15px;
}

.vp-qty__btn:hover {
	background: var(--color-surface);
	color: var(--color-primary);
}

.vp-qty__btn:active {
	transform: scale(0.94);
}

.vp-qty__btn:focus-visible {
	outline: 2px solid var(--color-primary);
	outline-offset: -2px;
}

.vp-qty .quantity {
	display: flex;
}

.vp-qty .quantity .qty {
	width: 46px;
	border: 0;
	background: transparent;
	text-align: center;
	font-family: var(--font-body);
	font-size: 0.9375rem;
	font-weight: 700;
	color: var(--color-text);
	-moz-appearance: textfield;
	appearance: textfield;
}

.vp-qty .quantity .qty::-webkit-outer-spin-button,
.vp-qty .quantity .qty::-webkit-inner-spin-button {
	-webkit-appearance: none;
	margin: 0;
}

.vp-cart-item__subtotal {
	margin: 0;
	font-family: var(--font-body);
	font-size: 1.0625rem;
	font-weight: 700;
	color: var(--color-text);
	white-space: nowrap;
}

.vp-cart-item__subtotal .amount {
	color: var(--color-text);
}

.vp-cart-item__subtotal-label {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	clip-path: inset(50%);
	white-space: nowrap;
}

/* ---------- Form actions: coupon + minimized update ---------- */

.vp-cart__actions {
	margin-top: 24px;
}

.vp-coupon__label {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 0.875rem;
	font-weight: 700;
	margin-bottom: 10px;
}

.vp-coupon__label svg {
	width: 16px;
	height: 16px;
}

.vp-coupon__row {
	display: flex;
	gap: 10px;
}

.vp-coupon__input {
	flex: 1;
	min-width: 0;
	padding: 11px 14px;
	border: 1px solid var(--color-border);
	border-radius: 12px;
	background: var(--color-white);
	font-family: var(--font-body);
	font-size: 0.9375rem;
}

.vp-coupon__input:focus {
	outline: none;
	border-color: var(--color-primary);
}

.vp-coupon__apply {
	flex: none;
	padding: 11px 22px;
	border: 0;
	border-radius: 12px;
	background: var(--color-text);
	color: var(--color-white);
	font-family: var(--font-body);
	font-size: 0.875rem;
	font-weight: 700;
	cursor: pointer;
	transition: background-color var(--transition-fast);
}

.vp-coupon__apply:hover {
	background: var(--color-primary);
}

/* Update-cart button: present for native/no-JS submit, minimized. */
.vp-cart__update {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	clip-path: inset(50%);
	white-space: nowrap;
}

/* ============================================
   Order summary
   ============================================ */

.vp-summary__inner {
	position: sticky;
	top: 24px;
	background: var(--color-surface);
	border: 1px solid var(--color-border);
	border-radius: 16px;
	padding: 26px;
}

.vp-summary__title {
	margin: 0 0 18px;
	font-family: var(--font-display);
	font-size: 1.375rem;
	font-weight: 700;
	color: var(--color-text);
}

.vp-summary__rows {
	margin: 0;
}

.vp-summary__row {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	gap: 16px;
	padding: 7px 0;
	font-size: 0.9375rem;
}

.vp-summary__row dt {
	margin: 0;
	color: var(--color-text-muted);
}

.vp-summary__row dd {
	margin: 0;
	font-weight: 700;
	color: var(--color-text);
	text-align: right;
}

.vp-summary__row--discount dd,
.vp-summary__row--discount dt {
	color: var(--color-primary);
}

.vp-summary__row--shipping dd {
	font-weight: 500;
	font-size: 0.875rem;
}

.vp-summary__total {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	gap: 16px;
	margin-top: 12px;
	padding-top: 16px;
	border-top: 1px solid var(--color-border);
	font-size: 1.25rem;
	font-weight: 700;
}

.vp-summary__total-value {
	color: var(--color-primary);
	white-space: nowrap;
}

.vp-summary__cta {
	margin-top: 20px;
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.vp-checkout-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	width: 100%;
	min-height: 54px;
	padding: 14px 28px;
	border-radius: 12px;
	background: var(--color-primary);
	color: var(--color-white);
	font-family: var(--font-body);
	font-size: 1rem;
	font-weight: 700;
	text-decoration: none;
	transition:
		background-color var(--transition-fast),
		transform var(--transition-fast),
		box-shadow var(--transition-fast);
}

.vp-checkout-btn svg {
	width: 18px;
	height: 18px;
}

.vp-checkout-btn:hover {
	background: var(--color-primary-dark);
	color: var(--color-white);
	transform: translateY(-1px);
	box-shadow: 0 12px 28px rgba(0, 0, 0, 0.12);
}

.vp-checkout-btn:focus-visible {
	outline: 2px solid var(--color-primary);
	outline-offset: 2px;
}

.vp-continue {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	color: var(--color-text);
	font-size: 0.9375rem;
	font-weight: 700;
	text-decoration: none;
}

.vp-continue svg {
	width: 16px;
	height: 16px;
}

.vp-continue:hover {
	color: var(--color-primary);
}

/* Cross-sells reuse the global card grid language. */
.vp-cart__collaterals {
	margin-top: 56px;
}

.cross-sells > h2 {
	font-family: var(--font-display);
	font-size: clamp(1.5rem, 2.4vw, 2rem);
	font-weight: 700;
	text-align: left;
	margin: 0 0 20px;
}

.cross-sells ul.products {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 20px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.cross-sells ul.products li {
	min-width: 0;
}

.cross-sells ul.products li .product-card {
	height: 100%;
}

/* ============================================
   Empty cart
   ============================================ */

.vp-empty {
	max-width: 480px;
	margin: 24px auto;
	padding: 64px 24px;
	text-align: center;
}

.vp-empty__icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 96px;
	height: 96px;
	border-radius: 50%;
	background: var(--color-surface);
	color: var(--color-text);
	margin-bottom: 24px;
}

.vp-empty__icon svg {
	width: 44px;
	height: 44px;
}

.vp-empty__title {
	margin: 0 0 12px;
	font-family: var(--font-display);
	font-size: clamp(1.75rem, 4vw, 2.25rem);
	font-weight: 700;
	color: var(--color-text);
}

.vp-empty__text {
	margin: 0 0 28px;
	font-size: 1rem;
	line-height: 1.6;
	color: var(--color-text-muted);
}

.vp-empty__cta {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	min-height: 54px;
	padding: 14px 36px;
	border-radius: var(--radius-pill);
	background: var(--color-primary);
	color: var(--color-white);
	font-weight: 700;
	text-decoration: none;
	transition:
		background-color var(--transition-fast),
		transform var(--transition-fast);
}

.vp-empty__cta svg {
	width: 18px;
	height: 18px;
}

.vp-empty__cta:hover {
	background: var(--color-primary-dark);
	color: var(--color-white);
	transform: translateY(-1px);
}

/* ============================================
   Responsive
   ============================================ */

@media (max-width: 63.99em) {
	.vp-cart__grid {
		grid-template-columns: minmax(0, 1fr);
		gap: 0;
	}

	.vp-summary {
		margin-top: 36px;
	}

	.vp-summary__inner {
		position: static;
	}

	.cross-sells ul.products {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}

@media (max-width: 47.99em) {
	.vp-cart {
		padding: 12px 16px 56px;
	}

	.vp-cart__heading {
		margin-bottom: 24px;
	}

	.vp-cart__title {
		font-size: 2rem;
	}

	.vp-cart-item {
		grid-template-columns: 88px minmax(0, 1fr);
		gap: 14px;
		padding: 20px 0;
	}

	.vp-cart-item__image-link {
		width: 88px;
		border-radius: 10px;
	}

	.vp-cart-item__name {
		font-size: 1rem;
	}

	.vp-cart-item__bottom {
		margin-top: 12px;
	}

	.vp-qty__btn {
		width: 40px;
		min-height: 42px;
	}

	.vp-cart-item__subtotal {
		font-size: 1rem;
	}

	.vp-coupon__row {
		max-width: none;
	}

	.vp-checkout-btn {
		min-height: 54px;
	}

	.cross-sells ul.products {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 14px;
	}

	.vp-empty {
		padding: 48px 16px;
	}
}

/* ============================================
   Reduced motion
   ============================================ */

@media (prefers-reduced-motion: reduce) {
	.vp-cart-item,
	.vp-cart-item__remove,
	.vp-qty__btn,
	.vp-coupon__apply,
	.vp-checkout-btn,
	.vp-empty__cta {
		transition: none;
	}

	.vp-checkout-btn:hover,
	.vp-empty__cta:hover {
		transform: none;
	}
}
