/* BetaDarou — category listing. Same design language as the product page:
   white cards, indigo for information, pink-red only for buying, amber for warnings.
   Everything is scoped to body.bdl-page so other pages are untouched. */

body.bdl-page {
	--bd-indigo: #4e4ee5;
	--bd-indigo-50: #eeeefd;
	--bd-mint: #00f2a1;
	--bd-navy: #39397c;
	--bd-ink: #15153a;
	--bd-bg: #f4f5fb;
	--bd-text: #1c1c40;
	--bd-muted: #6a6a92;
	--bd-line: #e4e5f2;
	--bd-cta: #e6005a;
	--bd-cta-hover: #c8004e;
	--bd-warn-bg: #fff7e6;
	--bd-warn-line: #fcd9a0;
	--bd-warn-text: #9a4a00;
	--bd-r: 18px;
	--bd-shadow: 0 10px 30px -14px rgba(57, 57, 124, .28);
}

/* ---------- filter row ---------- */
body.bdl-page .bdl-bar {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 8px;
	margin: 0 0 18px;
	padding: 12px;
	background: #fff;
	border: 1px solid var(--bd-line);
	border-radius: var(--bd-r);
	box-shadow: var(--bd-shadow);
}
body.bdl-page .bdl-bar__fields { display: contents; }
body.bdl-page .bdl-sheet-open,
body.bdl-page .bdl-sheet__head,
body.bdl-page .bdl-sheet__foot { display: none; }

body.bdl-page .bdl-sel { position: relative; display: inline-flex; }
body.bdl-page .bdl-sel__label {
	position: absolute;
	top: -8px;
	inset-inline-start: 10px;
	background: #fff;
	padding: 0 6px;
	font-size: 11px;
	font-weight: 800;
	color: var(--bd-muted);
}
body.bdl-page .bdl-sel select {
	appearance: none;
	border: 1px solid var(--bd-line);
	background: #f7f8fc;
	border-radius: 12px;
	padding: 11px 14px;
	font: inherit;
	font-size: 13px;
	font-weight: 700;
	color: var(--bd-text);
	cursor: pointer;
	min-width: 150px;
	max-width: 220px;
}
body.bdl-page .bdl-sel select:focus-visible { outline: 2px solid var(--bd-indigo); outline-offset: 1px; }

body.bdl-page .bdl-toggle {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 10px 14px;
	border-radius: 12px;
	background: #f7f8fc;
	border: 1px solid var(--bd-line);
	font-size: 13px;
	font-weight: 800;
	color: var(--bd-text);
	text-decoration: none !important;
}
body.bdl-page .bdl-toggle__box {
	width: 34px;
	height: 20px;
	border-radius: 999px;
	background: #d8d8e6;
	position: relative;
	transition: background .15s;
	flex: none;
}
body.bdl-page .bdl-toggle__box::after {
	content: "";
	position: absolute;
	top: 3px;
	inset-inline-start: 3px;
	width: 14px;
	height: 14px;
	border-radius: 50%;
	background: #fff;
	transition: transform .15s;
}
body.bdl-page .bdl-toggle.is-on { background: var(--bd-indigo-50); border-color: #c9c9f7; color: var(--bd-indigo); }
body.bdl-page .bdl-toggle.is-on .bdl-toggle__box { background: var(--bd-indigo); }
body.bdl-page .bdl-toggle.is-on .bdl-toggle__box::after { transform: translateX(-14px); }
html[dir="ltr"] body.bdl-page .bdl-toggle.is-on .bdl-toggle__box::after { transform: translateX(14px); }

body.bdl-page .bdl-clear { font-size: 12.5px; font-weight: 800; color: var(--bd-cta); text-decoration: none !important; padding: 0 6px; }
body.bdl-page .bdl-count { margin-inline-start: auto; font-size: 13px; font-weight: 800; color: var(--bd-muted); }

/* ---------- card ---------- */
body.bdl-page .bdl-card {
	display: flex;
	flex-direction: column;
	height: 100%;
	background: #fff;
	border: 1px solid var(--bd-line);
	border-radius: var(--bd-r);
	overflow: hidden;
	transition: box-shadow .15s, transform .15s;
	padding: 0 !important;
	margin: 0 !important;
}
body.bdl-page .bdl-card:hover { box-shadow: var(--bd-shadow); transform: translateY(-2px); }
body.bdl-page .bdl-card__img { position: relative; display: block; aspect-ratio: 1 / 1; background: #fbfbfe; }
body.bdl-page .bdl-card__img img { width: 100%; height: 100%; object-fit: contain; padding: 10px; }
body.bdl-page .bdl-badge {
	position: absolute;
	top: 10px;
	inset-inline-start: 10px;
	border-radius: 999px;
	padding: 4px 10px;
	font-size: 11.5px;
	font-weight: 900;
	z-index: 2;
}
body.bdl-page .bdl-badge--sale { background: var(--bd-cta); color: #fff; }
body.bdl-page .bdl-badge--new { background: var(--bd-indigo); color: #fff; }
body.bdl-page .bdl-badge--oos { background: var(--bd-warn-bg); border: 1px solid var(--bd-warn-line); color: var(--bd-warn-text); }
/* «پرفروش» / «جدید» sit on the other side, so they never cover the discount. */
body.bdl-page .bdl-badge--best,
body.bdl-page .bdl-badge--new { inset-inline-start: auto; inset-inline-end: 10px; }
body.bdl-page .bdl-badge--best { background: var(--bd-ink); color: #fff; }
body.bdl-page .bdl-badge--new { background: #d8fff1; color: #06603f; border: 1px solid #9cf0cf; }

body.bdl-page .bdl-card__body { display: flex; flex-direction: column; gap: 6px; padding: 12px 14px 14px; flex: 1; }
body.bdl-page .bdl-card__brand { font-size: 11.5px; font-weight: 800; color: var(--bd-indigo); }
body.bdl-page .bdl-card__title { margin: 0; font-size: 14px; font-weight: 800; line-height: 1.75; }
body.bdl-page .bdl-card__title a {
	color: var(--bd-text) !important;
	text-decoration: none !important;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}
body.bdl-page .bdl-card__meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--bd-muted); }
body.bdl-page .bdl-chip { background: #f2f3f9; border-radius: 999px; padding: 3px 9px; font-weight: 700; }
body.bdl-page .bdl-card__price { margin-top: auto; display: flex; flex-direction: column; gap: 3px; padding-top: 6px; }
body.bdl-page .bdl-card__price .price,
body.bdl-page .bdl-card__price .bdl-price {
	display: block;
	font-size: 16px;
	font-weight: 900;
	color: var(--bd-navy);
	margin: 0;
	line-height: 1.9;
	white-space: nowrap;
}
body.bdl-page .bdl-card__price .bdl-price bdi { font-weight: 900; }
/* A range («۵۱۵,۰۰۰ تا ۲,۴۱۰,۰۰۰ تومان») stays on one line and shrinks to fit. */
body.bdl-page .bdl-card__price .bdl-price--range { font-size: 13.5px; }
body.bdl-page .bdl-card__price .bdl-price--range bdi { font-size: 14.5px; }
body.bdl-page .bdl-card__price del { font-size: 12px; color: #9a9ab5; font-weight: 600; }
body.bdl-page .bdl-card__price ins { text-decoration: none; }
/*
 * A struck original next to the sale price does not fit one nowrap line in a two-column
 * phone grid, so a discounted card stacks: «was» on its own line, then the price.
 */
body.bdl-page .bdl-card__price .bdl-price--sale { white-space: normal; line-height: 1.5; }
body.bdl-page .bdl-card__price .bdl-price--sale del { display: block; line-height: 1.7; }
body.bdl-page .bdl-card__price .bdl-price--sale ins { display: block; white-space: nowrap; }
body.bdl-page .bdl-low {
	align-self: flex-start;
	font-size: 11.5px;
	font-weight: 800;
	color: var(--bd-warn-text);
	background: var(--bd-warn-bg);
	border: 1px solid var(--bd-warn-line);
	border-radius: 8px;
	padding: 2px 8px;
}
body.bdl-page .bdl-oos-text { font-size: 13px; font-weight: 800; color: var(--bd-warn-text); }

body.bdl-page .bdl-cta {
	display: block;
	margin-top: 10px;
	padding: 11px 12px;
	border-radius: 12px;
	background: var(--bd-cta);
	color: #fff !important;
	font-size: 13.5px;
	font-weight: 900;
	text-align: center;
	text-decoration: none !important;
	border: 0;
	cursor: pointer;
}
body.bdl-page .bdl-cta:hover { background: var(--bd-cta-hover); }
body.bdl-page .bdl-cta--ghost { background: #f2f3f9; color: var(--bd-indigo) !important; }
body.bdl-page .bdl-cta--ghost:hover { background: var(--bd-indigo-50); }
body.bdl-page .bdl-cta.loading { opacity: .6; }
body.bdl-page .bdl-cta.added::after { content: " ✓"; }
body.bdl-page .bdl-card--oos .bdl-card__img img { filter: grayscale(1); opacity: .6; }
body.bdl-page a.added_to_cart { display: block; text-align: center; font-size: 12.5px; font-weight: 800; margin-top: 6px; color: var(--bd-indigo) !important; }
body.bdl-page .bdl-btn {
	background: var(--bd-indigo) !important; /* the theme styles buttons too */
	color: #fff !important;
	border: 0;
	border-radius: 14px;
	padding: 13px 28px;
	font: inherit;
	font-size: 14px;
	font-weight: 900;
	cursor: pointer;
}
body.bdl-page .bdl-btn:hover { background: var(--bd-ink) !important; }

/* ---------- phones: one filter button that opens a sheet ---------- */
@media (max-width: 767px) {
	body.bdl-page .bdl-bar { padding: 10px; gap: 6px; }
	body.bdl-page .bdl-sheet-open {
		display: inline-flex !important;
		align-items: center;
		gap: 6px;
		background: var(--bd-indigo-50);
		color: var(--bd-indigo);
		border: 1px solid #c9c9f7;
		border-radius: 12px;
		padding: 10px 16px;
		font: inherit;
		font-size: 13px;
		font-weight: 900;
		cursor: pointer;
	}
	body.bdl-page .bdl-bar__fields {
		display: flex;
		flex-direction: column;
		gap: 12px;
		position: fixed;
		inset-inline: 0;
		bottom: 0;
		z-index: 9999;
		background: #fff;
		border-radius: 22px 22px 0 0;
		padding: 16px 16px 20px;
		box-shadow: 0 -18px 40px -20px rgba(21, 21, 58, .5);
		transform: translateY(100%);
		transition: transform .2s ease;
		max-height: 82vh;
		overflow: auto;
	}
	body.bdl-page.bdl-sheet-on .bdl-bar__fields { transform: translateY(0); }
	body.bdl-page .bdl-sheet__head { display: flex; align-items: center; justify-content: space-between; font-size: 15px; font-weight: 900; }
	body.bdl-page .bdl-sheet__foot { display: block; }
	body.bdl-page .bdl-sheet__foot .bdl-btn { width: 100%; }
	body.bdl-page .bdl-sheet-close { background: none; border: 0; font-size: 18px; cursor: pointer; color: var(--bd-muted); }
	body.bdl-page .bdl-sel, body.bdl-page .bdl-sel select, body.bdl-page .bdl-toggle { width: 100%; max-width: none; }
	/* Sorting stays out of the sheet: its own control next to «فیلترها». */
	body.bdl-page .bdl-sel--sort { display: inline-flex !important; width: auto; flex: 1; }
	body.bdl-page .bdl-sel--sort select { width: 100%; min-width: 0; padding: 10px 12px; }
	body.bdl-page .bdl-count { flex: 1 1 100%; text-align: center; margin: 4px 0 0; }
	body.bdl-page .bdl-sheet__backdrop { position: fixed; inset: 0; background: rgba(21, 21, 58, .45); z-index: 9998; }
	body.bdl-page .bdl-card__body { padding: 10px 11px 12px; gap: 5px; }
	body.bdl-page .bdl-card__title { font-size: 13px; }
	body.bdl-page .bdl-card__price .price,
	body.bdl-page .bdl-card__price .bdl-price { font-size: 15px; }
	body.bdl-page .bdl-card__price .bdl-price--range { font-size: 12.5px; }
	body.bdl-page .bdl-card__price .bdl-price--range bdi { font-size: 13.5px; }
	body.bdl-page .bdl-cta { padding: 10px 8px; font-size: 12.5px; }
	body.bdl-page .bdl-count { font-size: 12px; }
}

/* ---------- price bar (sits in the filter row) ---------- */
body.bdl-page .bdl-range { position: relative; display: inline-flex; }
body.bdl-page .bdl-range__box {
	display: flex;
	flex-direction: column;
	justify-content: center;
	gap: 5px;
	width: 270px;
	height: 56px;
	padding: 0 18px;
	border: 1px solid var(--bd-line);
	border-radius: 12px;
	background: #f7f8fc;
}
body.bdl-page .bdl-range.is-on .bdl-range__box { border-color: var(--bd-indigo); background: #f2f2fe; }
/* the two amounts sit under the ends of the track, so they read as the handles' values */
body.bdl-page .bdl-range__values {
	display: flex;
	justify-content: space-between;
	font-size: 12px;
	font-weight: 600;
	color: var(--bd-muted);
	white-space: nowrap;
	line-height: 1;
}
body.bdl-page .bdl-range__values b { font-weight: 800; color: var(--bd-text); }
body.bdl-page .bdl-range__track { position: relative; height: 16px; margin: 0 8px; }
body.bdl-page .bdl-range__line {
	position: absolute;
	inset-inline: 0;
	top: 6px;
	height: 4px;
	border-radius: 4px;
	background: #dcddee;
}
body.bdl-page .bdl-range__fill { position: absolute; top: 0; height: 100%; border-radius: 4px; background: var(--bd-indigo); }
body.bdl-page .bdl-range input[type="range"] {
	position: absolute;
	inset-inline: 0;
	top: 0;
	width: 100%;
	margin: 0;
	height: 16px;
	background: none;
	appearance: none;
	pointer-events: none;
}
/* the theme styles native range inputs; without this its own grey track shows
   through underneath ours and reads as a shadow behind the bar */
body.bdl-page .bdl-range input[type="range"]::-webkit-slider-runnable-track {
	appearance: none;
	background: transparent;
	border: 0;
	box-shadow: none;
	height: 16px;
}
body.bdl-page .bdl-range input[type="range"]::-moz-range-track {
	background: transparent;
	border: 0;
	box-shadow: none;
	height: 16px;
}
body.bdl-page .bdl-range input[type="range"]::-moz-range-progress { background: transparent; }
body.bdl-page .bdl-range input[type="range"]::-webkit-slider-thumb {
	appearance: none;
	pointer-events: auto;
	/* content-box would add the 3px border on top of 16px and push the handle above the line */
	box-sizing: border-box;
	margin-top: 0;
	width: 16px;
	height: 16px;
	border-radius: 50%;
	background: #fff;
	border: 3px solid var(--bd-indigo);
	cursor: grab;
}
body.bdl-page .bdl-range input[type="range"]::-moz-range-thumb {
	pointer-events: auto;
	box-sizing: border-box;
	width: 16px;
	height: 16px;
	border-radius: 50%;
	background: #fff;
	border: 3px solid var(--bd-indigo);
	cursor: grab;
}
body.bdl-page .bdl-range input[type="range"]:focus-visible::-webkit-slider-thumb { outline: 2px solid var(--bd-indigo); outline-offset: 2px; }
@media (max-width: 767px) {
	body.bdl-page .bdl-range { width: 100%; }
	body.bdl-page .bdl-range__box { width: 100%; height: 62px; gap: 8px; }
	body.bdl-page .bdl-range__values { font-size: 12.5px; }
	body.bdl-page .bdl-range__track { height: 20px; margin: 0 8px; }
	body.bdl-page .bdl-range__line { top: 8px; }
	body.bdl-page .bdl-range input[type="range"] { height: 20px; }
	body.bdl-page .bdl-range input[type="range"]::-webkit-slider-runnable-track { height: 20px; }
	body.bdl-page .bdl-range input[type="range"]::-moz-range-track { height: 20px; }
	body.bdl-page .bdl-range input[type="range"]::-webkit-slider-thumb { width: 20px; height: 20px; }
	body.bdl-page .bdl-range input[type="range"]::-moz-range-thumb { width: 20px; height: 20px; }
}

/* ---------- category description: «ادامه مطلب» (1.6.5) ----------
 * Same control as the product page: the text is cut at a fixed height, fades out, and a centred
 * pill opens it. The fade is a mask on the text itself rather than a white layer on top, so it
 * does not depend on the page background and cannot be broken by a theme ::after rule. */
body.bdl-page { --bd-desc-clamp: 360px; }
body.bdl-page .desc-tax-beta.bdl-desc-clamp {
	max-height: var(--bd-desc-clamp, 360px);
	overflow: hidden;
	-webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 150px), rgba(0, 0, 0, .12) calc(100% - 50px), transparent 100%);
	mask-image: linear-gradient(to bottom, #000 calc(100% - 150px), rgba(0, 0, 0, .12) calc(100% - 50px), transparent 100%);
}
/* The button carries the gap below the text; the theme's «my-4» margin (with !important) is dropped. */
body.bdl-page .desc-tax-beta.bdl-desc-has-more { margin-bottom: 0 !important; }
body.bdl-page .bdl-desc-more {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	width: auto;
	min-height: 44px;
	margin: 14px auto 32px;
	padding: 0 22px;
	border-radius: 999px;
	border: 1px solid var(--bd-indigo);
	background: #fff;
	color: var(--bd-indigo);
	font: inherit;
	font-weight: 800;
	line-height: 1.4;
	cursor: pointer;
	box-shadow: none;
	transition: background .15s, color .15s;
}
body.bdl-page .bdl-desc-more::after {
	content: "";
	width: 8px;
	height: 8px;
	border-right: 2px solid currentColor;
	border-bottom: 2px solid currentColor;
	transform: translateY(-2px) rotate(45deg);
}
body.bdl-page .bdl-desc-more[aria-expanded="true"]::after { transform: translateY(2px) rotate(-135deg); }
/* After a tap the button keeps focus; without this line the theme's own button:focus colours fill it in
 * and «بستن» looks like a different control from «ادامه مطلب». Filled is for a real pointer hover only. */
body.bdl-page .bdl-desc-more:focus { background: #fff; color: var(--bd-indigo); border-color: var(--bd-indigo); }
@media (hover: hover) {
	body.bdl-page .bdl-desc-more:hover { background: var(--bd-indigo); color: #fff; border-color: var(--bd-indigo); }
}
body.bdl-page .bdl-desc-more:focus-visible { outline: 2px solid var(--bd-indigo); outline-offset: 2px; }
@media (max-width: 767px) {
	body.bdl-page { --bd-desc-clamp: 300px; }
	body.bdl-page .bdl-desc-more { margin: 12px auto 24px; }
}
@media print {
	body.bdl-page .desc-tax-beta.bdl-desc-clamp { max-height: none; overflow: visible; -webkit-mask-image: none; mask-image: none; }
	body.bdl-page .bdl-desc-more { display: none; }
}
