/**
 * Nexales cart sidebar + checkout order review.
 */

/* -------------------------------------------------------------------------
   Side cart (WooCommerce mini-cart inside Elementor Menu Cart)
   Thumb size is owned by the container; img is always 100% of it so
   mobile media-queries can't leave a larger !important image overflowing.
   ------------------------------------------------------------------------- */

.widget_shopping_cart_content .nexales-mini-cart,
/* The promo strip is z-index 200 and the header is 100, so an open cart
   (it lives inside the header) would slide under the moving bar. */
.elementor-location-header:has(.elementor-menu-cart--shown) {
	z-index: 400;
}

.elementor-menu-cart__main .nexales-mini-cart,
.elementor-menu-cart__products .nexales-mini-cart {
	list-style: none;
	margin: 0;
	padding: 0;
}

.elementor-menu-cart__main .woocommerce-mini-cart-item,
.widget_shopping_cart_content .woocommerce-mini-cart-item,
.nexales-mini-cart__item {
	display: flex !important;
	flex-direction: row !important;
	flex-wrap: nowrap !important;
	align-items: flex-start !important;
	gap: 12px !important;
	position: relative !important;
	float: none !important;
	clear: both !important;
	padding: 14px 8px 14px 0 !important;
	border-bottom: 1px solid rgba(0, 0, 0, 0.08);
	list-style: none;
	overflow: visible;
}

.nexales-mini-cart__item::after,
.nexales-mini-cart__item::before,
.elementor-menu-cart__main .woocommerce-mini-cart-item::after,
.elementor-menu-cart__main .woocommerce-mini-cart-item::before {
	display: none !important;
	content: none !important;
}

.nexales-mini-cart__item > a.remove,
.nexales-mini-cart__remove,
.elementor-menu-cart__main .woocommerce-mini-cart-item > a.remove {
	position: absolute !important;
	top: 10px;
	right: 0;
	left: auto !important;
	float: none !important;
	z-index: 3;
	width: 22px;
	height: 22px;
	margin: 0 !important;
	line-height: 20px;
	text-align: center;
	font-size: 18px;
}

.nexales-mini-cart__thumb {
	flex: 0 0 80px !important;
	width: 80px !important;
	max-width: 80px !important;
	min-width: 80px !important;
	float: none !important;
}

.nexales-mini-cart__thumb a {
	display: block !important;
	float: none !important;
	width: 100% !important;
}

/* Never set a fixed px width on the img — only fill the thumb box. */
.nexales-mini-cart__thumb img,
.nexales-mini-cart__thumb img.nexales-cart-thumb,
.nexales-mini-cart__thumb .nexales-cart-thumb,
.widget_shopping_cart_content .nexales-mini-cart .nexales-mini-cart__thumb img,
.elementor-menu-cart__main .woocommerce-mini-cart .nexales-mini-cart__thumb img,
.elementor-menu-cart__main .woocommerce-mini-cart .nexales-mini-cart__thumb img.nexales-cart-thumb,
.elementor-menu-cart__main .woocommerce-mini-cart-item .nexales-mini-cart__thumb img,
.elementor-menu-cart__main .woocommerce-mini-cart-item .nexales-mini-cart__thumb img.nexales-cart-thumb {
	float: none !important;
	display: block !important;
	width: 100% !important;
	max-width: 100% !important;
	height: auto !important;
	aspect-ratio: 1 / 1;
	margin: 0 !important;
	object-fit: cover;
	border-radius: 12px;
	position: static !important;
}

.nexales-mini-cart__details {
	flex: 1 1 auto !important;
	min-width: 0 !important;
	max-width: 100%;
	padding-right: 26px;
	float: none !important;
	overflow-wrap: anywhere;
	word-break: break-word;
}

.nexales-mini-cart__name {
	display: block;
	font-size: 0.92em;
	font-weight: 600;
	line-height: 1.35;
	color: #2b2b2b;
}

.nexales-mini-cart__name a {
	display: block;
	color: inherit;
	text-decoration: none;
	overflow-wrap: anywhere;
	word-break: break-word;
}

.nexales-mini-cart__total {
	margin-top: 16px;
	padding-top: 4px;
}

/* Elementor's own Subtotal block (if its mini-cart template ever loads). */
.elementor-menu-cart__main .elementor-menu-cart__subtotal,
.widget_shopping_cart_content .elementor-menu-cart__subtotal {
	display: none !important;
}

/* Guard against two Woo total rows inside the same drawer. */
.widget_shopping_cart_content .woocommerce-mini-cart__total ~ .woocommerce-mini-cart__total,
.elementor-menu-cart__main .woocommerce-mini-cart__total ~ .woocommerce-mini-cart__total {
	display: none !important;
}

/* Elementor Pro mini-cart product rows (if that template is active). */
.elementor-menu-cart__product {
	display: grid !important;
	grid-template-columns: 80px minmax(0, 1fr) !important;
	align-items: start !important;
	column-gap: 12px !important;
	padding-top: 14px !important;
	padding-bottom: 14px !important;
}

.elementor-menu-cart__product-image {
	width: 80px !important;
	max-width: 80px !important;
	float: none !important;
}

.elementor-menu-cart__product-image a,
.elementor-menu-cart__product-image img,
.elementor-menu-cart__product-image img.nexales-cart-thumb,
.elementor-menu-cart__product-image .nexales-cart-thumb {
	float: none !important;
	display: block !important;
	width: 100% !important;
	max-width: 100% !important;
	height: auto !important;
	aspect-ratio: 1 / 1;
	object-fit: cover;
	border-radius: 12px;
	position: static !important;
}

.elementor-menu-cart__product-name {
	grid-column: 2 !important;
	min-width: 0;
	padding-inline-end: 1.75em;
	overflow-wrap: anywhere;
	word-break: break-word;
}

.elementor-menu-cart__product-price {
	grid-column: 2 !important;
	margin-top: 6px;
}

/* -------------------------------------------------------------------------
   Shared line pricing breakdown
   ------------------------------------------------------------------------- */

.nexales-cart-line {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 4px;
	margin-top: 8px;
	line-height: 1.35;
}

.nexales-cart-line__qty {
	font-size: 0.9em;
	color: #5c5c5c;
}

.nexales-cart-line__totals,
.nexales-line-subtotal {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 6px 10px;
	white-space: normal;
}

.nexales-cart-line__was,
.nexales-line-subtotal .nexales-cart-line__was {
	color: #8a8a8a;
	font-weight: 400;
	text-decoration: line-through;
	white-space: nowrap;
}

.nexales-cart-line__now,
.nexales-line-subtotal .nexales-cart-line__now,
.nexales-cart-line__now .amount,
.nexales-line-subtotal .nexales-cart-line__now .amount,
.wc-block-components-product-price__value.is-discounted {
	background: none;
	border: 0;
	padding: 0;
	color: #c81e1e;
	font-weight: 700;
	text-decoration: none;
	white-space: nowrap;
}

.nexales-cart-line__save {
	display: block;
	margin-top: 4px;
	color: #2d5a27;
	font-size: 0.8em;
	font-weight: 600;
	line-height: 1.4;
}

.nexales-line-subtotal--discounted {
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 2px;
	text-align: right;
}

.nexales-line-subtotal--discounted .nexales-cart-line__was {
	display: block;
	font-size: 0.9em;
}

.nexales-line-subtotal--discounted .nexales-cart-line__now {
	display: block;
	font-size: 1.05em;
}

/* -------------------------------------------------------------------------
   Checkout — «Вашата поръчка»
   ------------------------------------------------------------------------- */

.woocommerce-checkout-review-order-table,
.woocommerce-checkout-review-order-table thead,
.woocommerce-checkout-review-order-table tbody,
.woocommerce-checkout-review-order-table tfoot {
	display: block;
	width: 100%;
}

.woocommerce-checkout-review-order-table tr {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 12px;
	width: 100%;
}

.woocommerce-checkout-review-order-table th,
.woocommerce-checkout-review-order-table td {
	display: block;
	width: auto !important;
	max-width: none !important;
}

.woocommerce-checkout-review-order-table .product-name,
.woocommerce-checkout-review-order-table tfoot th {
	flex: 1 1 auto;
	min-width: 0;
}

.woocommerce-checkout-review-order-table .product-total,
.woocommerce-checkout-review-order-table tfoot td {
	flex: 0 0 auto;
	text-align: right;
	white-space: nowrap;
}

.woocommerce-checkout-review-order-table .cart_item td {
	padding-top: 14px;
	padding-bottom: 14px;
}

.woocommerce-checkout-review-order-table .product-total .amount,
.woocommerce-checkout-review-order-table .product-total .nexales-cart-line__now .amount,
.woocommerce-checkout-review-order-table .product-total .nexales-cart-line__was .amount {
	white-space: nowrap;
}

.nexales-checkout-item {
	display: flex;
	flex-direction: column;
	align-items: stretch;
	gap: 10px;
	text-align: left;
	width: 100%;
}

.nexales-checkout-item__head {
	display: flex;
	align-items: flex-start;
	gap: 14px;
	width: 100%;
}

/* COD service charge — surcharge row aligned with product prices. */
.woocommerce-checkout-review-order-table .cart_item.nexales-cod-fee-row {
	background: transparent !important;
}

.woocommerce-checkout-review-order-table .cart_item.nexales-cod-fee-row > td {
	padding-top: 14px !important;
	padding-bottom: 14px !important;
	vertical-align: middle !important;
	border-top: 1px solid rgba(0, 0, 0, 0.08);
	background: transparent !important;
	line-height: 1.4;
}

.woocommerce-checkout-review-order-table .cart_item.nexales-cod-fee-row .product-name {
	/* Align label with real product titles (thumb 96px + gap 14px). */
	padding-left: 110px !important;
	padding-right: 12px !important;
}

.nexales-checkout-fee {
	display: flex;
	align-items: center;
	min-height: 1.4em;
	text-align: left;
}

.nexales-checkout-fee__label {
	display: inline;
	margin: 0;
	padding: 0;
	font-size: 0.95em;
	font-weight: 500;
	line-height: 1.4;
	color: #5c5c5c;
	letter-spacing: 0.01em;
}

.woocommerce-checkout-review-order-table .cart_item.nexales-cod-fee-row .product-total {
	text-align: right !important;
	padding-left: 0 !important;
	font-size: 1em;
	font-weight: 700;
	color: #1f1f1f;
	white-space: nowrap;
	line-height: 1.4;
}

.woocommerce-checkout-review-order-table .cart_item.nexales-cod-fee-row .product-total .nexales-line-subtotal--fee {
	display: flex;
	justify-content: flex-end;
	align-items: center;
	width: 100%;
	margin: 0;
	line-height: 1.4;
	text-align: right;
}

.woocommerce-checkout-review-order-table .cart_item.nexales-cod-fee-row .product-total .amount {
	display: inline-block;
	font-size: 1.05em;
	font-weight: 700;
	color: #1f1f1f;
	line-height: 1.4;
	white-space: nowrap;
}

.nexales-mini-cart__item--fee,
.nexales-mini-cart__item.nexales-cod-fee-row {
	align-items: center !important;
	gap: 0 !important;
	margin-top: 6px !important;
	padding-top: 10px !important;
	padding-bottom: 10px !important;
	border-top: 1px solid rgba(0, 0, 0, 0.08) !important;
	background: transparent !important;
}

.nexales-mini-cart__item--fee .nexales-mini-cart__name,
.nexales-mini-cart__item.nexales-cod-fee-row .nexales-mini-cart__name {
	font-size: 0.92em;
	font-weight: 500;
	color: #5c5c5c;
}

.nexales-cart-line--fee {
	font-size: 0.92em;
	font-weight: 600;
	color: #3d3d3d;
}

.nexales-cod-title-fee {
	display: inline-block;
	margin-left: 0.55em;
	padding-left: 0.55em;
	font-weight: 600;
	white-space: nowrap;
	opacity: 0.85;
	border-left: 1px solid rgba(0, 0, 0, 0.12);
}

.nexales-checkout-item__thumb {
	flex: 0 0 96px;
	width: 96px;
}

.nexales-checkout-item__thumb img,
.nexales-checkout-item__thumb .nexales-cart-thumb {
	display: block;
	width: 96px !important;
	height: 96px !important;
	max-width: 96px !important;
	object-fit: cover;
	border-radius: 12px;
}

.nexales-checkout-item__body {
	min-width: 0;
	flex: 1;
}

.nexales-checkout-item__name {
	display: block;
	font-weight: 600;
	line-height: 1.35;
}

.nexales-checkout-item .product-quantity {
	font-weight: 700;
}

.nexales-checkout-item .nexales-cart-line__save {
	margin-top: 6px;
}

.nexales-cart-line .nexales-checkout-steps {
	width: 100%;
	margin-top: 2px;
}

.nexales-checkout-steps {
	display: flex;
	flex-direction: column;
	gap: 4px;
	margin-top: 8px;
}

.nexales-checkout-step {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 10px;
	color: #3d4540;
	font-size: 0.78rem;
	font-weight: 600;
	line-height: 1.35;
}

.nexales-checkout-step--pay {
	justify-content: flex-end;
}

.nexales-checkout-step__label {
	display: flex;
	flex-direction: column;
	flex: 1 1 auto;
	min-width: 0;
	gap: 1px;
	overflow-wrap: break-word;
	word-break: normal;
}

.nexales-checkout-step__save {
	color: #488625;
	font-size: 0.92em;
	font-weight: 600;
}

/* Price steps already end on the charged amount, so the side «Общо» cell
   does not sit beside them and crush the lines. */
.woocommerce-checkout-review-order-table tr.nexales-checkout-steps-row {
	display: block;
}

.woocommerce-checkout-review-order-table tr.nexales-checkout-steps-row > td.product-name {
	width: 100% !important;
	padding-right: 0;
	box-sizing: border-box;
}

.woocommerce-checkout-review-order-table tr.nexales-checkout-steps-row > td.product-total {
	display: none !important;
}

.nexales-checkout-step__amount {
	flex: 0 0 auto;
	font-weight: 700;
	white-space: nowrap;
}

.nexales-checkout-step--regular .nexales-checkout-step__amount,
.nexales-checkout-step--regular .nexales-checkout-step__amount .amount {
	color: #8b948e;
	font-weight: 600;
	text-decoration: line-through;
}

.nexales-checkout-step--promo .nexales-checkout-step__amount,
.nexales-checkout-step--promo .nexales-checkout-step__amount .amount,
.nexales-checkout-step--pack .nexales-checkout-step__amount,
.nexales-checkout-step--pack .nexales-checkout-step__amount .amount {
	color: #488625;
	font-weight: 700;
	text-decoration: none;
}

.nexales-checkout-step--pay .nexales-checkout-step__amount,
.nexales-checkout-step--pay .nexales-checkout-step__amount .amount {
	color: #0d2119;
	font-weight: 800;
	text-decoration: none;
}

.woocommerce table.cart .product-thumbnail img.nexales-cart-thumb,
.elementor-widget-woocommerce-cart .woocommerce table.cart img.nexales-cart-thumb {
	width: 72px !important;
	height: 72px !important;
	max-width: 72px !important;
	object-fit: cover;
	border-radius: 8px;
}

@media (min-width: 768px) {
	.nexales-mini-cart__thumb {
		flex-basis: 96px !important;
		width: 96px !important;
		max-width: 96px !important;
		min-width: 96px !important;
	}

	.elementor-menu-cart__product {
		grid-template-columns: 96px minmax(0, 1fr) !important;
	}

	.elementor-menu-cart__product-image {
		width: 96px !important;
		max-width: 96px !important;
	}
}

@media (max-width: 767px) {
	.nexales-mini-cart__name {
		font-size: 0.86em;
	}

	.nexales-checkout-item__thumb {
		flex-basis: 68px;
		width: 68px;
	}

	.nexales-checkout-item__thumb img,
	.nexales-checkout-item__thumb .nexales-cart-thumb {
		width: 68px !important;
		height: 68px !important;
		max-width: 68px !important;
	}

	.woocommerce-checkout-review-order-table .cart_item.nexales-cod-fee-row .product-name {
		/* Align with mobile product titles (thumb 68px + gap 14px). */
		padding-left: 82px;
	}
}
