/* Современный фильтр каталога (шаблон filter_modern.tpl, тег [catalog_items:filter-modern]).
   Стили модуля, не относятся к теме сайта. Цвета и формы меняются переменными на .cf или :root. */
.cf {
	--cf-accent: #1d2130;
	--cf-accent-text: #fff;
	--cf-border: #e3e5ec;
	--cf-soft: #f5f6f9;
	--cf-muted: #6b7183;
	--cf-radius: 12px;
	--cf-focus: #2563eb;
	color: inherit;
	font-size: 14px;
	line-height: 1.4;
}
.cf *,
.cf *::before,
.cf *::after { box-sizing: border-box; }
.cf [hidden] { display: none !important; }

.cf-panel { display: flex; flex-direction: column; min-width: 0; }
.cf-head { display: flex; align-items: center; gap: 10px; padding: 0 0 10px; }
.cf-title { flex: 1; font-size: 18px; font-weight: 800; }
.cf-reset {
	padding: 4px 0;
	border: 0;
	background: none;
	color: var(--cf-muted);
	font: inherit;
	font-size: 13px;
	text-decoration: underline;
	cursor: pointer;
}
.cf-reset:hover { color: var(--cf-accent); }
.cf-close { display: none; width: 40px; height: 40px; border: 0; border-radius: 50%; background: var(--cf-soft); color: inherit; cursor: pointer; align-items: center; justify-content: center; }
.cf-open { display: none; }
.cf-body { display: block; }

.cf-group { border-top: 1px solid var(--cf-border); }
.cf-group-head {
	display: flex;
	align-items: center;
	gap: 8px;
	width: 100%;
	padding: 14px 0;
	border: 0;
	background: none;
	color: inherit;
	font: inherit;
	font-weight: 700;
	text-align: left;
	cursor: pointer;
}
.cf-group-name { flex: 1; min-width: 0; }
.cf-group-sel {
	min-width: 20px;
	padding: 0 7px;
	border-radius: 999px;
	background: var(--cf-accent);
	color: var(--cf-accent-text);
	font-size: 12px;
	font-weight: 700;
	line-height: 20px;
	text-align: center;
}
.cf-group-sel:empty { display: none; }
.cf-chevron { flex: none; color: var(--cf-muted); transition: transform .15s ease; }
.cf-group.is-open .cf-chevron { transform: rotate(180deg); }
.cf-group-body { display: none; padding: 0 0 16px; }
.cf-group.is-open .cf-group-body { display: block; }
.cf-group-body--flat { display: block; padding: 10px 0; }
.cf-group-head:focus-visible,
.cf-more:focus-visible,
.cf-apply:focus-visible,
.cf-open:focus-visible,
.cf-reset:focus-visible { outline: 2px solid var(--cf-focus); outline-offset: 2px; border-radius: 6px; }

/* Списки значений */
.cf-search {
	width: 100%;
	height: 38px;
	margin: 0 0 10px;
	padding: 0 12px;
	border: 1px solid #c9ccd8;
	border-radius: 10px;
	background: #fff;
	color: inherit;
	font: inherit;
}
.cf-search:focus { outline: 2px solid var(--cf-focus); outline-offset: 0; border-color: var(--cf-focus); }
.cf-list { list-style: none; margin: 0; padding: 0; max-height: 300px; overflow-y: auto; overscroll-behavior: contain; }
.cf-opt label {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 6px 2px;
	cursor: pointer;
}
.cf-opt input { flex: none; width: 18px; height: 18px; margin: 0; accent-color: var(--cf-accent); cursor: pointer; }
.cf-opt-name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.cf-opt-count { flex: none; color: var(--cf-muted); font-size: 12.5px; }
.cf-opt.is-empty label { cursor: default; opacity: .45; }
.cf-opt.is-empty input { cursor: default; }
.cf-opt.is-hidden { display: none; }
.cf-list:not(.is-expanded) .cf-opt.is-extra { display: none; }
.cf-more {
	margin: 6px 0 0;
	padding: 4px 0;
	border: 0;
	background: none;
	color: var(--cf-focus);
	font: inherit;
	cursor: pointer;
}
.cf-more:hover { text-decoration: underline; }
.cf-flag { display: flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 600; }
.cf-flag input { width: 18px; height: 18px; margin: 0; accent-color: var(--cf-accent); }
.cf-text { width: 100%; height: 38px; padding: 0 12px; border: 1px solid #c9ccd8; border-radius: 10px; font: inherit; }

/* Диапазон */
.cf-range-inputs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cf-range-field { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px; border: 1px solid #c9ccd8; border-radius: 10px; background: #fff; }
.cf-range-field:focus-within { outline: 2px solid var(--cf-focus); border-color: var(--cf-focus); }
.cf-range-field span { color: var(--cf-muted); font-size: 13px; }
.cf-range-field input { width: 100%; min-width: 0; border: 0; outline: 0; background: none; color: inherit; font: inherit; font-weight: 600; -moz-appearance: textfield; }
.cf-range-field input::-webkit-outer-spin-button,
.cf-range-field input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.cf-slider { position: relative; height: 28px; margin: 14px 6px 0; }
.cf-slider-track { position: absolute; left: 0; right: 0; top: 12px; height: 4px; border-radius: 4px; background: var(--cf-border); }
.cf-slider-fill { position: absolute; top: 0; bottom: 0; border-radius: 4px; background: var(--cf-accent); }
.cf-slider input[type="range"] {
	position: absolute;
	left: -6px;
	right: -6px;
	top: 0;
	width: calc(100% + 12px);
	height: 28px;
	margin: 0;
	background: none;
	pointer-events: none;
	touch-action: pan-y;
	-webkit-appearance: none;
	appearance: none;
}
.cf-slider input[type="range"]::-webkit-slider-runnable-track { background: none; height: 28px; }
.cf-slider input[type="range"]::-moz-range-track { background: none; height: 28px; }
.cf-slider input[type="range"]::-webkit-slider-thumb {
	-webkit-appearance: none;
	width: 22px;
	height: 22px;
	margin-top: 3px;
	border: 3px solid var(--cf-accent);
	border-radius: 50%;
	background: #fff;
	box-shadow: 0 1px 4px rgba(20, 24, 40, .3);
	pointer-events: auto;
	cursor: grab;
}
.cf-slider input[type="range"]::-moz-range-thumb {
	width: 16px;
	height: 16px;
	border: 3px solid var(--cf-accent);
	border-radius: 50%;
	background: #fff;
	pointer-events: auto;
	cursor: grab;
}
.cf-slider input[type="range"]:focus-visible::-webkit-slider-thumb { outline: 2px solid var(--cf-focus); outline-offset: 2px; }

.cf-foot { display: none; }
.cf-apply {
	width: 100%;
	min-height: 48px;
	padding: 12px 20px;
	border: 0;
	border-radius: 999px;
	background: var(--cf-accent);
	color: var(--cf-accent-text);
	font: inherit;
	font-weight: 700;
	cursor: pointer;
}
.cf-status { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Состояние загрузки списка */
[data-cf-results] { transition: opacity .15s ease; }
[data-cf-results].is-loading { opacity: .45; pointer-events: none; }

/* Плашки выбранного над списком */
.cf-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 14px; }
.cf-chips:empty { display: none; }
.cf-chip {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	max-width: 100%;
	padding: 6px 8px 6px 12px;
	border: 1px solid var(--cf-border, #e3e5ec);
	border-radius: 999px;
	background: #f5f6f9;
	color: inherit;
	font: inherit;
	font-size: 13px;
	cursor: pointer;
}
.cf-chip:hover { border-color: #1d2130; }
.cf-chip b { font-weight: 700; }
.cf-chip svg { flex: none; }
.cf-chip--reset { border-style: dashed; background: #fff; padding-right: 12px; }

/* Телефон и планшет: панель во весь экран по кнопке «Фильтры» */
@media (max-width: 991.98px) {
	.cf-open {
		display: inline-flex;
		align-items: center;
		gap: 8px;
		min-height: 44px;
		padding: 10px 18px;
		border: 1px solid var(--cf-border);
		border-radius: 999px;
		background: #fff;
		color: inherit;
		font: inherit;
		font-weight: 700;
		cursor: pointer;
	}
	.cf-badge { min-width: 20px; padding: 0 6px; border-radius: 999px; background: var(--cf-accent); color: var(--cf-accent-text); font-size: 12px; line-height: 20px; text-align: center; }
	.cf-backdrop { position: fixed; inset: 0; z-index: 2147482000; background: rgba(10, 12, 18, .5); }
	.cf-panel {
		position: fixed;
		inset: 0;
		z-index: 2147482001;
		padding: 14px 16px 0;
		background: #fff;
		transform: translateY(100%);
		visibility: hidden;
		transition: transform .22s ease, visibility 0s linear .22s;
	}
	.cf.is-open .cf-panel { transform: none; visibility: visible; transition: transform .22s ease; }
	.cf-close { display: inline-flex; }
	.cf-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding-bottom: 12px; }
	.cf-foot { display: block; padding: 12px 0 max(12px, env(safe-area-inset-bottom)); border-top: 1px solid var(--cf-border); background: #fff; }
	.cf-list { max-height: none; overflow: visible; overscroll-behavior: auto; }
	html.cf-lock,
	html.cf-lock body { overflow: hidden; }
}
@media (prefers-reduced-motion: reduce) {
	.cf-panel,
	.cf-chevron,
	[data-cf-results] { transition: none; }
}

/* Цветной кружок перед значением (картинка-образец или цвет HEX из справочника значений) */
.cf-swatch { flex: 0 0 auto; width: 16px; height: 16px; margin-right: 8px; border: 1px solid var(--cf-border); border-radius: 50%; background-size: cover; background-position: center; }
