/*
 * Kahur Checkout — cart page.
 *
 * Restyle via the variables below first; everything is scoped under
 * .kc-cart / .kc-totals so Nest's generic WooCommerce styles don't leak
 * in (and ours don't leak out).
 */
.kc-cart {
	/* Nest palette, each colour used only where its contrast passes WCAG AA:
	   accent (Nest brand-dark) for large bold text / fills with white bold ≥18px,
	   navy for all normal text, mint as a surface only. */
	--kc-bg: #ffffff;
	--kc-surface: var(--background-2, #f4f6fa);
	--kc-accent-soft: var(--background-3, #def9ec);
	--kc-border: #e3e8ee;
	--kc-field-border: #8a94a6;
	--kc-text: var(--color-heading, #253d4e);
	--kc-muted: #5d6b78;
	--kc-accent: var(--color-brand-dark, #29a56c);
	--kc-accent-hover: #1e7a50;
	--kc-accent-text: #ffffff;
	--kc-focus: var(--color-brand-dark, #29a56c);
	--kc-danger: #d83a3a;
	--kc-font-heading: var(--font-heading, "Quicksand", sans-serif);
	--kc-radius: 14px;
	--kc-radius-sm: calc(var(--kc-radius) * .6);
	--kc-gap: 24px;
	--kc-thumb: 88px;
	--kc-side-width: 380px;
	--kc-price-col: 150px;
	--kc-sticky-top: 24px;

	display: grid;
	grid-template-columns: minmax(0, 1fr) var(--kc-side-width);
	gap: var(--kc-gap);
	align-items: start;
	margin: 0 0 40px;
	color: var(--kc-text);
}

/* ---- Cards ------------------------------------------------------------ */

.kc-cart .kc-cart__card,
.kc-cart .kc-totals {
	background: var(--kc-bg);
	border: 1px solid var(--kc-border);
	border-radius: var(--kc-radius);
	padding: 24px;
}

.kc-cart .kc-cart__side {
	position: sticky;
	top: var(--kc-sticky-top);
	width: auto;
	float: none;
	margin: 0;
}

.kc-cart .kc-cart__title,
.kc-cart .kc-totals__title {
	display: flex;
	align-items: baseline;
	gap: 10px;
	margin: 0 0 20px;
	font-family: var(--kc-font-heading);
	font-size: 24px;
	font-weight: 700;
	line-height: 1.2;
	color: var(--kc-text);
}

.kc-cart .kc-cart__count {
	font-family: inherit;
	font-size: 14px;
	font-weight: 400;
	color: var(--kc-muted);
}

/* ---- Items ------------------------------------------------------------ */

.kc-cart .kc-cart__items {
	display: flex;
	flex-direction: column;
}

.kc-cart .kc-cart__item {
	display: grid;
	/* Fixed price column (--kc-price-col, per breakpoint): every row is its
	   own grid, so an auto-sized column made the steppers shift with the
	   price length ("domino"). */
	grid-template-columns: var(--kc-thumb) minmax(0, 1fr) auto var(--kc-price-col) 44px;
	grid-template-areas: "thumb info qty subtotal remove";
	gap: 20px;
	align-items: center;
	padding: 20px 0;
	border-top: 1px solid var(--kc-border);
}

.kc-cart .kc-cart__item:first-child {
	border-top: 0;
	padding-top: 0;
}

.kc-cart .kc-cart__thumb { grid-area: thumb; }
.kc-cart .kc-cart__info { grid-area: info; min-width: 0; }
.kc-cart .kc-cart__qty { grid-area: qty; margin-right: 20px; }
.kc-cart .kc-cart__subtotal { grid-area: subtotal; }
.kc-cart .kc-cart__remove { grid-area: remove; margin-left: 12px; }

.kc-cart .kc-cart__thumb img {
	display: block;
	width: var(--kc-thumb);
	height: var(--kc-thumb);
	object-fit: contain;
	padding: 6px;
	background: var(--kc-surface);
	border-radius: var(--kc-radius-sm);
	margin: 0;
	box-sizing: border-box;
}

.kc-cart .kc-cart__name {
	font-family: var(--kc-font-heading);
	font-weight: 700;
	font-size: 16px;
	line-height: 1.35;
}

.kc-cart .kc-cart__name a {
	color: var(--kc-text);
	text-decoration: none;
}

.kc-cart .kc-cart__name a:hover {
	color: var(--kc-text);
	text-decoration: underline;
	text-underline-offset: 3px;
}

.kc-cart .kc-cart__info .variation {
	margin: 6px 0 0;
	font-size: 13px;
	color: var(--kc-muted);
}

.kc-cart .kc-cart__info .backorder_notification {
	margin: 6px 0 0;
	font-size: 13px;
	font-weight: 600;
	color: var(--kc-danger);
}

.kc-cart .kc-cart__unit {
	display: flex;
	flex-wrap: wrap;
	gap: 2px 12px;
	margin-top: 6px;
	font-size: 14px;
	color: var(--kc-text);
}

/* ---- Prices ----------------------------------------------------------- */

.kc-cart .kc-price,
.kc-totals .kc-price {
	white-space: nowrap;
}

.kc-cart .kc-price small {
	font-size: 13px;
	color: var(--kc-muted);
	font-weight: 400;
}

.kc-cart .kc-cart__unit .kc-price--secondary {
	color: var(--kc-muted);
}

.kc-cart .kc-cart__subtotal {
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	min-width: 110px;
	text-align: right;
}

.kc-cart .kc-cart__subtotal .kc-price--primary {
	font-family: var(--kc-font-heading);
	font-size: 18px;
	font-weight: 700;
	color: var(--kc-text);
}

.kc-cart .kc-cart__subtotal .kc-price--secondary {
	font-size: 13px;
	color: var(--kc-muted);
}

/* ---- Quantity --------------------------------------------------------- */

.kc-cart .kc-cart__qty .quantity {
	margin: 0;
}

.kc-cart .kc-cart__qty input.qty {
	width: 52px;
	height: 44px;
	padding: 0 4px;
	text-align: center;
	border: 0;
	border-radius: 0;
	background: transparent;
	color: var(--kc-text);
	font-size: 16px;
	font-weight: 700;
	-moz-appearance: textfield;
	appearance: textfield;
}

/* ---- Remove ----------------------------------------------------------- */

.woocommerce .kc-cart .kc-cart__remove a.remove {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	border-radius: 50%;
	font-size: 0;
	line-height: 1;
	color: var(--kc-muted) !important;
	background: transparent;
	text-decoration: none;
}

.woocommerce .kc-cart .kc-cart__remove a.remove:hover {
	color: var(--kc-danger) !important;
	background: #fff1f1;
}

/* ---- Actions (coupon + update) ---------------------------------------- */

.kc-cart .kc-cart__actions {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	align-items: center;
	gap: 12px;
	margin-top: 8px;
	padding-top: 16px;
	border-top: 1px solid var(--kc-border);
}

.kc-cart .kc-cart__coupon {
	display: flex;
	gap: 8px;
	flex: 1 1 280px;
	max-width: 420px;
}

.kc-cart .kc-cart__coupon input.input-text {
	flex: 1;
	min-width: 0;
	height: 44px;
	padding: 0 14px;
	border: 1px solid var(--kc-field-border);
	border-radius: var(--kc-radius-sm);
	background: var(--kc-bg);
	color: var(--kc-text);
	font-size: 15px;
}

.kc-cart .kc-button,
.kc-cart .kc-checkout-button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 44px;
	padding: 0 20px;
	border-radius: var(--kc-radius-sm);
	font-weight: 700;
	font-size: 15px;
	line-height: 1.2;
	text-decoration: none;
	cursor: pointer;
	transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}

.kc-cart .kc-button--secondary {
	background: var(--kc-text);
	color: #fff;
	border: 1px solid var(--kc-text);
}

.kc-cart .kc-button--ghost {
	background: var(--kc-bg);
	color: var(--kc-text);
	border: 1px solid var(--kc-field-border);
}

.kc-cart .kc-button--ghost:disabled {
	opacity: .5;
	cursor: default;
}

/* ---- Totals ----------------------------------------------------------- */

.woocommerce .kc-totals table.kc-totals__table {
	width: 100%;
	margin: 0;
	border: 0;
	border-collapse: collapse;
	background: transparent;
}

.woocommerce .kc-totals table.kc-totals__table th,
.woocommerce .kc-totals table.kc-totals__table td {
	padding: 8px 0;
	border: 0;
	background: transparent;
	font-size: 14px;
	vertical-align: top;
}

.woocommerce .kc-totals table.kc-totals__table th {
	font-weight: 400;
	color: var(--kc-text);
	text-align: left;
}

.woocommerce .kc-totals table.kc-totals__table td {
	text-align: right;
}

.woocommerce .kc-totals .kc-totals__row--muted th,
.woocommerce .kc-totals .kc-totals__row--muted td {
	color: var(--kc-muted);
	font-size: 13px;
	padding-top: 0;
}

.woocommerce .kc-totals .kc-totals__row--sum th,
.woocommerce .kc-totals .kc-totals__row--sum td {
	border-top: 1px solid var(--kc-border);
	padding-top: 12px;
	font-weight: 600;
}

.woocommerce .kc-totals .kc-totals__row--total th,
.woocommerce .kc-totals .kc-totals__row--total td {
	border-top: 1px solid var(--kc-border);
	padding-top: 14px;
	font-size: 18px;
	font-weight: 700;
}

.woocommerce .kc-totals .kc-totals__row--total td strong {
	font-family: var(--kc-font-heading);
	font-size: 24px;
	color: var(--kc-accent);
}

/* Shipping methods (WooCommerce's cart-shipping.php markup) */
.woocommerce .kc-totals .woocommerce-shipping-methods {
	margin: 0;
	padding: 0;
	list-style: none;
	text-align: left;
}

.woocommerce .kc-totals .woocommerce-shipping-methods li {
	display: flex;
	align-items: center;
	gap: 8px;
	margin: 0 0 6px;
}

.woocommerce .kc-totals .woocommerce-shipping-destination,
.woocommerce .kc-totals .shipping-calculator-button {
	font-size: 12px;
	color: var(--kc-muted);
}

.kc-totals .kc-totals__checkout {
	margin-top: 16px;
	padding: 0;
}

.woocommerce .kc-cart a.kc-checkout-button {
	width: 100%;
	min-height: 48px;
	margin: 0;
	padding: 10px 24px;
	/* 18px bold = WCAG "large text": white on Nest dark green passes at 3:1. */
	font-size: 18px;
	font-weight: 700;
	letter-spacing: .01em;
	background: var(--kc-accent) !important;
	color: var(--kc-accent-text) !important;
	border: 0;
	border-radius: var(--kc-radius-sm);
}

.woocommerce .kc-cart a.kc-checkout-button:hover {
	background: var(--kc-accent-hover) !important;
	color: var(--kc-accent-text) !important;
}

/* ---- Cross-sells (moved under the cart) ------------------------------- */

.woocommerce .cross-sells {
	clear: both;
	width: 100%;
	float: none;
	margin-top: 16px;
}

/* ---- Layout variants (WooCommerce → Kahur Checkout → Rozvržení) ----- */

.kc-cart--side-left {
	grid-template-columns: var(--kc-side-width) minmax(0, 1fr);
	grid-template-areas: "side main" "bottom bottom";
}

.kc-cart--side-right {
	grid-template-areas: "main side" "bottom bottom";
}

.kc-cart--stacked {
	grid-template-columns: minmax(0, 1fr);
	grid-template-areas: "main" "side" "bottom";
}

.kc-cart .kc-cart__main { grid-area: main; min-width: 0; }
.kc-cart .kc-cart__side { grid-area: side; min-width: 0; }
.kc-cart .kc-cart__bottom { grid-area: bottom; }

.kc-cart--stacked .kc-cart__side,
.kc-cart--no-sticky .kc-cart__side {
	position: static;
}

/* Stacked: summary box sits right-aligned under the items, not full width. */
.kc-cart--stacked .kc-totals {
	max-width: var(--kc-side-width);
	margin-left: auto;
}

.kc-cart--no-thumbs .kc-cart__item {
	grid-template-columns: minmax(0, 1fr) auto var(--kc-price-col) 44px;
	grid-template-areas: "info qty subtotal remove";
}

.kc-cart .kc-is-hidden {
	display: none !important;
}

.kc-cart .kc-cart__actions-end {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-left: auto;
}

/* ---- Summary modes ----------------------------------------------------- */

/* No summary box: items take the full width in every layout. */
.kc-cart.kc-cart--no-summary {
	grid-template-columns: minmax(0, 1fr);
	grid-template-areas: "main" "bottom";
}

.kc-cart .kc-inline-summary {
	margin-top: 16px;
	padding-top: 16px;
	border-top: 1px solid var(--kc-border);
}

.kc-cart .kc-inline-summary__rows {
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 6px;
	margin: 0;
}

.kc-cart .kc-inline-summary__row {
	display: flex;
	justify-content: space-between;
	gap: 24px;
	width: min(100%, 360px);
	font-size: 14px;
}

.kc-cart .kc-inline-summary__row dt {
	font-weight: 400;
	margin: 0;
}

.kc-cart .kc-inline-summary__row dd {
	margin: 0;
	text-align: right;
	white-space: nowrap;
}

.kc-cart .kc-inline-summary__row--muted {
	color: var(--kc-muted);
	font-size: 13px;
}

.kc-cart .kc-inline-summary__row--total {
	margin-top: 4px;
	padding-top: 10px;
	border-top: 1px solid var(--kc-border);
	font-size: 18px;
	font-weight: 700;
}

.kc-cart .kc-inline-summary__row--total dd {
	font-family: var(--kc-font-heading);
	color: var(--kc-accent);
	font-size: 24px;
}

.kc-cart .kc-inline-summary__note {
	margin: 8px 0 0;
	font-size: 13px;
	color: var(--kc-muted);
	text-align: right;
}

.kc-cart .kc-cart__checkout--items {
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 8px;
}

.woocommerce .kc-cart .kc-cart__checkout--items a.kc-checkout-button {
	width: min(100%, 360px);
}

/* ---- Checkout button positions --------------------------------------- */

.kc-cart .kc-cart__checkout--items {
	margin-top: 16px;
}

.kc-cart .kc-cart__bottom {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: flex-end;
	gap: 16px 24px;
	padding: 20px 24px;
	background: var(--kc-surface);
	border: 1px solid var(--kc-border);
	border-radius: var(--kc-radius);
}

.kc-cart .kc-cart__bottom .kc-total {
	margin-right: auto;
}

/* ---- Live total (bottom bar + Elementor "Celková cena" widget) -------- */

.kc-total {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 4px 10px;
}

.kc-total__amount {
	font-family: var(--kc-font-heading, var(--font-heading, sans-serif));
	font-size: 24px;
	font-weight: 700;
	color: var(--kc-accent, var(--color-brand-dark, #29a56c));
}

/* ---- Page width ------------------------------------------------------ */

body.kc-has-fullwidth-cart {
	overflow-x: clip;
}

.kc-cart.kc-cart--fullwidth {
	/* --kc-sbw: scrollbar width, set by assets/js (100vw includes it). */
	width: calc(100vw - var(--kc-sbw, 0px));
	max-width: none;
	margin-left: calc(50% - 50vw + var(--kc-sbw, 0px) / 2);
	margin-right: calc(50% - 50vw + var(--kc-sbw, 0px) / 2);
	padding-left: clamp(16px, 3vw, 48px);
	padding-right: clamp(16px, 3vw, 48px);
	box-sizing: border-box;
}

/* ---- Elementor mode --------------------------------------------------- */

.kc-cart.kc-cart--elementor {
	display: block;
}

.kc-cart--elementor .kc-cart__side {
	position: static;
}

.kc-editor-placeholder {
	padding: 24px;
	border: 2px dashed #c3c4c7;
	border-radius: 8px;
	color: #50575e;
	font-size: 13px;
	text-align: center;
	background: #f6f7f7;
}

.woocommerce .kc-cart .kc-cart__bottom a.kc-checkout-button {
	width: auto;
	min-width: 260px;
}

/* ---- Responsive ------------------------------------------------------- */

@media (max-width: 1024px) {
	.kc-cart {
		--kc-price-col: 130px;
	}

	.kc-cart,
	.kc-cart--side-left,
	.kc-cart--side-right {
		grid-template-columns: minmax(0, 1fr);
		grid-template-areas: "main" "side" "bottom";
	}

	.kc-cart--stacked .kc-totals {
		max-width: none;
	}

	.kc-cart .kc-cart__side {
		position: static;
	}
}

@media (max-width: 640px) {
	.kc-cart .kc-cart__card,
	.kc-cart .kc-totals {
		padding: 16px;
	}

	/* Thumbnail capped on phones (the configured size is set inline). */
	.kc-cart .kc-cart__thumb img {
		width: min(var(--kc-thumb), 72px);
		height: min(var(--kc-thumb), 72px);
	}

	.kc-cart .kc-cart__item {
		grid-template-columns: min(var(--kc-thumb), 72px) auto minmax(0, 1fr) 44px;
		grid-template-areas:
			"thumb info info remove"
			"thumb qty subtotal subtotal";
		gap: 10px 12px;
		align-items: start;
	}

	.kc-cart--no-thumbs .kc-cart__item {
		grid-template-columns: auto minmax(0, 1fr) 44px;
		grid-template-areas:
			"info info remove"
			"qty subtotal subtotal";
	}

	.kc-cart .kc-cart__subtotal {
		min-width: 0;
	}

	.kc-cart .kc-cart__qty {
		margin-right: 12px;
	}

	.kc-cart .kc-cart__remove {
		margin-left: 0;
	}

	.kc-cart .kc-cart__coupon {
		max-width: none;
	}

	.kc-cart .kc-cart__actions-end,
	.kc-cart .kc-cart__actions-end .kc-button {
		width: 100%;
	}

	.kc-cart .kc-cart__bottom {
		padding: 16px;
	}

	.woocommerce .kc-cart .kc-cart__bottom a.kc-checkout-button {
		width: 100%;
		min-width: 0;
	}
}

/* ---- Quantity stepper (assets/js/cart.js adds the − / + buttons) ------- */

.kc-cart .kc-qty {
	display: inline-flex;
	align-items: center;
	border: 1px solid var(--kc-field-border);
	border-radius: var(--kc-radius-sm);
	background: var(--kc-bg);
	overflow: hidden;
}

.kc-cart .kc-qty:focus-within {
	border-color: var(--kc-focus);
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--kc-focus) 25%, transparent);
}

.kc-cart .kc-qty .quantity {
	display: contents;
}

.kc-cart .kc-qty__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
	width: 36px;
	height: 40px;
	margin: 0;
	padding: 0;
	border: 0;
	background: transparent;
	color: var(--kc-text);
	font-size: 18px;
	font-weight: 600;
	line-height: 1;
	cursor: pointer;
}

.kc-cart .kc-qty__btn:hover {
	background: var(--kc-accent-soft);
}

.kc-cart .kc-qty__btn:disabled {
	color: var(--kc-field-border);
	cursor: not-allowed;
	background: transparent;
}

.kc-cart .kc-qty input.qty::-webkit-outer-spin-button,
.kc-cart .kc-qty input.qty::-webkit-inner-spin-button {
	-webkit-appearance: none;
	margin: 0;
}

.kc-cart .kc-qty input.qty:focus {
	outline: none;
}

/* Remove icon (the × in the markup stays for screen readers / no-CSS). */
.woocommerce .kc-cart .kc-cart__remove a.remove::before {
	content: "";
	width: 20px;
	height: 20px;
	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='M3 6h18M8 6V4h8v2M19 6l-1 14H6L5 6M10 11v6M14 11v6'/%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='M3 6h18M8 6V4h8v2M19 6l-1 14H6L5 6M10 11v6M14 11v6'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* ---- Focus + motion (WCAG 2.4.7 / 2.3.3) ------------------------------- */

.kc-cart a:focus-visible,
.kc-cart button:focus-visible,
.kc-cart input:focus-visible,
.kc-cart select:focus-visible,
.kc-cart textarea:focus-visible {
	outline: 3px solid var(--kc-focus);
	outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
	.kc-cart *,
	.kc-cart *::before,
	.kc-cart *::after {
		transition: none !important;
		animation: none !important;
	}
}

/* ---- Nest !important overrides (scoped to our cart) -------------------- */

/* Nest: `.woocommerce .qty { border: 2px solid brand !important; margin … !important }` */
.woocommerce .kc-cart .kc-qty input.qty {
	/* Nest forces 90px width, margins and a 2px green border (!important). */
	flex: 0 0 auto;
	width: 40px !important;
	min-width: 0 !important;
	height: 40px !important;
	margin: 0 !important;
	padding: 0 !important;
	border: 0 !important;
	box-shadow: none !important;
	text-align: center !important;
	line-height: 40px !important;
	font-size: 15px !important;
}

/* Nest's .button rules shrink our main button's text. */
.woocommerce .kc-cart a.kc-checkout-button.button {
	display: inline-flex !important;
	align-items: center;
	justify-content: center;
	height: auto !important;
	min-height: 48px !important;
	padding: 10px 24px !important;
	font-size: 18px !important;
	line-height: 1.2 !important;
	text-transform: none !important;
}

/* Locked quantity (product can only be bought once — WooCommerce renders a
   hidden input): same stepper, buttons disabled, value as plain text. */
.kc-cart .kc-qty.is-locked {
	border-color: var(--kc-border);
	background: var(--kc-surface);
}

.kc-cart .kc-qty__value {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	font-size: 15px;
	font-weight: 700;
	color: var(--kc-text);
}

.kc-cart .kc-qty.is-locked .kc-qty__btn:disabled {
	color: #9aa3ae;
}

/* ---- "Přejít k pokladně" icon ---------------------------------------- */

.woocommerce .kc-cart a.kc-checkout-button {
	gap: 10px;
}

.woocommerce .kc-cart .kc-checkout-button__icon {
	flex: 0 0 auto;
	width: 20px;
	height: 20px;
	fill: none !important;
	stroke: currentColor !important;
	transition: transform .15s ease;
}

.woocommerce .kc-cart a.kc-checkout-button:hover .kc-checkout-button__icon,
.woocommerce .kc-cart a.kc-checkout-button:focus-visible .kc-checkout-button__icon {
	transform: translateX(3px);
}
