/**
 * Ruby Fixes — стили каталожного фильтра.
 *
 * Селекторы написаны под разметку плагина Premmerce
 * (`plugins/premmerce-woocommerce-product-filter-premium/views/frontend/...`).
 *
 * Цель: модернизировать дефолтный вид (бордеры, отступы, чекбоксы,
 * скроллбар, активные фильтры, слайдер цены), оставаясь в фирменной
 * розовой палитре сайта.
 */

:root {
	--rf-accent:           #ed8a9e;
	--rf-accent-soft:      #f9c5d0;
	--rf-accent-shadow:    rgba(237, 138, 158, 0.25);
	--rf-text:             #2b2b2b;
	--rf-text-muted:       #8a8a8a;
	--rf-border:           #ececec;
	--rf-border-strong:    #d6d6d6;
	--rf-bg-soft:          #fafafa;
	--rf-radius:           10px;
	--rf-radius-sm:        6px;
}

/* ---------- Контейнер фильтра ---------- */

.widget_premmerce_filter,
.filter,
.premmerce-filter-widget {
	font-family: inherit;
}

.filter {
	color: var(--rf-text);
	font-size: 14px;
	line-height: 1.5;
}

/* ---------- Секции (filter__item) ---------- */

.filter .filter__item {
	margin: 0 0 18px 0;
	padding: 0 0 18px 0;
	border: 0;
	border-bottom: 1px solid var(--rf-border);
}

.filter .filter__item:last-child {
	border-bottom: 0;
	padding-bottom: 0;
	margin-bottom: 0;
}

/* На случай, если фильтр идёт в .filter--style-premmerce: убираем
   рамку-«коробку» и заменяем на минимальные разделители */
.filter--style-premmerce .filter__item {
	border: 0;
	border-bottom: 1px solid var(--rf-border);
	padding: 18px 0;
	margin: 0;
}

/* ---------- Заголовки секций ---------- */

.filter .filter__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	cursor: default;
	user-select: none;
}

.filter .filter__header[data-premmerce-filter-drop-handle] {
	cursor: pointer;
}

.filter .filter__title,
.filter--style-premmerce .filter__title {
	display: block;
	font-size: 14px;
	font-weight: 600;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--rf-text);
	margin: 0;
}

/* Кнопка раскрытия + / − */
.filter .filter__handle-ico {
	width: 16px;
	height: 16px;
	color: var(--rf-text-muted);
	fill: var(--rf-text-muted);
	transition: color 0.2s ease, transform 0.2s ease;
}

.filter .filter__header:hover .filter__handle-ico {
	color: var(--rf-accent);
	fill: var(--rf-accent);
}

/* ---------- Внутренний контейнер ---------- */

.filter .filter__inner {
	margin-top: 14px;
	animation: rfFadeIn 0.18s ease-out;
}

@keyframes rfFadeIn {
	from { opacity: 0; transform: translateY(-3px); }
	to   { opacity: 1; transform: translateY(0);    }
}

.filter .filter__inner--scroll {
	max-height: 220px;
	overflow-y: auto;
	padding-right: 6px;
	scrollbar-width: thin;
	scrollbar-color: var(--rf-accent-soft) transparent;
}

.filter .filter__inner--scroll::-webkit-scrollbar {
	width: 6px;
}
.filter .filter__inner--scroll::-webkit-scrollbar-track {
	background: transparent;
}
.filter .filter__inner--scroll::-webkit-scrollbar-thumb {
	background: var(--rf-accent-soft);
	border-radius: 6px;
}
.filter .filter__inner--scroll::-webkit-scrollbar-thumb:hover {
	background: var(--rf-accent);
}

/* ---------- Список значений ---------- */

.filter .filter__properties-list {
	margin: 0;
	padding: 0;
	list-style: none;
}

.filter .filter__properties-item:not(:last-child) {
	margin-bottom: 2px;
}

.filter .filter__checkgroup-inner {
	margin-left: 0;
	margin-top: 0;
	margin-bottom: 0;
}

/* ---------- Один пункт (чекбокс + название + счётчик) ---------- */

.filter .filter__checkgroup {
	display: flex;
	align-items: center;
	width: 100%;
	padding: 6px 8px;
	border-radius: var(--rf-radius-sm);
	transition: background-color 0.15s ease;
}

.filter .filter__checkgroup:hover {
	background-color: var(--rf-bg-soft);
}

.filter .filter__properties-item--active .filter__checkgroup {
	background-color: rgba(237, 138, 158, 0.08);
}

.filter .filter__checkgroup-body {
	flex: 1 1 auto;
	min-width: 0;
}

.filter .filter__checkgroup-aside {
	flex: 0 0 auto;
	margin-left: 8px;
}

.filter .filter__checkgroup-link {
	display: flex;
	align-items: center;
	gap: 10px;
	text-decoration: none;
	cursor: pointer;
}

/* Скрываем нативный чекбокс */
.filter .filter__checkgroup-control {
	position: absolute !important;
	opacity: 0 !important;
	pointer-events: none !important;
	width: 0 !important;
	height: 0 !important;
}

/* Кастомный квадратик-чекбокс (label.filter__checkgroup-check) */
.filter .filter__checkgroup-check,
.filter--style-premmerce .filter__checkgroup-check {
	display: inline-block !important;
	flex: 0 0 auto;
	width: 18px !important;
	height: 18px !important;
	margin: 0 !important;
	padding: 0;
	background: #fff;
	border: 1.5px solid var(--rf-border-strong);
	border-radius: 4px;
	box-shadow: none !important;
	position: relative;
	cursor: pointer;
	transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
	top: 0;
}

/* Внутренняя точка/галочка */
.filter .filter__checkgroup-check::before {
	content: '' !important;
	position: absolute;
	top: 50%;
	left: 50%;
	width: 10px;
	height: 10px;
	background: transparent !important;
	border-radius: 2px;
	opacity: 0;
	transform: translate(-50%, -50%) scale(0.6);
	transition: opacity 0.15s ease, transform 0.15s ease;
}

/* Состояние «отмечен» */
.filter .filter__checkgroup-control:checked + .filter__checkgroup-check {
	background: var(--rf-accent) !important;
	border-color: var(--rf-accent) !important;
}

.filter .filter__checkgroup-control:checked + .filter__checkgroup-check::before {
	opacity: 1;
	background: #fff !important;
	transform: translate(-50%, -50%) scale(1);
	width: 5px;
	height: 9px;
	background: transparent !important;
	border: solid #fff;
	border-width: 0 2px 2px 0;
	border-radius: 0;
	transform: translate(-50%, -60%) rotate(45deg);
}

/* Hover — мягкое розовое свечение */
.filter .filter__checkgroup-link:hover .filter__checkgroup-check {
	border-color: var(--rf-accent);
	box-shadow: 0 0 0 4px var(--rf-accent-shadow);
}

/* Disabled (count = 0) */
.filter .filter__checkgroup-control[disabled] + .filter__checkgroup-check {
	opacity: 0.45;
	cursor: not-allowed;
}
.filter .filter__checkgroup-title.disabled,
.filter .filter__checkgroup-control[disabled] ~ .filter__checkgroup-title {
	color: var(--rf-text-muted);
	cursor: not-allowed;
	text-decoration: line-through;
	text-decoration-color: var(--rf-border-strong);
}

/* ---------- Текст значения ---------- */

.filter .filter__checkgroup-title {
	margin: 0;
	padding: 0;
	font-size: 14px;
	line-height: 1.4;
	color: var(--rf-text);
	cursor: pointer;
	font-weight: 400;
	text-transform: none;
	letter-spacing: 0;
}

.filter .filter__properties-item--active .filter__checkgroup-title {
	color: var(--rf-accent);
	font-weight: 600;
}

/* ---------- Счётчик (7) ---------- */

.filter .filter__checkgroup-count {
	font-size: 12px;
	color: var(--rf-text-muted);
	background: var(--rf-bg-soft);
	padding: 2px 7px;
	border-radius: 999px;
	min-width: 20px;
	text-align: center;
	display: inline-block;
	top: 0;
}

.filter .filter__checkgroup-count::before,
.filter .filter__checkgroup-count::after {
	content: '' !important;
	display: none !important;
}

.filter .filter__properties-item--active .filter__checkgroup-count {
	background: var(--rf-accent);
	color: #fff;
}

/* ---------- Слайдер цены ---------- */

/* Поля min/max — пилюли в духе сайта */
.filter .filter__price-control,
.filter .filter__slider-control {
	width: 100% !important;
	border: 1px solid var(--rf-border-strong) !important;
	border-radius: 999px !important;
	padding: 8px 14px !important;
	font-size: 13px !important;
	background: #fff !important;
	color: var(--rf-text) !important;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
	box-shadow: none !important;
	height: auto !important;
}

.filter .filter__price-control:focus,
.filter .filter__slider-control:focus {
	border-color: var(--rf-accent) !important;
	box-shadow: 0 0 0 3px var(--rf-accent-shadow) !important;
	outline: 0 !important;
}

/* Обёртка полей min/max — задаём расстояние до слайдера ниже */
.filter .filter__price-control-group,
.filter .filter__slider-control-group {
	margin-bottom: 22px !important;
}

/* Контейнер слайдера — увеличиваем высоту и снимаем overflow,
   чтобы круглые ручки не обрезались */
.filter .pc-range-slider__wrapper {
	height: 28px !important;
	overflow: visible !important;
	margin: 8px 6px 4px;
	padding: 0;
	position: relative;
}

/* Сам трек */
.filter .pc-range-slider__control,
.filter .ui-slider {
	background: var(--rf-border) !important;
	border: 0 !important;
	height: 4px !important;
	border-radius: 4px !important;
	position: relative;
	margin-top: 12px !important;
}

/* Закрашенный диапазон между ручками */
.filter .pc-range-slider__control .ui-slider-range,
.filter .ui-slider-range {
	background: var(--rf-accent) !important;
	height: 4px !important;
	margin-top: 0 !important;
	top: 0 !important;
	border-radius: 4px !important;
}

/* Ручки */
.filter .pc-range-slider__control .ui-slider-handle,
.filter .ui-slider-handle {
	width: 18px !important;
	height: 18px !important;
	background: #fff !important;
	border: 2px solid var(--rf-accent) !important;
	border-radius: 50% !important;
	top: 50% !important;
	margin-top: -9px !important;
	margin-left: -9px !important;
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
	cursor: grab;
	transition: transform 0.15s ease, box-shadow 0.15s ease;
	z-index: 2;
}

/* Premmerce задаёт у второй ручки margin-left: -8px !important; — перебиваем */
.filter .pc-range-slider__control .ui-slider-handle:last-of-type,
.filter .ui-slider-handle:last-of-type {
	margin-left: -9px !important;
}

.filter .pc-range-slider__control .ui-slider-handle:hover,
.filter .ui-slider-handle:hover,
.filter .pc-range-slider__control .ui-slider-handle:active,
.filter .ui-slider-handle:active {
	transform: scale(1.1);
	box-shadow: 0 0 0 6px var(--rf-accent-shadow);
}

/* ---------- Активные фильтры (чипы) ---------- */

.pc-active-filter {
	margin-bottom: 16px;
}

.pc-active-filter__list {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	padding: 0;
	margin: 0;
	list-style: none;
}

.pc-active-filter__list-item {
	margin: 0 !important;
}

.pc-active-filter__item-link {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 5px 12px;
	background: var(--rf-accent);
	color: #fff !important;
	border-radius: 999px;
	font-size: 12px;
	font-weight: 500;
	text-decoration: none !important;
	line-height: 1.4;
	transition: background-color 0.15s ease;
}

.pc-active-filter__item-link:hover {
	background: #d97286;
	text-decoration: none !important;
}

.pc-active-filter__item-delete {
	width: 14px !important;
	height: 14px !important;
	border: 0 !important;
	color: #fff !important;
	font-size: 12px !important;
	line-height: 14px !important;
	float: none !important;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background: rgba(255, 255, 255, 0.2);
	border-radius: 50%;
	font-weight: 600;
}

/* ---------- Лейблы (кнопки) ---------- */

.filter .filter__label-button {
	border: 1px solid var(--rf-border-strong) !important;
	border-radius: 999px !important;
	padding: 6px 14px !important;
	background: #fff !important;
	font-size: 12px !important;
	font-weight: 500 !important;
	color: var(--rf-text) !important;
	transition: all 0.15s ease;
}

.filter .filter__checkgroup-control:checked + .filter__label-button {
	background: var(--rf-accent) !important;
	color: #fff !important;
	border-color: var(--rf-accent) !important;
}

.filter .filter__checkgroup-control:not([disabled]):not(:checked) + .filter__label-button:hover {
	border-color: var(--rf-accent) !important;
	color: var(--rf-accent) !important;
	background: #fff !important;
}

/* ---------- Кнопка «Применить фильтр» (если включена) ---------- */

.filter .button-filter-submit {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	padding: 10px 18px;
	margin-top: 10px;
	background: var(--rf-accent);
	color: #fff;
	border: 0;
	border-radius: 999px;
	font-size: 13px;
	font-weight: 600;
	letter-spacing: 0.03em;
	cursor: pointer;
	transition: background-color 0.15s ease, transform 0.05s ease;
}

.filter .button-filter-submit:hover {
	background: #d97286;
}
.filter .button-filter-submit:active {
	transform: translateY(1px);
}

/* ---------- Лоадер при AJAX ---------- */

.premmerce-filter-loader-wrapper {
	background-color: rgba(255, 255, 255, 0.55) !important;
	backdrop-filter: blur(2px);
}
.premmerce-filter-loader-wrapper::after {
	border: 4px solid var(--rf-border) !important;
	border-top: 4px solid var(--rf-accent) !important;
	width: 36px !important;
	height: 36px !important;
}

/* ---------- Адаптив ---------- */

@media (max-width: 1024px) {
	.filter .filter__title { font-size: 13px; }
	.filter .filter__checkgroup-title { font-size: 13px; }
}

@media (max-width: 768px) {
	.filter .filter__inner--scroll {
		max-height: 260px;
	}
	.filter .filter__checkgroup {
		padding: 8px 8px;
	}
}
