/* ==========================================================================
   Boczny koszyk (szuflada) z motywu: inc/koszyk.php, template-parts/koszyk/, assets/js/koszyk.js.
   Wszystko pod #tk-koszyk (identyfikator wygrywa z regulami przyciskow i linkow Astry bez !important).
   Projekt: analizy/frontend/2026-10-14-koszyk-boczny.md, podglad analizy/frontend/podglad/koszyk/.
   ========================================================================== */

html.tk-lock {
	overflow: hidden;
}

/* Przy otwartym koszyku chowamy plywajace przyciski z rogow (zgoda na cookies, koszyk w rogu),
   ktore leza wyzej niz szuflada i zaslanialy jej stopke. */
html.tk-lock .cky-btn-revisit-wrapper,
html.tk-lock .txcart-trigger {
	visibility: hidden !important;
}

#tk-koszyk {
	--tk-ease: cubic-bezier(0.32, 0.72, 0, 1);
	position: fixed;
	inset: 0;
	z-index: 99990;
	visibility: hidden;
	pointer-events: none;
	font-family: var(--tx-font-body);
	color: var(--tx-ink);
}

#tk-koszyk.is-open {
	visibility: visible;
	pointer-events: auto;
}

#tk-koszyk .tk__tlo {
	position: absolute;
	inset: 0;
	background: rgb(9 11 8 / 0.6);
	opacity: 0;
	transition: opacity 240ms ease;
}

#tk-koszyk.is-open .tk__tlo {
	opacity: 1;
}

#tk-koszyk .tk__panel {
	position: absolute;
	top: 0;
	right: 0;
	width: 100%;
	max-width: 480px;
	height: 100%;
	height: 100dvh;
	/* Kolumna: lista zabiera wolne miejsce, stopka zawsze na dole (takze gdy komunikat jest ukryty). */
	display: flex;
	flex-direction: column;
	background: #fff;
	box-shadow: 0 24px 80px rgb(0 0 0 / 0.3);
	transform: translateX(100%);
	transition: transform 280ms var(--tk-ease);
	outline: none;
}

#tk-koszyk.is-open .tk__panel {
	transform: none;
}

/* Cienki pasek ladowania u gory: koszyk dziala dalej, nic nie jest zasloniete. */
#tk-koszyk .tk__pasek {
	flex: none;
	height: 3px;
	background: transparent;
	overflow: hidden;
}

#tk-koszyk.is-loading .tk__pasek {
	background: linear-gradient(90deg, transparent 0, var(--tx-green) 40%, transparent 80%) 0 0 / 50% 100% no-repeat, var(--tx-green-soft);
	animation: tk-pasek 900ms linear infinite;
}

@keyframes tk-pasek {
	from { background-position: -50% 0, 0 0; }
	to { background-position: 150% 0, 0 0; }
}

#tk-koszyk .tk__glowa {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 9px 12px 10px 16px;
	border-bottom: 1px solid var(--tx-line-light);
}

#tk-koszyk .tk__tytul {
	margin: 0;
	color: var(--tx-ink);
	font-family: var(--tx-font-display);
	font-size: 20px;
	font-weight: 700;
	line-height: 1.2;
	letter-spacing: 0;
}

#tk-koszyk .tk__x {
	display: grid;
	place-items: center;
	width: 44px;
	height: 44px;
	min-height: 0;
	margin: 0;
	padding: 0;
	border: 1px solid var(--tx-line-light);
	border-radius: var(--tx-r-sm);
	background: #fff;
	color: var(--tx-ink);
	box-shadow: none;
	cursor: pointer;
}

#tk-koszyk .tk__x svg {
	width: 20px;
	height: 20px;
}

#tk-koszyk .tk__x:hover {
	background: var(--tx-paper);
}

#tk-koszyk .tk__info {
	display: flex;
	align-items: center;
	gap: 8px;
	margin: 10px 16px 0;
	padding: 8px 12px;
	border-radius: var(--tx-r-sm);
	background: #eef6e6;
	color: var(--tx-green-ink);
	font-size: 14px;
	font-weight: 600;
	line-height: 1.35;
}

#tk-koszyk .tk__info[hidden] {
	display: none;
}

#tk-koszyk .tk__info::before {
	content: '';
	flex: none;
	width: 18px;
	height: 18px;
	border-radius: 50%;
	background: var(--tx-green) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M7 12.5l3.2 3.2L17 9' fill='none' stroke='%230b1406' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 16px no-repeat;
}

#tk-koszyk .tk__info.is-blad {
	background: #fdecea;
	color: var(--tx-alert-ink);
}

#tk-koszyk .tk__info.is-blad::before {
	background: var(--tx-alert-ink) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 7v6M12 16.5v.5' fill='none' stroke='%23fff' stroke-width='2.6' stroke-linecap='round'/%3E%3C/svg%3E") center / 16px no-repeat;
}

#tk-koszyk .tk__lista {
	flex: 1 1 auto;
	min-height: 0;
	overflow-y: auto;
	overscroll-behavior: contain;
	display: grid;
	align-content: start;
	gap: 12px;
	padding: 12px 16px 16px;
}

/* Pozycja */
#tk-koszyk .tk-it {
	display: grid;
	grid-template-columns: 96px minmax(0, 1fr);
	gap: 12px;
	padding: 12px;
	border: 1px solid var(--tx-line-light);
	border-radius: 16px;
	background: #fff;
	transition: opacity 200ms ease-out, transform 200ms var(--tk-ease);
}

#tk-koszyk .tk-it.is-out {
	opacity: 0;
	transform: translateX(24px);
}

#tk-koszyk .tk-it__foto-ramka {
	width: 96px;
	height: 96px;
	overflow: hidden;
	border-radius: var(--tx-r-sm);
	background: var(--tx-paper);
}

#tk-koszyk .tk-it__foto-ramka a {
	display: block;
	height: 100%;
}

#tk-koszyk .tk-it__foto {
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	object-fit: cover;
	box-shadow: none;
}

#tk-koszyk .tk-it__opis {
	min-width: 0;
	display: grid;
	align-content: start;
	gap: 7px;
}

#tk-koszyk .tk-it__nazwa {
	display: -webkit-box;
	margin: 0;
	overflow: hidden;
	color: var(--tx-ink);
	font-family: var(--tx-font-display);
	font-size: 15.5px;
	font-weight: 600;
	line-height: 1.3;
	letter-spacing: 0;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
}

#tk-koszyk .tk-it__nazwa a {
	color: inherit;
	text-decoration: none;
}

#tk-koszyk .tk-it__nazwa a:hover {
	text-decoration: underline;
}

#tk-koszyk .tk-it__forma {
	justify-self: start;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 3px 10px 3px 4px;
	border: 1px solid var(--tx-line-light);
	border-radius: 999px;
	background: var(--tx-paper);
	color: var(--tx-ink-2);
	font-size: 13px;
	font-weight: 700;
	line-height: 1.3;
	white-space: nowrap;
}

#tk-koszyk .tk-it__forma img {
	width: 22px;
	height: 22px;
	object-fit: contain;
	box-shadow: none;
}

#tk-koszyk .tk-it__cena-j {
	color: var(--tx-ink-2);
	font-size: 13.5px;
	line-height: 1.3;
}

#tk-koszyk .tk-it__rzad,
#tk-koszyk .tk-it__dol {
	grid-column: 1 / -1;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
}

#tk-koszyk .tk-it__dol {
	margin-top: -4px;
}

#tk-koszyk .tk-krok {
	display: grid;
	grid-template-columns: 48px minmax(80px, auto) 48px;
	height: 48px;
	overflow: hidden;
	border: 1.5px solid var(--tx-line-light);
	border-radius: var(--tx-r);
	background: #fff;
}

#tk-koszyk .tk-krok button {
	display: grid;
	place-items: center;
	width: 48px;
	height: 100%;
	min-height: 0;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	background: var(--tx-paper);
	color: var(--tx-ink);
	box-shadow: none;
	cursor: pointer;
	touch-action: manipulation;
	-webkit-tap-highlight-color: transparent;
	transition: transform 140ms ease-out, background-color 140ms ease;
}

#tk-koszyk .tk-krok button:active:not([aria-disabled="true"]) {
	transform: scale(0.94);
}

#tk-koszyk .tk-krok button[aria-disabled="true"] {
	color: #b4b9ab;
	cursor: default;
}

#tk-koszyk .tk-krok button:focus-visible {
	outline: 3px solid var(--tx-green-ink);
	outline-offset: -3px;
}

#tk-koszyk .tk-krok output {
	display: grid;
	place-items: center;
	padding: 0 8px;
	border-left: 1.5px solid var(--tx-line-light);
	border-right: 1.5px solid var(--tx-line-light);
	color: var(--tx-ink);
	font-family: var(--tx-font-display);
	font-size: 16px;
	font-weight: 700;
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

#tk-koszyk .tk-it__suma {
	color: var(--tx-ink);
	font-family: var(--tx-font-display);
	font-size: 20px;
	font-weight: 700;
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

#tk-koszyk .tk-it__suma .woocommerce-Price-amount,
#tk-koszyk .tk-stopka__suma .woocommerce-Price-amount,
#tk-koszyk .tk-it__suma .woocommerce-Price-currencySymbol,
#tk-koszyk .tk-stopka__suma .woocommerce-Price-currencySymbol {
	color: inherit;
	font: inherit;
}

#tk-koszyk .tk-it__waga {
	color: var(--tx-ink-2);
	font-size: 13.5px;
	line-height: 1.35;
}

#tk-koszyk .tk-it__waga b {
	color: var(--tx-green-ink);
	font-weight: 700;
}

#tk-koszyk .tk-it__usun {
	flex: none;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	min-height: 44px;
	margin: 0 -4px 0 0;
	padding: 0 6px 0 10px;
	border: 0;
	border-radius: 10px;
	background: none;
	color: var(--tx-ink-2);
	box-shadow: none;
	font-family: var(--tx-font-body);
	font-size: 13.5px;
	font-weight: 600;
	cursor: pointer;
}

#tk-koszyk .tk-it__usun:hover {
	background: #fdecea;
	color: var(--tx-alert-ink);
}

#tk-koszyk .tk-it__usun:focus-visible {
	outline: 3px solid var(--tx-green-ink);
	outline-offset: 0;
}

#tk-koszyk .tk-zmiana {
	animation: tk-zmiana 200ms cubic-bezier(0.23, 1, 0.32, 1);
}

@keyframes tk-zmiana {
	from { opacity: 0.35; transform: translateY(5px); }
	to { opacity: 1; transform: none; }
}

/* Pusty koszyk */
#tk-koszyk .tk-pusty {
	display: grid;
	justify-items: center;
	gap: 8px;
	padding: 48px 12px;
	color: var(--tx-ink-2);
	font-size: 15px;
	line-height: 1.45;
	text-align: center;
}

#tk-koszyk .tk-pusty strong {
	color: var(--tx-ink);
	font-family: var(--tx-font-display);
	font-size: 19px;
	font-weight: 700;
}

#tk-koszyk .tk-pusty a {
	display: inline-flex;
	align-items: center;
	min-height: 48px;
	margin-top: 8px;
	padding: 0 22px;
	border-radius: var(--tx-r);
	background: var(--tx-green);
	color: var(--tx-on-green);
	font-family: var(--tx-font-display);
	font-size: 15px;
	font-weight: 700;
	text-decoration: none;
}

/* Stopka: suma i przycisk do kasy zawsze na dole */
#tk-koszyk .tk-stopka {
	padding: 12px 16px calc(14px + env(safe-area-inset-bottom, 0px));
	border-top: 1px solid var(--tx-line-light);
	background: #fff;
	box-shadow: 0 -10px 28px rgb(0 0 0 / 0.06);
}

#tk-koszyk .tk-stopka__suma {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 12px;
}

#tk-koszyk .tk-stopka__suma span {
	color: var(--tx-ink-2);
	font-size: 15px;
	font-weight: 600;
}

#tk-koszyk .tk-stopka__suma strong {
	color: var(--tx-ink);
	font-family: var(--tx-font-display);
	font-size: 25px;
	font-weight: 700;
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

#tk-koszyk .tk-stopka__waga {
	margin: 2px 0 0;
	color: var(--tx-ink-2);
	font-size: 13.5px;
	line-height: 1.4;
}

#tk-koszyk .tk-stopka__kasa {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	width: 100%;
	min-height: 56px;
	margin-top: 12px;
	border-radius: var(--tx-r);
	background: var(--tx-green);
	color: var(--tx-on-green);
	font-family: var(--tx-font-display);
	font-size: 17px;
	font-weight: 700;
	text-decoration: none;
	transition: transform 140ms ease-out, background-color 140ms ease;
}

#tk-koszyk .tk-stopka__kasa svg {
	width: 20px;
	height: 20px;
}

#tk-koszyk .tk-stopka__kasa:hover {
	background: var(--tx-green-hover);
	color: var(--tx-on-green);
}

#tk-koszyk .tk-stopka__kasa:active {
	transform: scale(0.98);
	background: var(--tx-green-press);
}

#tk-koszyk .tk-stopka__kasa:focus-visible {
	outline: 3px solid var(--tx-ink);
	outline-offset: 3px;
}

#tk-koszyk .tk-stopka__pelny {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 44px;
	margin-top: 2px;
	color: var(--tx-ink);
	font-size: 14px;
	font-weight: 600;
	text-decoration: underline;
	text-underline-offset: 3px;
}

#tk-koszyk .tk-stopka__pelny:focus-visible {
	outline: 3px solid var(--tx-green-ink);
	outline-offset: 0;
}

/* Bardzo waskie telefony: mniejsze zdjecie, zeby nazwa miala miejsce. */
@media (max-width: 359px) {
	#tk-koszyk .tk-it {
		grid-template-columns: 80px minmax(0, 1fr);
	}

	#tk-koszyk .tk-it__foto-ramka {
		width: 80px;
		height: 80px;
	}

	#tk-koszyk .tk-krok {
		grid-template-columns: 44px minmax(72px, auto) 44px;
	}

	#tk-koszyk .tk-krok button {
		width: 44px;
	}

	#tk-koszyk .tk-it__suma {
		font-size: 18px;
	}
}

@media (prefers-reduced-motion: reduce) {
	#tk-koszyk .tk__tlo,
	#tk-koszyk .tk__panel,
	#tk-koszyk .tk-it,
	#tk-koszyk .tk-krok button,
	#tk-koszyk .tk-stopka__kasa {
		transition: none;
	}

	#tk-koszyk .tk-zmiana,
	#tk-koszyk.is-loading .tk__pasek {
		animation: none;
	}
}
