/* =========================================================
   Страница корзины (/cart/): степпер количества, кнопка
   «Удалить» и мобильная вёрстка без наложений.
   Подключается в functions.php только на is_cart().
   ========================================================= */

/* =========================================================
   Степпер количества (− / +) вместо поля ввода числа.
   Работает и на десктопе, и на мобильных.
   ========================================================= */

.woocommerce table.cart td.product-quantity .quantity.ppl-qty-stepper {
	display: inline-flex;
	align-items: center;
	border: 1px solid var(--DIVIDER--LIGHT, #d9d9d9);
	border-radius: 8px;
	overflow: hidden;
	background: var(--GC-COLOR--APP, #fff);
}

.woocommerce table.cart td.product-quantity .quantity.ppl-qty-stepper .qty-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 34px;
	padding: 0;
	border: 0;
	background: transparent;
	font-size: 18px;
	line-height: 1;
	cursor: pointer;
	color: var(--GC-COLOR--TEXT, #333);
	transition: background-color 0.15s ease;
}

.woocommerce table.cart td.product-quantity .quantity.ppl-qty-stepper .qty-btn:hover:not(:disabled) {
	background: rgba(0, 0, 0, 0.06);
}

.woocommerce table.cart td.product-quantity .quantity.ppl-qty-stepper .qty-btn:disabled {
	opacity: 0.35;
	cursor: default;
}

.woocommerce table.cart td.product-quantity .quantity.ppl-qty-stepper input.qty {
	width: 40px;
	height: 34px;
	padding: 0;
	margin: 0;
	border: 0;
	background: transparent;
	text-align: center;
	font-size: 15px;
	font-weight: 600;
	color: var(--GC-COLOR--TEXT, #333);
	-moz-appearance: textfield;
	appearance: textfield;
}

/* Убираем нативные стрелки number-поля в WebKit. */
.woocommerce table.cart td.product-quantity .quantity.ppl-qty-stepper input.qty::-webkit-outer-spin-button,
.woocommerce table.cart td.product-quantity .quantity.ppl-qty-stepper input.qty::-webkit-inner-spin-button {
	-webkit-appearance: none;
	margin: 0;
}

/* =========================================================
   Мобильная вёрстка корзины (совпадает со стандартным
   breakpoint WooCommerce 768px).
   ========================================================= */

@media (max-width: 768px) {

	/* Каждая ячейка товара — строка: подпись слева, значение справа.
	   Флоаты отключаем, чтобы количество не наезжало на сумму. */
	.woocommerce table.shop_table_responsive.cart tr.cart_item td {
		display: flex;
		align-items: center;
		justify-content: space-between;
		gap: 10px;
	}

	.woocommerce table.shop_table_responsive.cart tr.cart_item td::before {
		float: none;
		text-align: left;
		flex: 0 0 auto;
	}

	/* Миниатюра на мобильных скрыта (дублируем правило WooCommerce,
	   чтобы flex не вернул её на место). */
	.woocommerce table.shop_table_responsive.cart tr.cart_item td.product-thumbnail {
		display: none !important;
	}

	/* Название товара: подпись сверху, ссылка на всю ширину слева. */
	.woocommerce table.shop_table_responsive.cart tr.cart_item td.product-name {
		flex-direction: column;
		align-items: flex-start;
		gap: 2px;
	}

	.woocommerce table.shop_table_responsive.cart tr.cart_item td.product-name > a {
		text-align: left;
	}

	/* Кнопка удаления: крестик + понятная подпись «Удалить». */
	.woocommerce table.shop_table_responsive.cart tr.cart_item td.product-remove {
		justify-content: flex-end;
	}

	.woocommerce table.shop_table_responsive.cart td.product-remove a.remove {
		display: inline-flex;
		align-items: center;
		gap: 6px;
		width: auto;
		height: auto;
		padding: 6px 12px;
		border: 1px solid var(--wc-red, #a00);
		border-radius: 6px;
		background: transparent;
		font-size: 14px;
		font-weight: 700;
		line-height: 1;
		color: var(--wc-red, #a00) !important;
		text-decoration: none;
	}

	.woocommerce table.shop_table_responsive.cart td.product-remove a.remove::after {
		content: "Удалить";
	}

	.woocommerce table.shop_table_responsive.cart td.product-remove a.remove:hover {
		background: var(--wc-red, #a00);
		color: #fff !important;
	}

	/* Степпер не сжимается и не вылезает из своей строки. */
	.woocommerce table.shop_table_responsive.cart td.product-quantity .quantity.ppl-qty-stepper {
		flex: 0 0 auto;
		max-width: 100%;
	}
}
