/* =============================================================================
   Darplay Tweaks - cart totals (includes/cart.php)
   ============================================================================= */

/* Without a coupon or fee, the subtotal equals the total: show only the total. */
.cart_totals table:not(:has(.cart-discount, .fee)) .cart-subtotal {
	display: none;
}

.cart_totals .darplay-cart-note td {
	padding-top: 4px;
	border-top: 0;
	font-size: 14px;
	color: #6b6b6b;
	text-align: right;
}

@media (max-width: 600px) {
	/* WooCommerce's mobile table shows a "label:" before each cell; not here. */
	.cart_totals .darplay-cart-note td::before {
		display: none;
	}
}

/* --- Same look as the mini-cart drawer (owner, 15 Nov 2026) --------------
   Quantity: one rounded box "-  1  +" with light signs, a trash icon instead
   of the "x", and the cart updates by itself (assets/js/quantity.js), so the
   "Обновяване на количката" button is hidden while that script runs. */
.woocommerce-cart-form .quantity:has(.darplay-qty__btn) {
	--darplay-qty-size: 40px;
	border: 1px solid #c8c8c8;
	border-radius: 6px;
	overflow: hidden;
}

.woocommerce-cart-form .quantity .darplay-qty__btn,
.woocommerce-cart-form .quantity.quantity:has(.darplay-qty__btn) input.input-text.qty.text {
	border: 0;
	border-radius: 0;
	background: transparent;
}

.woocommerce-cart-form .quantity .darplay-qty__btn {
	width: 38px;
	color: #6b6b6b;
	font-size: 18px;
}

.woocommerce-cart-form .quantity .darplay-qty__btn:hover {
	background: #f4f4f4;
	color: #333;
}

.woocommerce-cart-form .quantity.quantity:has(.darplay-qty__btn) input.input-text.qty.text {
	width: 2.6em;
	font-size: 17px;
}

/* Remove: a trash icon (same as the drawer's). */
.woocommerce-cart-form td.product-remove a.remove {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	border-radius: 50%;
	font-size: 0 !important;
	color: #333 !important;
	background: transparent !important;
}

.woocommerce-cart-form td.product-remove a.remove::before {
	content: "";
	width: 22px;
	height: 22px;
	background: currentColor;
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 7h16M10 11v6M14 11v6M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2l1-12M9 7V4h6v3'/%3E%3C/svg%3E") center / contain no-repeat;
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 7h16M10 11v6M14 11v6M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2l1-12M9 7V4h6v3'/%3E%3C/svg%3E") center / contain no-repeat;
}

.woocommerce-cart-form td.product-remove a.remove:hover,
.woocommerce-cart-form td.product-remove a.remove:focus-visible {
	color: #b42318 !important;
	background: #fef3f2 !important;
}

/* Automatic update: no "Обновяване на количката" button (and no empty row
   when there is no coupon field). */
.darplay-cart-auto .woocommerce-cart-form button[name="update_cart"] {
	display: none;
}

.darplay-cart-auto .woocommerce-cart-form tr:has(> td.actions):not(:has(.coupon)) {
	display: none;
}

/* While WooCommerce reloads the table: dim it a little. */
.woocommerce-cart-form.processing {
	opacity: 0.6;
}

/* --- Phones: each cart line laid out like the drawer ------------------------
   WooCommerce stacks every cell as a "label: value" row on small screens and
   hides the picture. Instead:

     [picture]  Product name            12.00 €
     [picture]  12.00 € / бр.
     [picture]  [ -  1  + ]  (trash)
   (768px = WooCommerce's own breakpoint for this table.) */
@media (max-width: 768px) {
	.woocommerce-cart-form table.shop_table_responsive tr.cart_item {
		display: grid;
		grid-template-columns: 72px auto 1fr auto;
		grid-template-areas:
			"thumb name   name   total"
			"thumb price  price  price"
			"thumb qty    remove remove";
		column-gap: 12px;
		row-gap: 6px;
		align-items: center;
		padding: 14px 12px;
		border-bottom: 1px solid #e6e6e6;
	}

	.woocommerce-cart-form table.shop_table_responsive tr.cart_item td {
		display: block;
		padding: 0;
		border: 0;
		background: none;
		text-align: left !important; /* WooCommerce's phone styles force right with !important */
	}

	/* No "Продукт:", "Цена:", ... labels in the card. */
	.woocommerce-cart-form table.shop_table_responsive tr.cart_item td::before {
		display: none;
		content: none;
	}

	.woocommerce-cart-form tr.cart_item td.product-thumbnail {
		display: block !important; /* WooCommerce hides it on phones with !important */
		grid-area: thumb;
		align-self: start;
	}

	.woocommerce-cart-form tr.cart_item td.product-thumbnail img {
		display: block;
		width: 72px;
		height: auto;
		max-width: none;
		border-radius: 6px;
	}

	.woocommerce-cart-form tr.cart_item td.product-name {
		grid-area: name;
		align-self: start;
		font-size: 15px;
		line-height: 1.35;
	}

	.woocommerce-cart-form tr.cart_item td.product-price {
		grid-area: price;
		font-size: 14px;
		color: #6b6b6b;
	}

	.woocommerce-cart-form tr.cart_item td.product-price::after {
		content: " / бр.";
	}

	.woocommerce-cart-form tr.cart_item td.product-quantity {
		grid-area: qty;
	}

	.woocommerce-cart-form tr.cart_item td.product-subtotal {
		grid-area: total;
		align-self: start;
		font-size: 15px;
		font-weight: 700;
		white-space: nowrap;
		text-align: right !important;
	}

	.woocommerce-cart-form tr.cart_item td.product-remove {
		display: block;
		grid-area: remove;
		justify-self: start;
	}
}
