/* =========================================================
   Furniland — каталог: фільтри + AJAX-браузинг (.fl-browse)
   ========================================================= */

.fl-browse,
.fl-browse *,
.fl-browse *::before,
.fl-browse *::after {
	box-sizing: border-box;
}

.fl-browse {
	display: grid;
	grid-template-columns: 280px minmax(0, 1fr);
	gap: clamp(20px, 2vw, 32px);
	align-items: start;
}

.fl-browse__main.is-loading {
	opacity: 0.45;
	pointer-events: none;
	transition: opacity 0.15s ease;
}

@media (min-width: 1600px) {
	.woocommerce .fl-browse__main ul.products,
	.woocommerce-page .fl-browse__main ul.products,
	.woocommerce .fl-browse__main ul.products[class*="columns-"],
	.woocommerce-page .fl-browse__main ul.products[class*="columns-"],
	.fl-browse__main ul.products {
		grid-template-columns: repeat(4, minmax(0, 1fr));
	}
}

/* ---- Сайдбар ---- */
.fl-filters {
	position: sticky;
	top: 88px;
	max-height: calc(100vh - 104px);
	overflow-y: auto;
	overscroll-behavior: contain;
	scrollbar-width: thin;
	scrollbar-color: var(--fl-border, #e6e8e6) transparent;
}

.fl-filters__panel {
	background: #fff;
	border: 1px solid var(--fl-border, #e6e8e6);
	border-radius: 20px;
	padding: 18px 20px 8px;
}

.fl-filters__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding-bottom: 12px;
	border-bottom: 1px solid var(--fl-border, #e6e8e6);
}

.fl-filters__title {
	margin: 0;
	color: var(--fl-heading, #1b2b27);
	font-size: 1.05rem;
	font-weight: 700;
}

.fl-filters__reset {
	margin-left: auto;
	color: var(--fl-muted, #6b7280);
	font-size: 0.85rem;
	font-weight: 600;
	text-decoration: underline;
	text-underline-offset: 3px;
	transition: color 0.15s ease;
}

.fl-filters__reset:hover,
.fl-filters__reset:focus-visible {
	color: var(--fl-primary, #397063);
}

.fl-filters__close {
	display: none;
}

.fl-filters__apply {
	display: none;
}

/* ---- Група фільтра ---- */
.fl-fgroup {
	border-bottom: 1px solid var(--fl-border, #e6e8e6);
	padding: 4px 0 14px;
}

.fl-fgroup:last-child {
	border-bottom: 0;
}

.fl-fgroup__sum {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	padding: 12px 0 0;
	color: var(--fl-heading, #1b2b27);
	font-size: 0.95rem;
	font-weight: 700;
	cursor: pointer;
	list-style: none;
	user-select: none;
}

.fl-fgroup__sum::-webkit-details-marker {
	display: none;
}

.fl-fgroup__sum:focus {
	outline: none;
}

.fl-fgroup__sum:focus-visible {
	outline: 2px solid var(--fl-primary, #397063);
	outline-offset: 2px;
	border-radius: 8px;
}

.fl-fgroup__label {
	display: inline-flex;
	align-items: center;
	gap: 8px;
}

.fl-fgroup__badge {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 19px;
	height: 19px;
	padding: 0 5px;
	border-radius: 999px;
	background: var(--fl-primary, #397063);
	color: #fff;
	font-size: 0.72rem;
	font-weight: 700;
	line-height: 1;
}

.fl-fgroup__chev {
	flex: 0 0 auto;
	color: var(--fl-muted, #6b7280);
	transition: transform 0.18s ease;
}

.fl-fgroup[open] .fl-fgroup__chev {
	transform: rotate(180deg);
}

.fl-fgroup__list {
	list-style: none;
	margin: 10px 0 0;
	padding: 0;
}

.fl-fgroup__list.is-capped:not(.is-open) li:nth-child(n + 9) {
	display: none;
}

.fl-fgroup__more {
	margin-top: 6px;
	padding: 4px 0;
	border: 0;
	background: none;
	color: var(--fl-primary, #397063);
	font-family: inherit;
	font-size: 0.85rem;
	font-weight: 600;
	cursor: pointer;
	text-decoration: underline;
	text-underline-offset: 3px;
}

.fl-fgroup__more:hover,
.fl-fgroup__more:focus-visible {
	color: var(--fl-primary-dark, #387261);
}

/* ---- Опція-чекбокс ---- */
.fl-fopt {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 7px 0;
	color: var(--wp--preset--color--contrast, #1e1e1e);
	font-size: 0.9rem;
	text-decoration: none;
}

.fl-fopt__box {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 20px;
	height: 20px;
	border: 1.5px solid var(--fl-border, #e6e8e6);
	border-radius: 6px;
	background: #fff;
	color: #fff;
	transition: background-color 0.15s ease, border-color 0.15s ease;
}

.fl-fopt__box svg {
	opacity: 0;
	transition: opacity 0.15s ease;
}

.fl-fopt:hover .fl-fopt__box,
.fl-fopt:focus-visible .fl-fopt__box {
	border-color: var(--fl-primary, #397063);
}

.fl-fopt.is-active .fl-fopt__box {
	background: var(--fl-primary, #397063);
	border-color: var(--fl-primary, #397063);
}

.fl-fopt.is-active .fl-fopt__box svg {
	opacity: 1;
}

.fl-fopt__name {
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	transition: color 0.15s ease;
}

.fl-fopt:hover .fl-fopt__name {
	color: var(--fl-primary, #397063);
}

.fl-fopt__count {
	flex: 0 0 auto;
	margin-left: auto;
	color: var(--fl-muted, #6b7280);
	font-size: 0.8rem;
	font-weight: 600;
}

/* ---- Підкатегорії ---- */
.fl-fsub {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 7px 0;
	color: var(--wp--preset--color--contrast, #1e1e1e);
	font-size: 0.9rem;
	text-decoration: none;
}

.fl-fsub__name {
	transition: color 0.15s ease;
}

.fl-fsub:hover .fl-fsub__name,
.fl-fsub:focus-visible .fl-fsub__name {
	color: var(--fl-primary, #397063);
}

.fl-fsub__count {
	margin-left: auto;
	color: var(--fl-muted, #6b7280);
	font-size: 0.8rem;
	font-weight: 600;
}

/* ---- Ціна ---- */
.fl-fprice {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-top: 12px;
}

.fl-fprice__input {
	width: 100%;
	min-width: 0;
	padding: 9px 10px;
	border: 1px solid var(--fl-border, #e6e8e6);
	border-radius: 10px;
	background: #fff;
	color: var(--fl-heading, #1b2b27);
	font-family: inherit;
	font-size: 0.9rem;
	appearance: textfield;
	-moz-appearance: textfield;
}

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

.fl-fprice__input:focus-visible {
	outline: none;
	border-color: var(--fl-primary, #397063);
	box-shadow: 0 0 0 3px var(--fl-primary-light, #e9f5ea);
}

.fl-fprice__sep {
	flex: 0 0 auto;
	color: var(--fl-muted, #6b7280);
}

.fl-fprice__btn {
	flex: 0 0 auto;
	padding: 9px 14px;
	border: 1px solid var(--fl-primary, #397063);
	border-radius: 10px;
	background: #fff;
	color: var(--fl-primary, #397063);
	font-family: inherit;
	font-size: 0.85rem;
	font-weight: 700;
	cursor: pointer;
	transition: background-color 0.15s ease;
}

.fl-fprice__btn:hover,
.fl-fprice__btn:focus-visible {
	background: var(--fl-primary-light, #e9f5ea);
}

/* ---- Чипси активних фільтрів ---- */
.fl-chips {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
	margin: 0 0 16px;
}

.fl-chip {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	padding: 8px 13px;
	border-radius: 999px;
	background: var(--fl-primary-light, #e9f5ea);
	color: var(--fl-primary-dark, #387261);
	font-size: 0.85rem;
	font-weight: 600;
	line-height: 1;
	text-decoration: none;
	transition: background-color 0.15s ease, color 0.15s ease;
}

.fl-chip:hover,
.fl-chip:focus-visible {
	background: var(--fl-primary, #397063);
	color: #fff;
}

.fl-chip--reset {
	background: transparent;
	border: 1px dashed var(--fl-border, #e6e8e6);
	color: var(--fl-muted, #6b7280);
}

.fl-chip--reset:hover,
.fl-chip--reset:focus-visible {
	background: transparent;
	border-color: var(--fl-primary, #397063);
	color: var(--fl-primary, #397063);
}

/* ---- Кнопка «Фільтри» в тулбарі ---- */
.fl-filters-toggle {
	display: none;
	align-items: center;
	gap: 8px;
	padding: 12px 16px;
	border: 1px solid var(--fl-border, #e6e8e6);
	border-radius: 12px;
	background: #fff;
	color: var(--fl-heading, #1b2b27);
	font-family: inherit;
	font-size: 0.9rem;
	font-weight: 600;
	line-height: 1.2;
	cursor: pointer;
	transition: border-color 0.15s ease;
}

.fl-filters-toggle:hover,
.fl-filters-toggle:focus-visible {
	border-color: var(--fl-primary, #397063);
}

.fl-filters-toggle__badge {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 19px;
	height: 19px;
	padding: 0 5px;
	border-radius: 999px;
	background: var(--fl-primary, #397063);
	color: #fff;
	font-size: 0.72rem;
	font-weight: 700;
}

/* ---- Порожній результат ---- */
.fl-noresults {
	padding: clamp(32px, 5vw, 64px) 20px;
	border: 1px dashed var(--fl-border, #e6e8e6);
	border-radius: 20px;
	text-align: center;
}

.fl-noresults__title {
	margin: 0 0 6px;
	color: var(--fl-heading, #1b2b27);
	font-size: 1.1rem;
	font-weight: 700;
}

.fl-noresults__text {
	margin: 0 0 18px;
	color: var(--fl-muted, #6b7280);
	font-size: 0.95rem;
}

/* ---- Мобільний drawer ---- */
@media (max-width: 1024px) {
	.fl-browse {
		display: block;
	}

	.fl-filters-toggle {
		display: inline-flex;
	}

	.fl-filters {
		position: fixed;
		inset: 0;
		z-index: 150;
		max-height: none;
		overflow: hidden;
		background: rgba(18, 28, 23, 0.45);
		opacity: 0;
		visibility: hidden;
		transition: opacity 0.22s ease, visibility 0s linear 0.22s;
	}

	body.fl-filters-open .fl-filters {
		opacity: 1;
		visibility: visible;
		transition: opacity 0.22s ease;
	}

	body.fl-filters-open {
		overflow: hidden;
	}

	.fl-filters__panel {
		position: absolute;
		top: 0;
		left: 0;
		bottom: 0;
		display: flex;
		flex-direction: column;
		width: min(400px, 92vw);
		height: 100dvh;
		padding: 0;
		border: 0;
		border-radius: 0;
		transform: translateX(-105%);
		transition: transform 0.28s ease;
	}

	body.fl-filters-open .fl-filters__panel {
		transform: translateX(0);
	}

	.fl-filters__head {
		flex: 0 0 auto;
		padding: 12px 16px;
	}

	.fl-filters__close {
		display: inline-flex;
	}

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

	.fl-filters__apply {
		flex: 0 0 auto;
		display: block;
		padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
		border-top: 1px solid var(--fl-border, #e6e8e6);
		background: #fff;
	}

	.fl-filters__apply-btn {
		width: 100%;
	}
}

@media (max-width: 560px) {
	.fl-toolbar__count {
		width: 100%;
	}

	.fl-filters-toggle {
		flex: 0 0 auto;
	}

	.fl-toolbar .woocommerce-ordering {
		flex: 1 1 auto;
		width: auto;
	}
}
