/* Archiwum produktów: kategorie, sortowanie, filtry, siatka ----------------- */

.careli-shop {
	position: relative;
}

.careli-shop.is-loading .shop-results {
	opacity: 0.45;
	pointer-events: none;
	transition: opacity 0.2s;
}

/* Pasek: kategorie + sortowanie */
.shop-bar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-3);
	padding-block: var(--space-3);
	border-bottom: 1px solid #c9c9c9;
}

.shop-cats {
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-2) var(--space-4);
}

.shop-cats__link {
	padding: 0.35rem 0.75rem;
	color: var(--text-primary);
	text-decoration: none;
	transition: background var(--transition);
}

.shop-cats__link:hover,
.shop-cats__link.is-active {
	background: var(--accent-primary);
	color: var(--text-primary);
}

/* Sortowanie */
.shop-sort {
	position: relative;
	margin-left: auto;
	font-size: var(--text-sm);
}

.shop-sort__toggle {
	list-style: none;
	cursor: pointer;
	user-select: none;
	color: var(--text-primary);
}

.shop-sort__toggle::-webkit-details-marker {
	display: none;
}

.shop-sort__list {
	position: absolute;
	right: 0;
	top: calc(100% + var(--space-2));
	z-index: 20;
	min-width: 220px;
	margin: 0;
	padding: var(--space-1) 0;
	list-style: none;
	background: #fff;
	box-shadow: 0 6px 24px rgba(0, 0, 0, 0.12);
}

.shop-sort__option {
	display: block;
	padding: 0.5rem 1rem;
	color: var(--text-primary);
	text-decoration: none;
}

.shop-sort__option:hover,
.shop-sort__option.is-active {
	background: var(--accent-primary-light);
}

/* Układ: filtry | produkty */
.shop-layout {
	display: grid;
	gap: var(--space-4);
}

@media (min-width: 900px) {
	.shop-layout {
		grid-template-columns: 300px 1fr;
		gap: 0;
	}

	.shop-sidebar {
		padding: var(--space-3) var(--space-3) var(--space-3) 0;
		border-right: 1px solid #c9c9c9;
	}

	.shop-results {
		padding: var(--space-3) 0 var(--space-3) var(--space-5);
	}
}

/* Panel filtrów */
.shop-filters {
	padding: var(--space-3);
	background: #fff;
}

.shop-filter {
	margin: 0 0 var(--space-4);
	padding: 0;
	border: 0;
	min-width: 0;
}

.shop-filter__title {
	margin-bottom: var(--space-2);
	padding: 0;
	font-size: var(--text-sm);
	color: var(--text-primary);
}

.shop-filter__options {
	display: flex;
	flex-wrap: wrap;
	gap: 0.4rem;
}

.shop-filter__option {
	position: relative;
	margin: 0;
	font-weight: 400;
	cursor: pointer;
}

/* Przyciski */
.shop-filter--buttons .shop-filter__option input {
	position: absolute;
	opacity: 0;
	pointer-events: none;
}

.shop-filter--buttons .shop-filter__option span {
	display: inline-block;
	padding: 0.3rem 0.8rem;
	font-size: 0.75rem;
	color: var(--text-primary);
	background: #ebebeb;
	transition: background var(--transition);
}

.shop-filter--buttons .shop-filter__option:hover span {
	background: var(--accent-primary-light);
}

.shop-filter--buttons .shop-filter__option input:checked + span {
	background: var(--accent-primary);
}

.shop-filter--buttons .shop-filter__option input:focus-visible + span {
	outline: 2px solid var(--accent-primary-dark);
	outline-offset: 2px;
}

/* Pola wyboru */
.shop-filter--checkbox .shop-filter__options {
	flex-direction: column;
	gap: 0.35rem;
}

.shop-filter--checkbox .shop-filter__option {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	font-size: var(--text-sm);
	color: var(--text-primary);
}

.shop-filter--checkbox input {
	appearance: none;
	flex: 0 0 auto;
	width: 18px;
	height: 18px;
	margin: 0;
	border: 1.5px solid var(--text-primary);
	background: #fff;
	cursor: pointer;
}

.shop-filter--checkbox input:checked {
	background: var(--accent-primary) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3 8.5l3 3 7-7' fill='none' stroke='%232B353E' stroke-width='2'/%3E%3C/svg%3E") center / 14px no-repeat;
}

.shop-filter--checkbox input:focus-visible {
	outline: 2px solid var(--accent-primary-dark);
	outline-offset: 2px;
}

/* Suwak od–do */
.shop-range {
	position: relative;
	height: 20px;
}

.shop-range__track {
	position: absolute;
	left: 0;
	right: 0;
	top: 50%;
	height: 2px;
	transform: translateY(-50%);
	background: #c9c9c9;
}

.shop-range__fill {
	position: absolute;
	top: 0;
	bottom: 0;
	background: var(--accent-primary-dark);
}

.shop-range__input {
	position: absolute;
	inset: 0;
	width: 100%;
	margin: 0;
	padding: 0;
	appearance: none;
	background: none;
	border: 0;
	pointer-events: none;
}

.shop-range__input::-webkit-slider-thumb {
	appearance: none;
	width: 10px;
	height: 10px;
	border-radius: 50%;
	background: var(--accent-primary-dark);
	cursor: pointer;
	pointer-events: auto;
}

.shop-range__input::-moz-range-thumb {
	width: 10px;
	height: 10px;
	border: 0;
	border-radius: 50%;
	background: var(--accent-primary-dark);
	cursor: pointer;
	pointer-events: auto;
}

.shop-range__input::-moz-range-track {
	background: none;
}

.shop-range__values {
	display: flex;
	justify-content: space-between;
	margin-top: var(--space-2);
	font-size: 0.75rem;
	color: var(--text-primary);
}

.shop-filters__reset {
	font-size: var(--text-sm);
	color: var(--text-primary);
}

/* Filtry na mobile: panel wysuwany z lewej (off-canvas) -------------------- */

/* Pasek nad listą: [Filtry] … [Sortuj od] */
.catalog_tools {
	display: flex;
	align-items: center;
	gap: var(--space-3);
}

/* Przycisk, nagłówek i stopka panelu istnieją tylko na mobile */
.shop-filters-toggle,
.shop-filters__head,
.shop-filters__foot {
	display: none;
}

@media (max-width: 991px) {
	.catalog_tools {
		width: 100%;
		justify-content: space-between;
	}

	.shop-filters-toggle {
		display: inline-flex;
		align-items: center;
		gap: 8px;
		height: 38px;
		padding: 0 14px 0 12px;
		border: 1px solid var(--text-primary);
		border-radius: var(--radius);
		background: #fff;
		color: var(--text-primary);
		font-size: 14px;
		font-weight: 600;
		line-height: 1;
		cursor: pointer;
	}

	.shop-filters-toggle .mdi {
		font-size: 20px;
		line-height: 1;
	}

	.shop-filters-toggle__count {
		display: inline-grid;
		place-items: center;
		min-width: 20px;
		height: 20px;
		padding: 0 6px;
		border-radius: 10px;
		background: var(--accent-primary);
		font-size: 12px;
	}

	/* Blokada przewijania strony pod otwartym panelem */
	html:has(.careli-shop.is-filters-open),
	body:has(.careli-shop.is-filters-open) {
		overflow: hidden;
	}

	/* <aside> = przyciemnione tło na cały ekran, .shop-filters = sam panel */
	.products_catalog_sidebar {
		position: fixed;
		inset: 0;
		z-index: 1000;
		background: rgba(43, 53, 62, 0.5);
		opacity: 0;
		visibility: hidden;
		transition: opacity 0.25s ease, visibility 0s linear 0.25s;
	}

	.careli-shop.is-filters-open .products_catalog_sidebar {
		opacity: 1;
		visibility: visible;
		transition: opacity 0.25s ease;
	}

	.products_catalog_sidebar .shop-filters {
		position: absolute;
		top: 0;
		bottom: 0;
		left: 0;
		display: flex;
		flex-direction: column;
		width: min(400px, 88vw);
		padding: 0;
		background: #fff;
		box-shadow: 0 0 32px rgba(0, 0, 0, 0.18);
		transform: translateX(-100%);
		transition: transform 0.25s ease;
	}

	.careli-shop.is-filters-open .products_catalog_sidebar .shop-filters {
		transform: none;
	}

	.shop-filters__head {
		display: flex;
		flex: none;
		align-items: center;
		justify-content: space-between;
		gap: var(--space-3);
		padding: 12px 16px;
		border-bottom: 1px solid #c9c9c9;
	}

	.shop-filters__heading {
		margin: 0;
		font-family: var(--font-heading);
		font-size: 22px;
		font-weight: 600;
		line-height: 1.2;
		color: var(--text-primary);
	}

	.shop-filters__close {
		display: grid;
		flex: none;
		place-items: center;
		width: 36px;
		height: 36px;
		padding: 0;
		border: 0;
		background: var(--accent-primary);
		color: var(--text-primary);
		font-size: 22px;
		cursor: pointer;
	}

	.shop-filters__body {
		flex: 1 1 auto;
		min-height: 0;
		padding: 16px;
		overflow-y: auto;
		overscroll-behavior: contain;
	}

	/* Grupy oddzielone kreską (dolną — górna kolidowałaby z <legend>) */
	.shop-filters__body .shop-filter {
		margin-bottom: 16px;
	}

	.shop-filters__body .shop-filter:not(:last-of-type) {
		padding-bottom: 16px;
		border-bottom: 1px solid #e5e5e5;
	}

	.shop-filters__body .shop-filter__title {
		font-size: 15px;
		font-weight: 600;
	}

	/* Większe pola pod palec */
	.shop-filters__body .shop-filter--buttons .shop-filter__options {
		gap: 8px;
	}

	.shop-filters__body .shop-filter--buttons .shop-filter__option span {
		padding: 0.45rem 0.9rem;
		font-size: 0.875rem;
	}

	.shop-filters__body .shop-filter--checkbox .shop-filter__options {
		gap: 2px;
	}

	.shop-filters__body .shop-filter--checkbox .shop-filter__option {
		min-height: 36px;
		font-size: 15px;
	}

	.shop-filters__body .shop-filter--checkbox input {
		width: 20px;
		height: 20px;
	}

	.shop-filters__body .shop-range {
		height: 28px;
	}

	/* Tor węższy o pół kciuka z każdej strony, żeby wypełnienie kończyło się na środku kciuka */
	.shop-filters__body .shop-range__track {
		left: 11px;
		right: 11px;
	}

	.shop-filters__body .shop-range__input::-webkit-slider-thumb {
		width: 22px;
		height: 22px;
		border: 3px solid #fff;
		box-shadow: 0 0 0 1px var(--accent-primary-dark);
		box-sizing: border-box;
	}

	.shop-filters__body .shop-range__input::-moz-range-thumb {
		width: 22px;
		height: 22px;
		border: 3px solid #fff;
		box-shadow: 0 0 0 1px var(--accent-primary-dark);
		box-sizing: border-box;
	}

	.shop-filters__body .shop-range__values {
		font-size: 14px;
	}

	/* „Wyczyść” jest w stopce panelu */
	.shop-filters__body .shop-filters__reset {
		display: none;
	}

	.shop-filters__foot {
		display: flex;
		flex: none;
		gap: 12px;
		padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
		border-top: 1px solid #c9c9c9;
		background: #fff;
	}

	.shop-filters__clear,
	.shop-filters__apply {
		display: inline-flex;
		align-items: center;
		justify-content: center;
		gap: 8px;
		height: 46px;
		padding: 0 16px;
		border-radius: var(--radius);
		color: var(--text-primary);
		font-size: 15px;
		font-weight: 600;
		line-height: 1;
		text-decoration: none;
		white-space: nowrap;
		cursor: pointer;
	}

	.shop-filters__clear {
		border: 1px solid var(--text-primary);
		background: #fff;
	}

	.shop-filters__apply {
		flex: 1 1 auto;
		border: 0;
		background: var(--accent-primary);
	}

	/* Wyniki doładowują się pod panelem — kręciołek na przycisku */
	.careli-shop.is-loading .shop-filters__apply::before {
		content: "";
		width: 14px;
		height: 14px;
		border: 2px solid currentColor;
		border-right-color: transparent;
		border-radius: 50%;
		animation: careli-spin 0.7s linear infinite;
	}
}

@keyframes careli-spin {
	to {
		transform: rotate(360deg);
	}
}

/* Siatka produktów: 2 kolumny jak w projekcie */
.shop-results ul.products,
.woocommerce .shop-results ul.products {
	grid-template-columns: 1fr;
	gap: var(--space-4);
}

@media (min-width: 640px) {
	.shop-results ul.products,
	.woocommerce .shop-results ul.products {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

.shop-results ul.products::before,
.shop-results ul.products::after {
	display: none; /* clearfix Woo psuje grid */
}

/* Dolna sekcja: opis kategorii 7/12 + formularz 5/12 */
.shop-bottom {
	display: grid;
	gap: var(--space-4);
	margin-top: var(--space-4);
	padding-top: var(--space-5);
	border-top: 1px solid #c9c9c9;
}

@media (min-width: 900px) {
	.shop-bottom {
		grid-template-columns: 7fr 5fr;
		gap: var(--space-5);
		align-items: start;
	}
}

.shop-bottom__content h2,
.shop-bottom__content h3 {
	margin: 0 0 var(--space-3);
	color: var(--text-primary);
}

.shop-bottom__content p {
	color: var(--text-primary-light);
	line-height: 1.6;
}

.shop-bottom__content > * + h2,
.shop-bottom__content > * + h3 {
	margin-top: var(--space-5);
}


