/**
 * Cart Page Styles
 *
 * Styles for the WooCommerce cart page.
 *
 * @package WPR\NPX
 */

/* ==========================================================================
   Cart Page Layout
   ========================================================================== */

.woocommerce-cart .npx-woocommerce {
	padding: 48px 0 96px;
}

.woocommerce-cart .npx-container {
	max-width: 1200px;
	margin: 0 auto;
	padding: 0 24px;
}

@media (max-width: 480px) {
	.woocommerce-cart .npx-container {
		padding: 0 16px;
	}
}

/* Hide the WordPress page title - we use our own */
.woocommerce-cart .entry-title,
.woocommerce-cart article>header,
.woocommerce-cart .page-title,
.woocommerce-cart .woocommerce>h1:first-child,
.woocommerce-cart .woocommerce>h2:first-child {
	display: none;
}

/* ==========================================================================
   Cart Header
   ========================================================================== */

.npx-cart-header {
	margin-bottom: 48px;
}

.npx-cart-header__title {
	font-family: 'SF Pro Display', -apple-system, BlinkMacSystemFont, sans-serif;
	font-size: 48px;
	font-weight: 600;
	line-height: 1.1;
	color: #000000;
	margin: 0;
}

/* ==========================================================================
   Cart Form
   ========================================================================== */

.npx-cart-form {
	margin-bottom: 32px;
}

/* ==========================================================================
   Cart Table
   ========================================================================== */

.npx-cart-table {
	width: 100%;
	border-collapse: separate !important;
	border-spacing: 0;
	margin-bottom: 24px !important;
	border: 1px solid #D2D2D7;
	border-radius: 4px;
	overflow: hidden;
}

.npx-cart-table thead {
	background-color: #F5F5F5;
}

.npx-cart-table th {
	padding: 16px 20px;
	font-family: 'SF Pro Display', -apple-system, BlinkMacSystemFont, sans-serif;
	font-size: 14px;
	font-weight: 600;
	text-align: left;
	color: #000000;
	border-bottom: 1px solid #D2D2D7;
}

.npx-cart-table td {
	padding: 20px;
	font-family: 'SF Pro Display', -apple-system, BlinkMacSystemFont, sans-serif;
	font-size: 20px;
	vertical-align: middle;
	border-bottom: 1px solid #D2D2D7;
}

.npx-cart-table tbody tr:last-child td {
	border-bottom: none;
}

/* Column Widths */
.npx-cart-table .product-remove {
	width: 50px;
	text-align: center;
}

.npx-cart-table .product-thumbnail {
	width: 80px;
}

.npx-cart-table .product-quantity {
	width: 150px;
}

.npx-cart-table .product-price,
.npx-cart-table .product-subtotal {
	width: 120px;
	text-align: right;
}

.npx-cart-table th.product-price,
.npx-cart-table th.product-subtotal {
	text-align: center;
}

/* ==========================================================================
   Cart Item
   ========================================================================== */

.npx-cart-item {
	transition: background-color 0.2s ease;
}

.npx-cart-item:hover {
	background-color: rgba(0, 0, 0, 0.02);
}

/* Remove Button */
.npx-cart__remove {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 24px;
	height: 24px;
	color: #6e6e73;
	background-color: transparent;
	border: none;
	transition: color 0.2s ease;
	text-decoration: none;
}

.npx-cart__remove:hover {
	color: #dc3545;
}

.npx-cart__remove svg {
	width: 16px;
	height: 16px;
}

/* Product Thumbnail */
.npx-cart-table .product-thumbnail img {
	width: 64px;
	height: 64px;
	object-fit: contain;
	border-radius: 8px;
}

.npx-cart-table .product-thumbnail a {
	display: block;
}

/* Product Name */
.npx-cart-table .product-name a {
	font-weight: 500;
	color: #000000;
	text-decoration: none;
	transition: color 0.2s ease;
}

.npx-cart-table .product-name a:hover {
	color: #0071E3;
}

/* Variation Data */
.npx-cart__item-variation,
.npx-cart-item__variation {
	display: block;
	margin-top: 6px;
	font-size: 18px;
	font-weight: 400;
	color: var(--wp--preset--color--black, #000000);
	font-family: var(--wp--preset--font-family--primary, inherit);
}

/* Hide WooCommerce default variation dl (replaced by Variables span) */
.npx-cart-table .product-name dl.variation {
	display: none !important;
}

/* ==========================================================================
   Quantity Controls
   ========================================================================== */

.quantity {
	display: inline-flex;
	align-items: center;
	gap: 0;
	border: none;
	border-radius: 0;
	overflow: visible;
}

.quantity .qty {
	width: 48px;
	height: 56px;
	padding: 0;
	text-align: center;
	font-family: 'SF Pro Display', -apple-system, BlinkMacSystemFont, sans-serif;
	font-size: 20px !important;
	font-weight: 500;
	color: #000000;
	background-color: #ffffff;
	border: 2px solid #D2D2D7 !important;
	margin-left: 8px;
	margin-right: 8px;
	-moz-appearance: textfield;
}

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

.quantity .qty:focus {
	outline: none;
}

/* Quantity +/- buttons added via JS */
.npx-quantity__btn {
	position: relative;
	z-index: 10;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	background-color: #F5F5F5;
	border: 2px solid #D2D2D7;
	cursor: pointer;
	transition: background-color 0.2s ease;
	color: #000000;
}

.npx-quantity__btn--minus {
	border-radius: 4px;
}

.npx-quantity__btn--plus {
	border-radius: 4px;
}

.npx-quantity__btn:hover {
	background-color: #E8E8ED;
}

.npx-quantity__btn:focus {
	outline: none;
	background-color: #E8E8ED;
}

/* ==========================================================================
   Cart Actions
   ========================================================================== */

.npx-cart-actions {
	display: flex;
	justify-content: space-between;
	align-items: flex-start;
	gap: 24px;
	padding: 24px;
	background-color: #ffffff;
	border: 1px solid #D2D2D7;
	border-bottom-left-radius: 4px;
	border-bottom-right-radius: 4px;
}

/* Coupon Section */
.npx-cart-actions__coupon .coupon {
	display: flex;
	gap: 12px;
}

.npx-cart-actions__coupon .coupon input[type="text"] {
	min-width: 200px;
	padding: 12px 16px;
	font-family: 'SF Pro Display', -apple-system, BlinkMacSystemFont, sans-serif;
	font-size: 17px !important;
	font-weight: 400;
	border: 1px solid #D2D2D7;
	border-radius: 8px;
}

.npx-cart-actions__coupon .coupon input[type="text"]:focus {
	outline: none;
	border-color: #0071E3;
	box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.1);
}

.npx-cart-actions__coupon .coupon input[type="text"]::placeholder {
	color: #6e6e73;
}

/* Update Cart Button */
.npx-cart-actions__update {
	display: flex;
	align-items: center;
	gap: 16px;
}

/* ==========================================================================
   Cart Totals
   ========================================================================== */

.npx-cart-totals-wrapper {
	display: flex;
	justify-content: flex-end;
	margin-top: 32px;
}

.cart-collaterals {
	width: 100%;
	max-width: 400px;
}

/* Hide cross-sells */
.cross-sells {
	display: none;
}

.cart_totals {
	background-color: #ffffff;
	border: 1px solid #D2D2D7;
	border-radius: 4px;
	overflow: hidden;
}

.cart_totals>h2 {
	font-family: 'SF Pro Display', -apple-system, BlinkMacSystemFont, sans-serif;
	font-weight: 500;
	color: #000000;
	margin: 0;
	padding: 20px 24px;
	background-color: #F5F5F5;
	border-bottom: 1px solid #D2D2D7;
}

.cart_totals table {
	width: 100%;
	border-collapse: collapse;
}

.cart_totals table th,
.cart_totals table td {
	padding: 16px 24px;
	font-family: 'SF Pro Display', -apple-system, BlinkMacSystemFont, sans-serif;
	font-size: 20px;
	border-bottom: 1px solid #D2D2D7;
}

.cart_totals table th {
	font-weight: 500;
	text-align: left;
	color: #000000;
}

.cart_totals table td {
	text-align: right;
	color: #000000;
}

/* Shipping methods in cart totals */
.cart_totals .woocommerce-shipping-methods {
	list-style: none;
	margin: 0;
	padding: 0;
}

.cart_totals .woocommerce-shipping-methods li {
	margin-bottom: 6px;
}

.cart_totals .woocommerce-shipping-methods li:last-child {
	margin-bottom: 0;
}

.cart_totals .woocommerce-shipping-methods input[type="radio"] {
	width: 16px;
	height: 16px;
	accent-color: var(--npx-primary, #0071E3);
	vertical-align: middle;
	margin-right: 6px;
}

.cart_totals .woocommerce-shipping-methods label {
	font-size: 14px;
	font-weight: 400;
	color: #000000;
	cursor: pointer;
}

.cart_totals .woocommerce-shipping-destination {
	display: none;
}

.cart_totals .order-total th,
.cart_totals .order-total td {
	font-size: 16px;
	font-weight: 600;
	border-bottom: none;
}

/* Proceed to Checkout Button */
.wc-proceed-to-checkout {
	padding: 20px 24px;
}

.wc-proceed-to-checkout .checkout-button,
.npx-cart__checkout-button {
	display: block;
	width: 100%;
	padding: 16px 24px;
	font-family: 'SF Pro Display', -apple-system, BlinkMacSystemFont, sans-serif;
	font-size: 14px;
	font-weight: 600;
	text-align: center;
	background-color: #0071E3;
	color: #ffffff;
	text-decoration: none;
	border: none;
	border-radius: 30px;
	cursor: pointer;
	transition: background-color 0.2s ease;
}

.wc-proceed-to-checkout .checkout-button:hover,
.npx-cart__checkout-button:hover {
	background-color: #005BB5;
	color: #ffffff;
}

/* ==========================================================================
   NPX Button Styles (shared)
   ========================================================================== */

.npx-button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 16px 24px;
	font-family: 'SF Pro Display', -apple-system, BlinkMacSystemFont, sans-serif;
	font-size: 17px;
	font-weight: 400;
	text-decoration: none;
	border: none;
	border-radius: 30px;
	cursor: pointer;
	transition: background-color 0.2s ease;
}

.npx-button--primary {
	background-color: #0071E3;
	color: #ffffff;
}

.npx-button--primary:hover {
	background-color: #005BB5;
	color: #ffffff;
}

/* ==========================================================================
   Empty Cart
   ========================================================================== */

.cart-empty {
	text-align: center;
	padding: 96px 24px;
}

.cart-empty.woocommerce-info {
	background-color: #F5F5F5;
	border: none;
	border-radius: 16px;
	font-size: 18px;
}

.return-to-shop {
	margin-top: 24px;
}

.return-to-shop .button {
	display: inline-block;
	padding: 16px 32px;
	background-color: #0071E3;
	color: #ffffff;
	text-decoration: none;
	border-radius: 30px;
	transition: background-color 0.2s ease;
}

.return-to-shop .button:hover {
	background-color: #005BB5;
}

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

@media (max-width: 1024px) {
	.npx-cart-totals-wrapper {
		justify-content: stretch;
	}

	.cart-collaterals {
		max-width: none;
	}
}

@media (max-width: 768px) {
	.npx-cart-header__title {
		font-size: 36px;
	}

	/* Mobile Cart Table */
	.npx-cart-table,
	.npx-cart-table tbody {
		display: block !important;
		width: 100% !important;
		box-sizing: border-box !important;
		border: none !important;
		background: transparent !important;
	}

	.npx-cart-table thead {
		display: none !important;
	}

	/* Use Grid for Cart Items */
	.woocommerce table.npx-cart-table tbody tr {
		display: grid !important;
		grid-template-columns: 80px minmax(0, 1fr) 32px;
		grid-template-rows: auto auto auto auto;
		grid-template-areas:
			"thumb name remove"
			"thumb price price"
			"qty qty qty"
			"subtotal subtotal subtotal";
		gap: 12px 16px;
		align-items: center;
		padding: 16px !important;
		margin-bottom: 24px !important;
		border: 1px solid #D2D2D7 !important;
		border-radius: 12px !important;
		background-color: #ffffff;
		box-sizing: border-box !important;
		width: 100% !important;
	}

	.woocommerce table.npx-cart-table tbody td {
		display: flex !important;
		padding: 0 !important;
		border: none !important;
		text-align: left !important;
		align-items: center;
	}

	.woocommerce table.npx-cart-table tbody td::before {
		display: none !important;
		/* Hide WooCommerce duplicated labels */
	}

	.woocommerce table.npx-cart-table .product-remove {
		grid-area: remove;
		justify-content: flex-end !important;
		width: auto !important;
	}

	.woocommerce table.npx-cart-table .product-thumbnail {
		grid-area: thumb;
		width: 100% !important;
	}

	.woocommerce table.npx-cart-table .product-name {
		grid-area: name;
		display: flex !important;
		flex-direction: column !important;
		align-items: flex-start !important;
		gap: 4px;
	}

	.woocommerce table.npx-cart-table .product-price {
		grid-area: price;
		justify-content: flex-start !important;
		width: auto !important;
	}

	.woocommerce table.npx-cart-table .product-price .amount {
		font-size: 16px;
		font-weight: 500;
	}

	.woocommerce table.npx-cart-table .product-quantity {
		grid-area: qty;
		width: 100% !important;
		margin-top: 8px;
		justify-content: flex-start !important;
	}

	.woocommerce table.npx-cart-table .product-quantity .quantity {
		margin: 0 !important;
		overflow: visible !important;
	}

	.woocommerce table.npx-cart-table .product-quantity .quantity .qty {
		height: 48px;
		font-size: 18px !important;
	}

	.woocommerce table.npx-cart-table .product-subtotal {
		grid-area: subtotal;
		justify-content: space-between !important;
		width: 100% !important;
		margin-top: 12px;
		padding-top: 12px !important;
		border-top: 1px solid #F5F5F5 !important;
	}

	/* Add label for subtotal on mobile since it's on a new row */
	.woocommerce table.npx-cart-table .product-subtotal::before {
		content: "Subtotal:";
		display: block !important;
		font-size: 14px;
		font-weight: 500;
		color: #6e6e73;
	}

	.woocommerce table.npx-cart-table .product-subtotal .amount {
		font-size: 18px;
		font-weight: 600;
	}

	/* Cart Actions */
	.npx-cart-actions {
		flex-direction: column;
		gap: 24px;
		align-items: center;
	}

	.npx-cart-actions__coupon {
		width: 100%;
	}

	.npx-cart-actions__coupon .coupon {
		display: flex;
		flex-direction: row;
		flex-wrap: wrap;
		width: 100%;
		gap: 8px;
	}

	.npx-cart-actions__coupon .coupon input[type="text"] {
		flex: 1;
		width: 100% !important;
		margin-bottom: 0;
	}

	.npx-cart-actions__coupon .coupon button {
		flex: 1;
		width: 100% !important;
		white-space: nowrap;
	}

	/* Force error messages inside the coupon container to drop down and center */
	.npx-cart-actions__coupon .coupon> :not(input):not(button):not(label) {
		flex: 1 1 100%;
		width: 100%;
		text-align: center;
		margin-top: 4px;
		font-size: 14px;
	}

	.npx-cart-actions__update {
		display: flex;
		justify-content: center;
		width: 100%;
	}

	.npx-cart-actions__update .button {
		width: auto;
	}

	/* Cart Totals */
	.woocommerce .cart_totals table.shop_table_responsive tbody tr {
		display: flex !important;
		align-items: center;
		justify-content: space-between;
		padding: 16px 12px !important;
		margin: 0;
		border: none !important;
		border-bottom: 1px solid #D2D2D7 !important;
		border-radius: 0;
		background-color: transparent;
	}

	.woocommerce .cart_totals table.shop_table_responsive tbody tr:last-child {
		border-bottom: none !important;
	}

	.woocommerce .cart_totals table.shop_table_responsive th,
	.woocommerce .cart_totals table.shop_table_responsive td {
		padding: 0 !important;
		border: none !important;
		width: auto !important;
		display: block !important;
	}

	.woocommerce .cart_totals table.shop_table_responsive th {
		font-size: 16px !important;
		font-weight: 500 !important;
	}

	.woocommerce .cart_totals table.shop_table_responsive td::before {
		display: none !important;
	}

}

@media (max-width: 480px) {
	.npx-cart-header__title {
		font-size: 32px;
	}

	/* Reduce outer container padding to give more room */
	.woocommerce-cart .npx-container {
		padding: 0 12px;
	}

	.woocommerce table.npx-cart-table tbody tr {
		padding: 12px !important;
		gap: 8px 12px;
		grid-template-columns: 70px minmax(0, 1fr) 24px;
	}

	.woocommerce table.npx-cart-table .product-thumbnail {
		width: 70px !important;
	}

	.woocommerce table.npx-cart-table .product-name a {
		font-size: 16px;
	}

	.npx-cart__item-variation {
		font-size: 14px;
	}

	.woocommerce table.npx-cart-table .product-subtotal .amount {
		font-size: 16px;
	}

	.woocommerce table.npx-cart-table .product-subtotal::before {
		font-size: 13px;
	}
}

/* Extra small screen optimization */
@media (max-width: 375px) {
	.woocommerce table.npx-cart-table tbody tr {
		padding: 10px !important;
		gap: 6px 10px;
	}

	.woocommerce-cart .npx-container {
		padding: 0 8px;
	}

	.woocommerce-cart-form {
		padding: 0 !important;
	}
}