/* ==========================================================================
   Filtrele din magazin și categorii: coloana de pe desktop, panoul de pe
   telefon și tabletă (baza e coșul lateral, din header.css), filtrele alese.
   ========================================================================== */

.shop__main {
	display: flex;
	flex-direction: column;
	gap: 20px;
	min-width: 0;
}

.shop__main:focus {
	outline: none;
}

.shop__main .product-grid,
.shop__main .no-results,
.shop__main .woocommerce-pagination {
	transition: opacity 0.15s ease;
}

/* Lista rămâne pe loc cât vine cea nouă; răspunsurile rapide nu pâlpâie. */
.shop__main.is-busy .product-grid,
.shop__main.is-busy .no-results,
.shop__main.is-busy .woocommerce-pagination {
	opacity: 0.45;
	transition-delay: 0.12s;
}

/* Bara de sus: butonul de filtre, numărul de produse, sortarea ------------ */
.archive-tools__filters {
	height: 44px;
	padding: 0 18px;
	border-width: 1px;
	border-color: var(--c-line);
	border-radius: 12px;
	font-size: 14px;
}

.archive-tools__count,
.fgroup__picked {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 22px;
	height: 22px;
	padding: 0 6px;
	border-radius: 999px;
	background: var(--c-green);
	color: var(--c-white);
	font-size: 12px;
	font-weight: 700;
	line-height: 1;
}

.shop .woocommerce-ordering {
	display: flex;
	align-items: center;
	gap: 8px;
	margin: 0;
	min-width: 0;
}

.shop .woocommerce-ordering .orderby {
	appearance: none;
	max-width: 100%;
	padding: 0 40px 0 16px;
	background: var(--c-white) var(--chev) no-repeat right 14px center;
	cursor: pointer;
	text-overflow: ellipsis;
}

.woocommerce-ordering__go {
	height: 44px;
	padding: 0 16px;
	border-radius: 12px;
	font-size: 14px;
}

/* Filtrele alese --------------------------------------------------------- */
.factive .chip-list {
	align-items: center;
}

.fchip {
	background: var(--c-white);
	border-color: var(--c-green);
	padding-right: 12px;
	overflow-wrap: anywhere;
}

.fchip .icon {
	color: var(--c-green);
}

.fchip:hover {
	background: var(--c-teal-soft);
}

.factive__clear {
	display: inline-flex;
	align-items: center;
	min-height: 44px;
	padding: 0 8px;
	font-size: 14px;
	font-weight: 700;
	text-decoration: underline;
	text-underline-offset: 3px;
	text-decoration-color: transparent;
	transition: text-decoration-color 0.15s ease;
}

.factive__clear:hover {
	text-decoration-color: currentColor;
}

/* Formularul -------------------------------------------------------------- */
.filters {
	display: flex;
	flex-direction: column;
	min-height: 0;
	background: var(--c-white);
	border: 1px solid var(--c-line);
	border-radius: 28px;
	box-shadow: var(--shadow-card);
	overflow: hidden;
}

.filters__head {
	flex: none;
	display: flex;
	align-items: center;
	min-height: 64px;
	padding: 8px 24px;
}

.filters__title {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	font-size: 22px;
	letter-spacing: -0.01em;
}

.filters__title .icon {
	color: var(--c-green);
}

.filters__groups {
	flex: 1;
	min-height: 0;
}

.filters__apply {
	flex: none;
	padding: 16px 24px 24px;
	border-top: 1px solid var(--c-line-soft);
}

.filters__apply .btn-dark {
	width: 100%;
	justify-content: center;
	border: 0;
}

/* Cu JavaScript lista se actualizează singură. */
.filters.is-live .filters__apply {
	display: none;
}

/* Un grup ----------------------------------------------------------------- */
.fgroup {
	border-top: 1px solid var(--c-line-soft);
}

.fgroup__head {
	display: flex;
	align-items: center;
	gap: 10px;
	min-height: 56px;
	padding: 0 20px 0 24px;
	list-style: none;
	cursor: pointer;
}

.fgroup__head::-webkit-details-marker {
	display: none;
}

.fgroup__head:focus-visible {
	outline-offset: -4px;
	border-radius: 16px;
}

.fgroup__title {
	font-family: var(--f-head);
	font-size: 17px;
	font-weight: 700;
	letter-spacing: -0.005em;
}

.fgroup__head .icon {
	margin-left: auto;
	color: var(--c-muted);
	transition: transform 0.2s ease, color 0.15s ease;
}

.fgroup__head:hover .icon {
	color: var(--c-green);
}

.fgroup[open] > .fgroup__head .icon {
	transform: rotate(180deg);
}

.fgroup__set {
	margin: 0;
	padding: 0 16px 18px;
	border: 0;
	min-width: 0;
}

.fopts {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.fgroup .fopts--pills {
	flex-flow: row wrap;
	gap: 8px;
	padding: 2px 8px 0;
}

.fopts--pills > li {
	max-width: 100%;
}

/* Rând cu bifă */
.fopt {
	position: relative;
	display: flex;
	align-items: center;
	gap: 12px;
	min-height: 42px;
	padding: 6px 8px;
	border-radius: 12px;
	font-size: 15px;
	line-height: 1.35;
	cursor: pointer;
	transition: background-color 0.15s ease;
}

.fopt:hover {
	background: var(--c-latte);
}

.fopt--sub {
	margin-left: 32px;
	min-height: 38px;
	font-size: 14px;
	color: var(--c-text-2);
}

.fopt__body {
	flex: 1;
	min-width: 0;
	display: flex;
	align-items: center;
	gap: 10px;
}

.fopt__name {
	min-width: 0;
	overflow-wrap: anywhere;
}

.fopt__count {
	margin-left: auto;
	font-size: 13px;
	color: var(--c-muted);
	font-variant-numeric: tabular-nums;
}

.fopt__input:checked + .fopt__body .fopt__name {
	font-weight: 700;
	color: var(--c-ink);
}

.fopt.is-off {
	cursor: not-allowed;
}

.fopt.is-off:hover {
	background: none;
}

.fopt.is-off .fopt__body {
	color: #7B8587;
}

.fopt.is-off .fopt__count {
	color: inherit;
}

.fopt.is-off .fopt__input {
	cursor: not-allowed;
}

/* Pastilă (memorie, culoare): aceeași idee ca .opt-pill de pe produs */
.fopt--pill,
.fopt--pill:hover {
	padding: 0;
	min-height: 0;
	background: none;
}

.fopt--pill .fopt__input {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	margin: 0;
	opacity: 0;
}

.fopt--pill .fopt__body {
	gap: 8px;
	min-height: 44px;
	padding: 4px 16px;
	border: 2px solid var(--c-line);
	border-radius: 999px;
	background: var(--c-white);
	font-size: 14px;
	font-weight: 600;
	transition: border-color 0.15s ease, background-color 0.15s ease;
}

.fopt--pill:hover .fopt__body {
	border-color: var(--c-green);
}

.fopt--pill .fopt__count {
	margin-left: 0;
	font-size: 12px;
	font-weight: 500;
}

.fopt--pill .swatch-dot {
	width: 18px;
	height: 18px;
	margin-left: -4px;
}

.fopt--pill .fopt__input:checked + .fopt__body {
	border-color: var(--c-ink);
	background: var(--c-latte);
}

.fopt--pill .fopt__input:checked + .fopt__body .fopt__name {
	font-weight: 600;
}

.fopt--pill .fopt__input:focus-visible + .fopt__body {
	outline: 3px solid var(--c-green);
	outline-offset: 2px;
}

.fopt--pill.is-off .fopt__body,
.fopt--pill.is-off:hover .fopt__body {
	border-color: var(--c-line-soft);
	border-style: dashed;
}

.fopt--pill.is-off .swatch-dot {
	opacity: 0.4;
}

/* Listă lungă: restul apare la cerere (doar cu JavaScript) */
.fopts.is-short .is-extra {
	display: none;
}

.fopts__more {
	min-height: 44px;
	padding: 0 8px;
	border: 0;
	background: none;
	color: var(--c-green);
	font-size: 14px;
	font-weight: 700;
}

.fopts__more:hover {
	color: var(--c-green-hover);
	text-decoration: underline;
	text-underline-offset: 3px;
}

.fopts__more[hidden] {
	display: none;
}

/* Prețul ------------------------------------------------------------------ */
.fprice {
	padding: 2px 8px 0;
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.fprice__slider {
	position: relative;
	height: 44px;
	margin: 0 1px;
}

.fprice__slider[hidden] {
	display: none;
}

.fprice__track {
	position: absolute;
	inset: 19px 0;
	border-radius: 999px;
	background: linear-gradient(
		to right,
		var(--c-line) var(--lo, 0%),
		var(--c-green) var(--lo, 0%),
		var(--c-green) var(--hi, 100%),
		var(--c-line) var(--hi, 100%)
	);
}

.fprice__range {
	appearance: none;
	position: absolute;
	inset: 0;
	width: 100%;
	height: 44px;
	margin: 0;
	background: none;
	pointer-events: none;
}

.fprice__range:focus-visible {
	outline: none;
}

.fprice__range.is-top {
	z-index: 1;
}

.fprice__range::-webkit-slider-runnable-track {
	height: 44px;
	background: none;
}

.fprice__range::-moz-range-track {
	height: 44px;
	background: none;
}

.fprice__range::-webkit-slider-thumb {
	appearance: none;
	width: 26px;
	height: 26px;
	margin-top: 9px;
	border: 2px solid var(--c-green);
	border-radius: 50%;
	background: var(--c-white);
	box-shadow: 0 2px 6px rgba(1, 28, 37, 0.18);
	pointer-events: auto;
	cursor: grab;
}

.fprice__range::-moz-range-thumb {
	box-sizing: border-box;
	width: 26px;
	height: 26px;
	border: 2px solid var(--c-green);
	border-radius: 50%;
	background: var(--c-white);
	box-shadow: 0 2px 6px rgba(1, 28, 37, 0.18);
	pointer-events: auto;
	cursor: grab;
}

.fprice__range:active::-webkit-slider-thumb {
	cursor: grabbing;
	background: var(--c-teal-soft);
}

.fprice__range:focus-visible::-webkit-slider-thumb {
	outline: 3px solid var(--c-green);
	outline-offset: 2px;
}

.fprice__range:focus-visible::-moz-range-thumb {
	outline: 3px solid var(--c-green);
	outline-offset: 2px;
}

.fprice__fields {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
	gap: 10px;
}

.fprice__field {
	display: flex;
	flex-direction: column;
	gap: 6px;
	min-width: 0;
}

.fprice__field label {
	font-size: 13px;
	font-weight: 600;
	color: var(--c-muted);
}

.fprice__box {
	position: relative;
	display: block;
}

.fprice__box input {
	width: 100%;
	height: 46px;
	padding: 0 38px 0 14px;
	font-weight: 600;
	appearance: textfield;
}

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

.fprice__unit {
	position: absolute;
	top: 0;
	right: 14px;
	height: 46px;
	display: inline-flex;
	align-items: center;
	font-size: 13px;
	color: var(--c-muted);
	pointer-events: none;
}

/* Desktop: coloana rămâne lângă listă și se derulează singură ------------- */
@media (min-width: 1081px) {
	.shop--filters {
		display: grid;
		grid-template-columns: 296px minmax(0, 1fr);
		gap: 32px;
		align-items: start;
	}

	.shop__side {
		position: sticky;
		top: calc(var(--wp-admin--admin-bar--height, 0px) + var(--header-h, 0px) + 16px);
	}

	.shop__side .filters {
		max-height: calc(100vh - var(--wp-admin--admin-bar--height, 0px) - var(--header-h, 0px) - 32px);
		min-height: 320px;
	}

	.shop__side .filters__groups {
		overflow-y: auto;
		overscroll-behavior: contain;
		scrollbar-width: thin;
		scrollbar-color: var(--c-line-strong) transparent;
	}

	.archive-tools__filters {
		display: none;
	}
}

/* Telefon și tabletă: panoul ---------------------------------------------- */
@media (max-width: 1080px) {
	/* Fără JavaScript, „Filtre” duce la formular (#filtre) și îl arată. */
	.shop__side {
		display: none;
	}

	.shop__side:target {
		display: block;
		margin-bottom: 24px;
		scroll-margin-top: 200px; /* Fără script nu există --header-h. */
	}

	.shop .archive-tools__filters ~ .woocommerce-result-count {
		margin-right: auto;
	}
}

.filter-drawer__body {
	display: block;
	overflow-y: auto;
	overscroll-behavior: contain;
	padding: 16px;
}

.filter-drawer .filters {
	border-radius: 24px;
}

.filter-drawer .filters__head {
	display: none;
}

.filter-drawer .fgroup:first-child {
	border-top: 0;
}

.filter-drawer .fopt:not(.fopt--pill) {
	min-height: 46px;
}

.filter-drawer .cart-drawer__ctas {
	margin-top: 0;
}

.filter-drawer .btn-dark {
	min-height: 54px;
	height: auto;
	padding: 0 14px;
	justify-content: center;
	border: 0;
	border-radius: 14px;
}

.filter-drawer .js-filter-clear[hidden] {
	display: none;
}

.filter-drawer .js-filter-clear[hidden] + .btn-dark {
	grid-column: 1 / -1;
}

.filter-drawer .cart-drawer__error {
	margin: 0;
}

@media (max-width: 760px) {
	.shop__main {
		gap: 14px;
	}

	.shop--filters .archive-tools {
		display: grid;
		grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
		align-items: start;
		gap: 10px;
	}

	.shop--filters .archive-tools__filters {
		justify-content: center;
		padding: 0 12px;
	}

	.shop--filters .woocommerce-ordering {
		flex-wrap: wrap;
	}

	.shop--filters .woocommerce-ordering .orderby {
		width: 100%;
		padding: 0 34px 0 14px;
		background-position: right 12px center;
	}

	.shop--filters .woocommerce-result-count {
		grid-column: 1 / -1;
		grid-row: 2;
	}

	.filter-drawer__body {
		padding: 12px;
	}

	.filter-drawer .cart-drawer__ctas {
		grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
	}
}

@media (prefers-reduced-motion: reduce) {
	.shop__main .product-grid,
	.shop__main .no-results,
	.fgroup__head .icon {
		transition: none;
	}
}
