/* فیلتر کناری فروشگاه — استایل */

/*
 * هوک `woocommerce_before_main_content` در قالب Hello **بیرون** از
 * `<main class="site-main">` اجرا می‌شود، پس این کانتینر دور خود main
 * می‌پیچد نه داخلش. دو پیامد داشت که هر دو اینجا جبران می‌شوند:
 *
 * ۱) کانتینر تمام‌عرض می‌شد و ستون فیلتر به لبهٔ صفحه می‌چسبید.
 * ۲) `main.site-main` سقف ۱۱۴۰ پیکسلی دارد؛ داخل ستون ۱۶۰۰ پیکسلی وسط
 *    می‌نشست و کنارش صدها پیکسل فضای مرده می‌ماند.
 *
 * عرض ۱۴۴۰ عمدی است: از عرض متنی سایت (۱۱۴۰) بیشتر، چون این صفحه یک ستون
 * کناری هم دارد و با ۱۱۴۰ فقط سه کارت در ردیف جا می‌شد.
 */
.dnk-flt-layout {
	display: grid;
	grid-template-columns: 260px minmax(0, 1fr);
	gap: 28px;
	align-items: start;
	box-sizing: border-box;
	max-inline-size: 1440px;
	margin-inline: auto;
	padding-inline: 20px;
}

.dnk-flt-main .content-area,
.dnk-flt-main main.site-main {
	max-inline-size: none;
	inline-size: 100%;
	margin-inline: 0;
}

.dnk-flt-main {
	min-width: 0;
}

.dnk-flt {
	position: sticky;
	top: 20px;
	border: 1px solid #ebebeb;
	border-radius: 12px;
	background-color: #fff;
	padding: 16px;
	font-size: 14px;
}

/* ---- سربرگ ---- */

.dnk-flt-head {
	display: flex;
	align-items: center;
	gap: 8px;
	padding-block-end: 12px;
	border-block-end: 1px solid #ebebeb;
	cursor: pointer;
	list-style: none;
	user-select: none;
}

.dnk-flt-head::-webkit-details-marker {
	display: none;
}

.dnk-flt-caret--shell {
	margin-inline-start: auto;
}

.dnk-flt-shell[open] .dnk-flt-caret--shell {
	transform: rotate(180deg);
}

.dnk-flt-clear {
	display: inline-block;
	margin-block-start: 12px;
}

.dnk-flt-heading {
	margin: 0;
	font-size: 16px;
	font-weight: 700;
}

.dnk-flt-clear {
	font-size: 12.5px;
	color: #e31e24;
	text-decoration: none;
}

.dnk-flt-clear:hover {
	text-decoration: underline;
}

/* ---- چیپ فیلترهای فعال ---- */

.dnk-flt-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	padding-block: 12px;
	border-block-end: 1px solid #ebebeb;
}

.dnk-flt-chip {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	max-inline-size: 100%;
	padding: 3px 10px;
	border: 1px solid #ebebeb;
	border-radius: 20px;
	background-color: #fafafa;
	color: inherit;
	font-size: 12.5px;
	line-height: 1.9;
	text-decoration: none;
	transition: border-color 0.15s ease, color 0.15s ease;
}

.dnk-flt-chip span:first-child {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.dnk-flt-chip svg {
	inline-size: 12px;
	block-size: 12px;
	flex: 0 0 auto;
	opacity: 0.55;
}

.dnk-flt-chip:hover {
	border-color: #e31e24;
	color: #e31e24;
}

.dnk-flt-chip:hover svg {
	opacity: 1;
}

/* ---- گروه ---- */

.dnk-flt-group {
	border-block-end: 1px solid #ebebeb;
}

.dnk-flt-group:last-of-type {
	border-block-end: 0;
}

.dnk-flt-summary {
	display: flex;
	align-items: center;
	gap: 8px;
	padding-block: 13px;
	font-weight: 600;
	cursor: pointer;
	list-style: none;
	user-select: none;
}

.dnk-flt-summary::-webkit-details-marker {
	display: none;
}

.dnk-flt-badge {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-inline-size: 19px;
	block-size: 19px;
	padding-inline: 5px;
	border-radius: 20px;
	background-color: #e31e24;
	color: #fff;
	font-size: 11px;
	font-weight: 700;
	line-height: 1;
}

.dnk-flt-caret {
	inline-size: 16px;
	block-size: 16px;
	margin-inline-start: auto;
	flex: 0 0 auto;
	opacity: 0.5;
	transition: transform 0.2s ease;
}

.dnk-flt-group[open] .dnk-flt-caret {
	transform: rotate(180deg);
}

.dnk-flt-body {
	padding-block-end: 14px;
}

/* ---- جستجوی داخل گروه ---- */

.dnk-flt-search {
	inline-size: 100%;
	box-sizing: border-box;
	margin-block-end: 8px;
	padding: 7px 10px;
	border: 1px solid #ebebeb;
	border-radius: 8px;
	font: inherit;
	font-size: 13px;
	background-color: #fff;
}

.dnk-flt-search:focus {
	outline: none;
	border-color: #e31e24;
}

/* ---- فهرست گزینه‌ها ---- */

.dnk-flt-list {
	--dnk-flt-rows: 8;

	margin: 0;
	padding: 0;
	list-style: none;
	display: flex;
	flex-direction: column;
	gap: 2px;
	overflow-y: auto;
	overscroll-behavior: contain;
}

/*
 * بلندی با تعداد ردیف بسته می‌شود نه با عدد پیکسلی ثابت، تا اگر اندازهٔ
 * قلم عوض شد باز هم دقیقاً همان تعداد ردیف دیده شود.
 */
.dnk-flt-list--capped {
	max-block-size: calc(var(--dnk-flt-rows) * 2.05em);
}

.dnk-flt-list--open {
	max-block-size: 320px;
}

.dnk-flt-row label {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 3px 2px;
	cursor: pointer;
	line-height: 1.9;
	border-radius: 6px;
}

.dnk-flt-row label:hover {
	background-color: #fafafa;
}

.dnk-flt-row input {
	inline-size: 15px;
	block-size: 15px;
	flex: 0 0 auto;
	accent-color: #e31e24;
	margin: 0;
}

.dnk-flt-name {
	flex: 1 1 auto;
	min-inline-size: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	font-size: 13.5px;
}

.dnk-flt-count {
	flex: 0 0 auto;
	color: #8a8a8a;
	font-size: 12px;
	font-variant-numeric: tabular-nums;
}

.dnk-flt-row--hidden {
	display: none;
}

/* ---- دکمه‌ها ---- */

.dnk-flt-more {
	margin-block-start: 8px;
	padding: 0;
	border: 0;
	background: none;
	color: #e31e24;
	font: inherit;
	font-size: 12.5px;
	cursor: pointer;
}

.dnk-flt-more:hover {
	text-decoration: underline;
}

.dnk-flt-submit {
	inline-size: 100%;
	margin-block-start: 12px;
	padding: 10px;
	border: 0;
	border-radius: 8px;
	background-color: #e31e24;
	color: #fff;
	font: inherit;
	font-weight: 700;
	cursor: pointer;
}

.dnk-flt-empty {
	margin: 6px 2px;
	color: #8a8a8a;
	font-size: 12.5px;
}

/* ---- در حال به‌روزرسانی ---- */

.dnk-flt--busy {
	opacity: 0.55;
	pointer-events: none;
}

/* ---- موبایل و تبلت ----
   زیر ۹۹۲px ستون کناری بالای فهرست می‌آید و بسته می‌شود، تا کل صفحه را
   نگیرد. */

@media screen and (min-width: 992px) {
	/* در دسکتاپ پنل همیشه باز است، پس فلش سربرگ اضافه است. */
	.dnk-flt-caret--shell {
		display: none;
	}

	.dnk-flt-head {
		cursor: default;
	}
}

@media screen and (max-width: 991px) {
	.dnk-flt-layout {
		grid-template-columns: minmax(0, 1fr);
		gap: 20px;
	}

	.dnk-flt {
		position: static;
	}

	.dnk-flt-group {
		border-block-end: 1px solid #ebebeb;
	}
}


/* ---- نوار مرتب‌سازی ----------------------------------------------------
   جای دراپ‌داون ووکامرس. تب‌ها لینک ساده‌اند، پس بدون جاوااسکریپت هم کار
   می‌کنند و هر کدام یک آدرس قابل اشتراک‌اند. */

.dnk-sort {
	display: flex;
	align-items: center;
	gap: 14px;
	margin-block-end: 20px;
	padding-block: 10px;
	border-block: 1px solid #ebebeb;
	font-size: 14px;
}

.dnk-sort-label {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	flex: 0 0 auto;
	color: #1d1c1c;
	font-weight: 600;
	white-space: nowrap;
}

.dnk-sort-label svg {
	inline-size: 19px;
	block-size: 19px;
}

/*
 * فهرست تب‌ها در عرض کم به‌جای شکستن، افقی اسکرول می‌شود — همان رفتاری که
 * کاربر موبایل از یک نوار تب انتظار دارد.
 */
.dnk-sort-list {
	display: flex;
	align-items: center;
	gap: 4px;
	margin: 0;
	padding: 0;
	list-style: none;
	overflow-x: auto;
	overscroll-behavior-inline: contain;
	scrollbar-width: none;
	-ms-overflow-style: none;
}

.dnk-sort-list::-webkit-scrollbar {
	display: none;
}

.dnk-sort-list li {
	flex: 0 0 auto;
	margin: 0;
}

.dnk-sort-tab {
	display: block;
	padding: 5px 12px;
	border-radius: 8px;
	color: #4a4342;
	text-decoration: none;
	white-space: nowrap;
	transition: background-color 0.15s ease, color 0.15s ease;
}

.dnk-sort-tab:hover {
	background-color: #fafafa;
	color: #1d1c1c;
}

.dnk-sort-tab--on {
	color: #e31e24;
	font-weight: 700;
}

.dnk-sort-tab--on:hover {
	background-color: transparent;
	color: #e31e24;
}

/* شمارش نتیجه بالای نوار می‌نشیند نه کنارش، چون نوار تب کل عرض را می‌خواهد. */
.woocommerce-result-count {
	display: block;
	float: none;
	margin-block-end: 10px;
	color: #8a8a8a;
	font-size: 13px;
}

@media screen and (max-width: 560px) {
	.dnk-sort {
		gap: 10px;
	}

	.dnk-sort-label {
		font-size: 13px;
	}

	/* در عرض خیلی کم، کلمهٔ «مرتب‌سازی» جا را از تب‌ها می‌گیرد. */
	.dnk-sort-label span,
	.dnk-sort-label {
		font-size: 0;
	}

	.dnk-sort-label svg {
		inline-size: 20px;
		block-size: 20px;
	}
}
