/* Cart, checkout, order confirmation and mini-cart drawer.
   Loaded after woocommerce.css; overrides use body-prefixed selectors. */

/* --- Page wrappers (ported from koszyk.html / zamowienie.html) --- */
body .cv-main--cart,
body .cv-main--checkout,
body .cv-main--order {
	padding-top: 24px;
	padding-bottom: 64px;
}
body .k-cart-wrap {
	max-width: 900px;
	margin: 0 auto;
	padding: 0 20px;
	box-sizing: content-box;
	display: flex;
	flex-direction: column;
	gap: 24px;
}
body .k-co-wrap {
	max-width: 1100px;
	margin: 0 auto;
	padding: 0 20px;
	box-sizing: content-box;
}
body .k-cart-wrap > *,
body .k-co-wrap > * {
	margin-block: 0;
	max-width: none;
}
body :is(.k-cart-wrap, .k-co-wrap) h1.wp-block-post-title {
	margin: 0 0 24px;
	max-width: none;
	font-family: var(--font-display);
	font-weight: 500;
	font-size: clamp(28px, 4vw, 36px);
	line-height: 1.15;
	letter-spacing: .03em;
	text-transform: uppercase;
	color: var(--text-heading);
}
body .k-cart-wrap h1.wp-block-post-title {
	margin: 0;
}
body :is(.k-cart-wrap, .k-co-wrap) .wp-block-post-content {
	max-width: none;
	padding: 0;
}
body :is(.k-cart-wrap, .k-co-wrap) .wp-block-woocommerce-cart.alignwide,
body :is(.k-cart-wrap, .k-co-wrap) .wp-block-woocommerce-checkout.alignwide {
	max-width: none;
	padding-inline: 0;
	margin-inline: 0;
}

/* --- Empty cart --- */
body .k-empty {
	text-align: center;
	padding: 64px 20px;
	border-radius: 8px;
	background: var(--surface-card);
	border: 1px solid var(--line-neutral);
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 16px;
}
body .k-empty > * {
	margin: 0;
}
body .k-empty p {
	font-size: 18px;
	color: var(--text-heading);
}
body .k-empty__icon {
	display: inline-flex;
	color: var(--cv-gold);
}
body .wp-block-woocommerce-empty-cart-block {
	padding: 0;
	border: 0;
	background: none;
}

/* --- Layout: cart stacked (lines, then summary), checkout two columns --- */
body .wc-block-components-sidebar-layout.wc-block-cart,
body .wc-block-components-sidebar-layout.wc-block-checkout {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: 24px;
	align-items: start;
	padding: 0;
	margin: 0;
}
body .wc-block-components-sidebar-layout.wc-block-cart {
	gap: 24px;
}
body .wc-block-components-sidebar-layout :is(.wc-block-components-main, .wc-block-components-sidebar) {
	width: auto;
	max-width: none;
	margin: 0;
	box-sizing: border-box;
}
body .wc-block-components-sidebar-layout .wc-block-checkout__main {
	padding-right: 0;
}
@media (min-width: 900px) {
	body .wc-block-components-sidebar-layout.wc-block-checkout {
		gap: 48px;
		grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
	}
	body .wc-block-components-sidebar-layout.wc-block-checkout .wc-block-checkout__sidebar {
		order: 2;
		position: sticky;
		top: 24px;
	}
	body .wc-block-components-sidebar-layout.wc-block-cart .wc-block-cart__sidebar {
		position: static;
	}
}

/* --- Checkout header: logo only, centred --- */
body .cv-header.cv-header--logo-only {
	display: flex;
	justify-content: center;
	align-items: center;
	padding: 24px 20px;
}
body .cv-header--logo-only .cv-header__logo {
	margin: 0 auto;
}

/* --- Cart lines on small screens: no horizontal overflow --- */
@media (max-width: 700px) {
	body .wp-block-woocommerce-cart table.wc-block-cart-items {
		width: 100%;
		table-layout: fixed;
	}
	body .wp-block-woocommerce-cart table.wc-block-cart-items .wc-block-cart-items__row {
		grid-template-columns: 72px minmax(0, 1fr) auto;
		column-gap: 14px;
	}
	body .wp-block-woocommerce-cart table.wc-block-cart-items .wc-block-cart-item__product {
		grid-column: 2;
		padding-right: 0;
	}
	body .wp-block-woocommerce-cart table.wc-block-cart-items .wc-block-cart-item__total {
		grid-column: 3;
	}
}

/* Cart cards keep their padding in the narrow (is-mobile / is-small) layouts */
body .wc-block-components-sidebar-layout.wc-block-cart .wc-block-components-main.wc-block-cart__main {
	padding: 8px 20px;
}
body .wc-block-components-sidebar-layout.wc-block-cart .wc-block-components-sidebar.wc-block-cart__sidebar {
	padding: 24px;
}
@media (max-width: 600px) {
	body .wc-block-components-sidebar-layout.wc-block-cart .wc-block-components-main.wc-block-cart__main {
		padding: 4px 14px;
	}
	body .wc-block-components-sidebar-layout.wc-block-cart .wc-block-components-sidebar.wc-block-cart__sidebar {
		padding: 18px;
	}
}
/* Checkout summary: single card (outer totals block), inner panel flattened */
body .wc-block-checkout__sidebar .wc-block-components-checkout-order-summary,
body .wc-block-checkout__sidebar .wp-block-woocommerce-checkout-order-summary-block {
	border: 0;
	background: none;
	padding: 0;
}

/* --- Mini-cart drawer (like .k-drawer) --- */
body .wc-block-components-drawer.wc-block-mini-cart__drawer {
	width: min(420px, 100%);
	max-width: 100%;
}
body .wc-block-mini-cart__footer .wc-block-mini-cart__footer-actions {
	display: flex;
	flex-direction: column;
	gap: 12px;
}
body .wc-block-mini-cart__footer .wc-block-mini-cart__footer-actions > * {
	width: 100%;
	margin: 0;
	box-sizing: border-box;
}
body .wc-block-mini-cart__footer .wc-block-mini-cart__footer-checkout {
	order: 1;
}
/* woocommerce.css primary button selector contains an ID (via :is()), so outline
   variants need ID-level specificity: html:not(#cv). */
html:not(#cv):not(#cv2):not(#cv3) body :is(.wc-block-mini-cart__footer-cart, .wc-block-components-checkout-return-to-cart-button, .wc-block-components-button.is-style-outline, .wc-block-components-button.outlined) {
	order: 2;
	background: transparent;
	color: var(--cv-gold-light);
	border: 1px solid var(--cv-gold);
}
html:not(#cv):not(#cv2):not(#cv3) body :is(.wc-block-mini-cart__footer-cart, .wc-block-components-checkout-return-to-cart-button, .wc-block-components-button.is-style-outline, .wc-block-components-button.outlined):is(:hover, :focus-visible) {
	background: rgba(201, 154, 78, .12);
	color: var(--cv-parchment);
	border-color: var(--cv-gold-light);
}

/* --- Order confirmation --- */
body .k-order-wrap {
	display: flex;
	flex-direction: column;
	gap: 24px;
}
body .k-order-wrap > * {
	margin: 0;
	max-width: none;
}
body .k-order-wrap .wp-block-woocommerce-order-confirmation-status {
	font-size: 20px;
	line-height: 1.5;
	padding: 32px 28px;
}
body .k-order-wrap .wp-block-woocommerce-order-confirmation-status h1,
body .k-order-wrap .wp-block-woocommerce-order-confirmation-status .wc-block-order-confirmation-status__title {
	font-family: var(--font-display);
	font-weight: 500;
	font-size: clamp(26px, 4vw, 34px);
	line-height: 1.2;
	letter-spacing: .03em;
	text-transform: uppercase;
	margin: 0 0 12px;
}
body .k-order-wrap .wp-block-woocommerce-order-confirmation-status p {
	font-size: 18px;
	margin: 0;
}
body .k-order-wrap :is(.wc-block-order-confirmation-totals-wrapper, .wc-block-order-confirmation-address-wrapper, .wp-block-woocommerce-order-confirmation-totals-wrapper) {
	margin: 0;
}
body .k-order-wrap :is(h2, h3).wp-block-heading {
	margin: 0 0 16px;
	font-size: clamp(20px, 3vw, 26px);
}
body .k-order-wrap .wc-block-order-confirmation-address-wrapper {
	gap: 24px;
	margin-top: 0;
}

/* Mini-cart rows must fit narrow drawers */
body .wc-block-mini-cart__items table.wc-block-cart-items {
	width: 100%;
	table-layout: fixed;
}
body .wc-block-mini-cart__items table.wc-block-cart-items .wc-block-cart-items__row {
	grid-template-columns: 72px minmax(0, 1fr) auto;
	column-gap: 14px;
}
body .wc-block-mini-cart__items table.wc-block-cart-items .wc-block-cart-item__product {
	grid-column: 2;
}
body .wc-block-mini-cart__items table.wc-block-cart-items .wc-block-cart-item__total {
	grid-column: 3;
}

/* --- Pack lines (inc/cart-packs.php) ---------------------------------------
   The Store API item data renders "Zestaw N szt. ... price" and, when the pack is
   cheaper than single bottles, "oszczędzasz X zł ... crossed-out regular price".
   Markup: <span class="cv-pack"><strong>label</strong><b>price</b><br><em>savings</em><i>regular</i></span>.
   In such rows the native unit price, sale badge, variation ("Zestaw: 1 szt."),
   line total and the quantity bubble are hidden. Prices are pinned to the right
   edge of the row (absolute, static vertical position), so they line up with the
   "Łącznie" column of the cart table and the totals of the order summary. */
body :is(.wc-block-cart-items__row, .wc-block-components-order-summary-item):has(.cv-pack) {
	position: relative;
}
body :is(.wc-block-cart-items__row, .wc-block-components-order-summary-item):has(.cv-pack) :is(
	.wc-block-cart-item__prices,
	.wc-block-components-order-summary-item__individual-prices,
	.wc-block-components-sale-badge,
	.wc-block-components-product-details__zestaw,
	.wc-block-cart-item__total-price-and-sale-badge-wrapper,
	.wc-block-components-order-summary-item__total-price,
	.wc-block-components-order-summary-item__quantity
) {
	display: none;
}
body .wc-block-components-order-summary-item:has(.cv-pack) .wc-block-components-order-summary-item__description {
	flex: 1 1 auto;
	padding-right: 0;
}
body .wc-block-components-product-details:has(.cv-pack) {
	display: block;
	margin: 4px 0 0;
}
body .cv-pack {
	display: block;
	padding-right: 7.5em;
	line-height: 1.45;
}
body .cv-pack strong {
	color: var(--cvw-parchment);
	font-size: 16px;
	font-weight: 600;
}
body .cv-pack :is(b, i) {
	position: absolute;
	right: 0;
	white-space: nowrap;
	font-style: normal;
	font-variant-numeric: tabular-nums;
}
body .cv-pack b {
	color: var(--cvw-parchment);
	font-size: 17px;
	font-weight: 600;
}
body .cv-pack em {
	color: var(--cvw-sale);
	font-size: 15px;
	font-style: normal;
}
body .cv-pack i {
	margin-top: 2px;
	color: var(--cvw-stone);
	font-size: 14px;
	text-decoration: line-through;
}

/* Product photo is never lower than the text next to it (current size = minimum). */
body .wc-block-components-order-summary-item__image {
	align-self: stretch;
	min-height: 64px;
}
body .wc-block-components-order-summary-item__image img {
	height: 100%;
	min-height: 64px;
	aspect-ratio: auto;
	object-fit: cover;
}

/* --- Swipe right to remove a cart row (touch, assets/js/theme.js initCartSwipe) --- */
@media (hover: none) {
	body .wc-block-cart-items__row {
		position: relative;
		touch-action: pan-y;
	}
	body .wc-block-cart-items__row > td {
		transition: transform .2s ease;
	}
	body .wc-block-cart-items__row.is-swiping > td {
		transition: none;
	}
	body .wc-block-cart-items__row.is-swiped > td {
		transform: translateX(var(--cv-swipe, 0));
	}
	body .wc-block-cart-items__row.is-swiped::before {
		content: "Usuń";
		position: absolute;
		top: 0;
		bottom: 0;
		left: 0;
		z-index: 1;
		display: flex;
		align-items: center;
		justify-content: center;
		width: var(--cv-swipe, 0);
		overflow: hidden;
		border-radius: var(--cvw-r-sm);
		background: #b3261e;
		color: #fff;
		font-size: 16px;
		font-weight: 600;
		letter-spacing: .04em;
		text-transform: uppercase;
		white-space: nowrap;
	}
	body :is(.wc-block-cart__main, .wc-block-mini-cart__items) {
		overflow-x: clip;
	}
}

/* --- Paczkomat InPost: picker under the locker code field (assets/js/paczkomat.js) --- */
body .cv-paczkomat {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 8px;
	margin: 10px 0 4px;
}
body .cv-paczkomat__chosen {
	margin: 0;
	color: var(--cvw-sand);
	font-size: 16px;
}
body .cv-paczkomat__button {
	min-height: 44px;
	padding: 10px 18px;
	border: 1px solid var(--cvw-gold);
	border-radius: 5px;
	background: transparent;
	color: var(--cvw-gold-light);
	font: 600 15px/1.2 var(--cvw-font-ui, inherit);
	letter-spacing: .04em;
	text-transform: uppercase;
	cursor: pointer;
}
body .cv-paczkomat__button:hover,
body .cv-paczkomat__button:focus-visible {
	background: var(--cvw-gold);
	color: var(--cvw-bg);
}
body .cv-paczkomat__link {
	color: var(--cvw-gold-light);
	font-size: 16px;
}
html.cv-geo-open {
	overflow: hidden;
}
.cv-geo {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
	background: rgba(0, 0, 0, .72);
}
.cv-geo__box {
	display: flex;
	flex-direction: column;
	width: min(1000px, 100%);
	height: min(720px, 100%);
	overflow: hidden;
	border-radius: 8px;
	background: #fff;
}
.cv-geo__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 8px 8px 8px 16px;
	background: #0b0f0d;
	color: #efe3c8;
}
.cv-geo__title {
	margin: 0;
	font-size: 17px;
	font-weight: 600;
}
.cv-geo__close {
	width: 44px;
	height: 44px;
	border: 0;
	background: transparent;
	color: #efe3c8;
	font-size: 30px;
	line-height: 1;
	cursor: pointer;
}
.cv-geo__map {
	flex: 1 1 auto;
	min-height: 0;
}
.cv-geo__map inpost-geowidget {
	display: block;
	width: 100%;
	height: 100%;
}
@media (max-width: 600px) {
	.cv-geo {
		padding: 0;
	}
	.cv-geo__box {
		height: 100%;
		border-radius: 0;
	}
}
