/* AEM Checkout Quantity (child theme) - stepper + remove link under every item of the Checkout block's order summary,
   and the same one price per item on the Cart page.
   Colours follow the site's checkout: dark #32373c controls, gold #cbb162 focus ring. Button resets carry !important
   because Divi and the child theme style <button> globally. */
.wc-block-checkout .aem-cq,
.wp-block-woocommerce-checkout .aem-cq {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 6px 14px;
	margin-top: 6px;
	width: 100%;
}

.aem-cq-qty {
	display: inline-flex;
	align-items: center;
	height: 36px;
	border: 1px solid rgba(50, 55, 60, 0.35);
	border-radius: 4px;
	background: #fff;
	overflow: hidden;
}

.wc-block-checkout .aem-cq-qty__btn,
.wp-block-woocommerce-checkout .aem-cq-qty__btn {
	-webkit-appearance: none !important;
	appearance: none !important;
	background: transparent !important;
	border: 0 !important;
	border-radius: 0 !important;
	box-shadow: none !important;
	margin: 0 !important;
	padding: 0 !important;
	width: 36px !important;
	min-width: 0 !important;
	height: 36px !important;
	min-height: 0 !important;
	line-height: 1 !important;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	color: #32373c !important;
	cursor: pointer;
	transition: background-color 0.15s ease;
}

.aem-cq-qty__btn svg {
	width: 12px;
	height: 12px;
	display: block;
}

.wc-block-checkout .aem-cq-qty__btn:hover:not(:disabled),
.wp-block-woocommerce-checkout .aem-cq-qty__btn:hover:not(:disabled) {
	background: rgba(50, 55, 60, 0.07) !important;
}

.aem-cq-qty__btn:focus-visible {
	outline: 2px solid #cbb162;
	outline-offset: -2px;
}

.wc-block-checkout .aem-cq-qty__btn:disabled,
.wp-block-woocommerce-checkout .aem-cq-qty__btn:disabled {
	opacity: 0.3;
	cursor: default;
}

.wc-block-checkout .aem-cq-qty__input,
.wp-block-woocommerce-checkout .aem-cq-qty__input {
	-webkit-appearance: none;
	-moz-appearance: textfield;
	appearance: textfield;
	width: 46px;
	height: 36px;
	margin: 0;
	padding: 0 2px;
	border: 0;
	border-left: 1px solid rgba(50, 55, 60, 0.2);
	border-right: 1px solid rgba(50, 55, 60, 0.2);
	border-radius: 0;
	background: transparent;
	box-shadow: none;
	text-align: center;
	font: inherit;
	font-size: 15px;
	font-weight: 600;
	color: #32373c;
}

.aem-cq-qty__input::-webkit-outer-spin-button,
.aem-cq-qty__input::-webkit-inner-spin-button {
	-webkit-appearance: none;
	margin: 0;
}

.wc-block-checkout .aem-cq-qty__input:focus,
.wp-block-woocommerce-checkout .aem-cq-qty__input:focus {
	outline: none;
	box-shadow: none;
	background: rgba(203, 177, 98, 0.14);
}

.wc-block-checkout .aem-cq-remove,
.wp-block-woocommerce-checkout .aem-cq-remove {
	-webkit-appearance: none !important;
	appearance: none !important;
	background: transparent !important;
	border: 0 !important;
	border-radius: 0 !important;
	box-shadow: none !important;
	margin: 0 !important;
	padding: 0 !important;
	height: auto !important;
	min-height: 0 !important;
	width: auto !important;
	font: inherit !important;
	font-size: 13px !important;
	line-height: 1.4 !important;
	letter-spacing: normal !important;
	text-transform: none !important;
	color: #6b6b6b !important;
	text-decoration: underline !important;
	text-underline-offset: 2px;
	cursor: pointer;
}

.wc-block-checkout .aem-cq-remove:hover:not(:disabled),
.wp-block-woocommerce-checkout .aem-cq-remove:hover:not(:disabled) {
	color: #32373c !important;
	text-decoration: none !important;
}

.aem-cq-remove:focus-visible {
	outline: 2px solid #cbb162;
	outline-offset: 2px;
}

.wc-block-checkout .aem-cq-remove:disabled,
.wp-block-woocommerce-checkout .aem-cq-remove:disabled {
	opacity: 0.5;
	cursor: default;
	text-decoration: none !important;
}

.aem-cq.is-busy .aem-cq-qty {
	opacity: 0.6;
}

/* The last item breathes before the coupon line: WooCommerce zeroes its padding and our controls are its last line. */
.wc-block-checkout .wc-block-components-order-summary .wc-block-components-order-summary-item:last-child {
	border-bottom: 0;
	margin-bottom: 16px;
}

/* One price per item (see syncPrice in the script): the unit price under the name and the right-hand line total
   go, the line total is printed on the variation row instead. */
.wc-block-checkout .wc-block-components-order-summary-item .wc-block-cart-item__prices,
.wc-block-checkout .wc-block-components-order-summary-item__total-price {
	display: none !important;
}

.aem-cq-price {
	white-space: nowrap;
}

.aem-cq-price--own {
	flex-basis: 100%;
	font-size: var(--wp--preset--font-size--small, 14px);
	line-height: 1.4;
}

/* Cart page, the same one price per item (see syncCart in the script): the unit price under the name, the right-hand
   line total and its "Общо" heading go once the row carries the moved price, so without the script the Cart block keeps
   its own layout. */
.wc-block-cart .wc-block-cart-items__row:has(.aem-cq-price) .wc-block-cart-item__prices,
.wc-block-cart .wc-block-cart-items__row:has(.aem-cq-price) .wc-block-cart-item__total,
.wc-block-cart table.wc-block-cart-items:has(.aem-cq-price) .wc-block-cart-items__header-total {
	display: none !important;
}

/* 15px between the page title "Плащане" and the checkout, phones and desktop alike. Divi gives the title 10px padding +
   20px margin and WooCommerce adds 24px on top of the block (44px on desktop); on phones the summary copy now sits
   right under the title. */
body.woocommerce-checkout h1.entry-title.main_title {
	padding-bottom: 0 !important;
	margin-bottom: 15px !important;
}

body.woocommerce-checkout .wp-block-woocommerce-checkout {
	padding-top: 0 !important;
}

/* No "Общо" twice: the subtotal row repeats the total whenever nothing sits between them, so it is hidden unless a fee,
   discount, shipping or tax row is rendered (then it explains the difference). */
.wp-block-woocommerce-checkout-order-summary-totals-block:not(:has(.wp-block-woocommerce-checkout-order-summary-fee-block > *, .wp-block-woocommerce-checkout-order-summary-discount-block > *, .wp-block-woocommerce-checkout-order-summary-shipping-block > *, .wp-block-woocommerce-checkout-order-summary-taxes-block > *)) .wp-block-woocommerce-checkout-order-summary-subtotal-block {
	display: none !important;
}

/* The total row closes the box with the same 16px it has above, unless the club's "С тази поръчка трупаш" line hangs
   under it (that line carries its own 16px and sits tight to the row by design). */
.wp-block-woocommerce-checkout .wc-block-components-totals-wrapper:has(> .wc-block-components-totals-footer-item):not(:has(+ .wc-block-components-totals-wrapper .aec-cb__earn--total)) {
	padding-bottom: 16px !important;
}

/* Phones: WooCommerce 11 renders the summary twice, a collapsed accordion in the sidebar at the top and a full copy
   inside the actions block above "Поръчване". Whenever that full copy exists: hide the accordion, turn the form into
   a flex column, dissolve the actions block and move the full copy to the top, above the contact fields; the button
   row stays last. Desktop (no copy) is untouched. */
.wc-block-checkout:has(.checkout-order-summary-block-fill-wrapper) .wc-block-checkout__sidebar > .wp-block-woocommerce-checkout-order-summary-block {
	display: none !important;
}

.wc-block-checkout:has(.checkout-order-summary-block-fill-wrapper) .wc-block-checkout__sidebar {
	margin-bottom: 0;
}

.wc-block-checkout:has(.checkout-order-summary-block-fill-wrapper) .wc-block-checkout__form {
	display: flex;
	flex-direction: column;
}

.wc-block-checkout:has(.checkout-order-summary-block-fill-wrapper) .wc-block-checkout__actions {
	display: contents;
}

.wc-block-checkout:has(.checkout-order-summary-block-fill-wrapper) .wc-block-checkout__actions > :has(> .checkout-order-summary-block-fill-wrapper) {
	order: -1;
	margin-bottom: 24px;
}

/* WooCommerce pads the copy 36px at the bottom (it was meant to sit above the button); moved to the top it keeps the
   same 24px rhythm as the steps below it. */
.wc-block-checkout:has(.checkout-order-summary-block-fill-wrapper) .checkout-order-summary-block-fill-wrapper {
	padding-bottom: 0 !important;
}

.wc-block-checkout:has(.checkout-order-summary-block-fill-wrapper) .wc-block-checkout__actions_row {
	margin-bottom: 36px;
}
