/**
 * Element Press — ویجت AWP Product Price.
 *
 * ظاهر پیش‌فرض همان شورت‌کد [custom_price] است (قیمت قبل از تخفیف بالای قیمت
 * نهایی، خاکستری با خط افقی، آیکون تومان قرمز)، با اندازه‌های تازه: قیمت
 * نهایی ۱۶، قیمت خط‌خورده ۱۲ و آیکون ۱۶ پیکسل.
 *
 * قرارداد نام‌گذاری این افزونه: awp-{widget}-{part}
 */

/* حالت‌های بازدیدشده، فوکوس و کلیک همان ظاهر عادی را دارند (فقط هاور فرق می‌کند). */

/* --------------------------------------------------
   توکن‌ها — اول متغیر قالب، بعد پالت علی‌وب‌پرس
   -------------------------------------------------- */
.awp-price {
	--awp-price-text: var(--dark-text, #2b2d42);
	--awp-price-old-color: #bdc3c7;
	--awp-price-strike-color: #bdc3c7;
	--awp-price-strike-width: 1px;
	--awp-price-strike-angle: 0deg;
	--awp-price-icon-color: var(--red, #e53935);
	--awp-price-icon-size: 16px;
	--awp-price-icon-gap: 3px;
	--awp-price-badge-bg: var(--red, #e53935);
	--awp-price-badge-text: var(--white, #ffffff);
	--awp-price-badge-gap: 6px;
	--awp-price-stock-color: var(--red, var(--error, #e53935));
	--awp-price-gap: 2px;
	--awp-price-align: flex-start;

	display: flex;
	flex-direction: column;
	align-items: var(--awp-price-align);
	margin: 0;
	padding: 0;
	line-height: 1;
}

/* متن فقط برای صفحه‌خوان و موتور جستجو. */
.awp-price-sr,
.awp-price-currency__text {
	position: absolute !important;
	inline-size: 1px !important;
	block-size: 1px !important;
	padding: 0 !important;
	margin: -1px !important;
	overflow: hidden !important;
	clip-path: inset(50%) !important;
	white-space: nowrap !important;
	border: 0 !important;
}

/* --------------------------------------------------
   چیدمان دو قیمت
   -------------------------------------------------- */
.awp-price-stack {
	display: flex;
	flex-direction: column;
	align-items: var(--awp-price-align);
	gap: var(--awp-price-gap);
}

/* کنار هم: قیمت نهایی اول، قیمت خط‌خورده و درصد کنارش. */
.awp-price-layout-inline .awp-price-stack {
	flex-direction: row;
	flex-wrap: wrap;
	align-items: center;
	justify-content: var(--awp-price-align);
	gap: 8px;
}

.awp-price-layout-inline .awp-price-current {
	order: -1;
}

.awp-price.is-out-of-stock .awp-price-stack {
	display: none;
}

/* --------------------------------------------------
   قیمت نهایی
   -------------------------------------------------- */
.awp-price-current {
	display: inline-flex;
	align-items: center;
	gap: 4px;
}

.awp-price-current .woocommerce-Price-amount {
	color: var(--awp-price-text);
	font-size: 16px;
	font-weight: 700;
	line-height: 1;
}

/* عدد و ارز داخل bdi خود ووکامرس: کنار هم و هم‌تراز. */
.awp-price .woocommerce-Price-amount bdi {
	display: inline-flex;
	align-items: center;
	gap: var(--awp-price-icon-gap);
}

/*
 * ووکامرس‌های تازه به نماد ارز dir="auto" می‌دهند. bdi جهتش را از متن خودش می‌گیرد و فرزندِ
 * دارای dir را نادیده می‌گیرد؛ پس فقط عدد می‌ماند (رقم جهت ندارد) و bdi چپ‌به‌راست می‌شد:
 * «تومان» به سمت راست عدد می‌رفت. در صفحه‌ی راست‌به‌چپ جهت صریح است.
 */
:is(.rtl, [dir="rtl"]) .awp-price .woocommerce-Price-amount bdi {
	direction: rtl;
}

.awp-price-label {
	color: #4c4843;
	font-size: 12px;
	font-weight: 500;
	line-height: 1;
}

/* --------------------------------------------------
   قیمت قبل از تخفیف + درصد
   ردیف چپ‌به‌راست است تا «سمت چپ / راست» در صفحه‌ی فارسی و انگلیسی
   یک معنا داشته باشد. عدد و ارز داخل bdi ووکامرس ایزوله‌اند، پس جهت
   خودشان را نگه می‌دارند.
   -------------------------------------------------- */
.awp-price-old-row {
	display: inline-flex;
	align-items: center;
	gap: var(--awp-price-badge-gap);
	direction: ltr;
}

.awp-price-old-row[hidden] {
	display: none;
}

/* جای درصد: پیش‌فرض سمت چپ قیمت. */
.awp-price-badge-side-left .awp-price-old-row {
	flex-direction: row-reverse;
}

.awp-price-badge-side-right .awp-price-old-row {
	flex-direction: row;
}

.awp-price-old {
	position: relative;
	color: var(--awp-price-old-color);
	font-size: 12px;
	font-weight: 400;
	line-height: 1;
	text-decoration: none;
}

.awp-price-old .woocommerce-Price-amount {
	color: inherit;
	font: inherit;
}

/* خط روی قیمت، به‌جای text-decoration تا رنگ، ضخامت و زاویه‌اش جدا تنظیم شود. */
.awp-price-old::after {
	content: "";
	position: absolute;
	inset-inline: 0;
	top: 50%;
	block-size: var(--awp-price-strike-width);
	border-radius: 1px;
	background: var(--awp-price-strike-color);
	transform: translateY(-50%) rotate(var(--awp-price-strike-angle));
	pointer-events: none;
}

.awp-price-badge {
	display: inline-flex;
	align-items: center;
	padding: 2px 6px;
	border-radius: 999px;
	background: var(--awp-price-badge-bg);
	color: var(--awp-price-badge-text);
	font-size: 11px;
	font-weight: 700;
	line-height: 1.5;
	white-space: nowrap;
}

/* کلید «نمایش درصد تخفیف» (کلاس روی پوشش ویجت). */
.elementor-widget-awp-ep-product-price:not(.awp-price-badge-yes) .awp-price-badge {
	display: none;
}

/* --------------------------------------------------
   آیکون ارز
   -------------------------------------------------- */
.awp-price-currency__icon {
	display: inline-flex;
	align-items: center;
	color: var(--awp-price-icon-color);
	font-size: var(--awp-price-icon-size);
	line-height: 1;
}

.awp-price-currency__icon svg {
	inline-size: var(--awp-price-icon-size);
	block-size: var(--awp-price-icon-size);
	fill: currentColor;
}

/*
 * نماد پیش‌فرض «تومان».
 * شکل نماد همین‌جاست (یک‌بار، در فایلی که مرورگر کش می‌کند) و با mask روی یک span
 * خالی می‌نشیند؛ رنگش همان رنگ آیکون (currentColor) و اندازه‌اش همان
 * --awp-price-icon-size است. پیش‌تر مسیر SVG برای هر قیمت در خود HTML تکرار می‌شد.
 */
.awp-price-currency__icon.is-toman::before {
	content: "";
	display: block;
	inline-size: var(--awp-price-icon-size);
	block-size: var(--awp-price-icon-size);
	background-color: currentColor;
	-webkit-mask: var(--awp-price-toman) center / contain no-repeat;
	mask: var(--awp-price-toman) center / contain no-repeat;
	-webkit-print-color-adjust: exact;
	print-color-adjust: exact;
}

.awp-price,
.awp-price-currency__icon.is-toman {
	--awp-price-toman: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 22 23'%3E%3Cpath d='M6.79148 6.08995C6.83815 6.08995 6.87082 6.13195 6.88948 6.21595C6.91748 6.29061 6.93148 6.45395 6.93148 6.70595C6.93148 6.94861 6.91748 7.10728 6.88948 7.18195C6.87082 7.25661 6.83815 7.29395 6.79148 7.29395H5.44748C5.36348 8.35795 4.99948 9.19328 4.35548 9.79995C3.71148 10.4066 2.87148 10.7099 1.83548 10.7099H0.113484L0.00148438 9.50595H1.84948C2.59615 9.50595 3.18882 9.30528 3.62748 8.90395C4.07548 8.51195 4.30415 7.97528 4.31348 7.29395H2.91348C1.95215 7.29395 1.25682 7.09795 0.827484 6.70595C0.407484 6.30461 0.197484 5.68395 0.197484 4.84395C0.197484 4.26528 0.309484 3.75195 0.533484 3.30394C0.757484 2.84661 1.07015 2.49661 1.47148 2.25395C1.88215 2.00195 2.34415 1.87594 2.85748 1.87594C3.66948 1.87594 4.30882 2.14661 4.77548 2.68794C5.24215 3.22928 5.47548 3.97128 5.47548 4.91395V6.08995H6.79148ZM1.35948 4.77395C1.35948 5.24995 1.47615 5.59061 1.70948 5.79595C1.95215 5.99195 2.37682 6.08995 2.98348 6.08995H4.31348V4.99795C4.31348 4.35395 4.18282 3.86861 3.92148 3.54195C3.66015 3.21528 3.28215 3.05195 2.78748 3.05195C2.35815 3.05195 2.01282 3.21061 1.75148 3.52794C1.49015 3.84528 1.35948 4.26061 1.35948 4.77395ZM8.88711 6.08995C8.98044 6.08995 9.02711 6.29528 9.02711 6.70595C9.02711 6.95795 9.01311 7.12128 8.98511 7.19595C8.95711 7.26128 8.92444 7.29395 8.88711 7.29395H6.78711C6.69378 7.29395 6.64711 7.09795 6.64711 6.70595C6.64711 6.29528 6.69378 6.08995 6.78711 6.08995H8.88711ZM10.9926 6.08995C11.0859 6.08995 11.1326 6.29528 11.1326 6.70595C11.1326 6.95795 11.1186 7.12128 11.0906 7.19595C11.0626 7.26128 11.0299 7.29395 10.9926 7.29395H8.89258C8.79924 7.29395 8.75258 7.09795 8.75258 6.70595C8.75258 6.29528 8.79924 6.08995 8.89258 6.08995H10.9926ZM13.098 6.08995C13.1914 6.08995 13.238 6.29528 13.238 6.70595C13.238 6.95795 13.224 7.12128 13.196 7.19595C13.168 7.26128 13.1354 7.29395 13.098 7.29395H10.998C10.9047 7.29395 10.858 7.09795 10.858 6.70595C10.858 6.29528 10.9047 6.08995 10.998 6.08995H13.098ZM15.2035 6.08995C15.2968 6.08995 15.3435 6.29528 15.3435 6.70595C15.3435 6.95795 15.3295 7.12128 15.3015 7.19595C15.2735 7.26128 15.2408 7.29395 15.2035 7.29395H13.1035C13.0102 7.29395 12.9635 7.09795 12.9635 6.70595C12.9635 6.29528 13.0102 6.08995 13.1035 6.08995H15.2035ZM17.309 6.08995C17.4023 6.08995 17.449 6.29528 17.449 6.70595C17.449 6.95795 17.435 7.12128 17.407 7.19595C17.379 7.26128 17.3463 7.29395 17.309 7.29395H15.209C15.1157 7.29395 15.069 7.09795 15.069 6.70595C15.069 6.29528 15.1157 6.08995 15.209 6.08995H17.309ZM21.0665 5.06795C21.0665 5.75861 20.8565 6.30461 20.4365 6.70595C20.0165 7.09795 19.4611 7.29395 18.7705 7.29395H17.3145C17.2211 7.29395 17.1745 7.09795 17.1745 6.70595C17.1745 6.29528 17.2211 6.08995 17.3145 6.08995H18.7705C19.1065 6.08995 19.3771 6.00128 19.5825 5.82395C19.7971 5.63728 19.9045 5.38061 19.9045 5.05395V2.78594H21.0665V5.06795ZM21.5005 -5.50747e-05V1.10594H17.8045V-5.50747e-05H21.5005ZM4.47257 22.7099C3.29657 22.7099 2.39124 22.3693 1.75657 21.6879C1.1219 21.0066 0.80457 20.0546 0.80457 18.8319V16.1859H1.96657V18.8039C1.96657 19.6906 2.18124 20.3626 2.61057 20.8199C3.0399 21.2773 3.6699 21.5059 4.50057 21.5059H5.08857C5.89124 21.5059 6.53057 21.2726 7.00657 20.8059C7.4919 20.3393 7.73457 19.7093 7.73457 18.9159V14.7859H8.89657V18.8039C8.89657 19.6066 8.73324 20.3019 8.40657 20.8899C8.08924 21.4779 7.64124 21.9259 7.06257 22.2339C6.49324 22.5513 5.83524 22.7099 5.08857 22.7099H4.47257ZM3.82857 14.3659V13.2039H5.31257V14.3659H3.82857ZM13.8145 18.0899C13.8612 18.0899 13.8938 18.1319 13.9125 18.2159C13.9405 18.2906 13.9545 18.4539 13.9545 18.7059C13.9545 18.9486 13.9405 19.1073 13.9125 19.1819C13.8938 19.2566 13.8612 19.2939 13.8145 19.2939H13.4505C12.7412 19.2939 12.1998 19.0839 11.8265 18.6639C11.4625 18.2346 11.2805 17.6279 11.2805 16.8439V10.2359H12.4425V16.7879C12.4425 17.6559 12.7972 18.0899 13.5065 18.0899H13.8145ZM14.1433 18.0899C14.806 18.0899 15.1373 17.7913 15.1373 17.1939V16.6199C15.1373 15.7239 15.3753 15.0193 15.8513 14.5059C16.3273 13.9926 16.9806 13.7359 17.8113 13.7359C18.642 13.7359 19.2813 13.9786 19.7293 14.4639C20.1773 14.9493 20.4013 15.6493 20.4013 16.5639C20.4013 17.4319 20.168 18.1039 19.7013 18.5799C19.2346 19.0559 18.5906 19.2939 17.7693 19.2939C16.7986 19.2939 16.1453 19.0046 15.8093 18.4259C15.6506 18.7246 15.4406 18.9439 15.1793 19.0839C14.918 19.2239 14.5726 19.2939 14.1433 19.2939H13.8213C13.728 19.2939 13.6813 19.0979 13.6813 18.7059C13.6813 18.2953 13.728 18.0899 13.8213 18.0899H14.1433ZM19.2393 16.5639C19.2393 15.4626 18.7493 14.9119 17.7693 14.9119C17.2746 14.9119 16.906 15.0519 16.6633 15.3319C16.4206 15.6119 16.2993 16.0413 16.2993 16.6199C16.2993 17.0773 16.4253 17.4366 16.6773 17.6979C16.9386 17.9593 17.3026 18.0899 17.7693 18.0899C18.7493 18.0899 19.2393 17.5813 19.2393 16.5639Z'/%3E%3C/svg%3E");
}

/* پیش‌فرض مثل کد اصلی: روی قیمت خط‌خورده آیکون تکرار نمی‌شود. */
.elementor-widget-awp-ep-product-price:not(.awp-price-old-icon-yes) .awp-price-old .awp-price-currency__icon {
	display: none;
}

/* --------------------------------------------------
   ناموجود
   -------------------------------------------------- */
.awp-price-stock {
	color: var(--awp-price-stock-color);
	font-size: 16px;
	font-weight: 700;
	line-height: 1;
}

/* --------------------------------------------------
   انیمیشن عوض شدن قیمت با انتخاب تنوع (همان کد اصلی)
   -------------------------------------------------- */
.awp-price.is-updating .awp-price-stack {
	opacity: 0.5;
	filter: blur(1px);
}

.awp-price.is-updated .awp-price-stack {
	animation: awp-price-in 0.2s linear;
}

@keyframes awp-price-in {
	from {
		opacity: 0;
		transform: translateY(5px);
	}

	to {
		opacity: 1;
		transform: translateY(0);
	}
}

@media (prefers-reduced-motion: reduce) {
	.awp-price.is-updated .awp-price-stack {
		animation: none;
	}
}

/* --------------------------------------------------
   پیام ویرایشگر
   -------------------------------------------------- */
.awp-price-placeholder {
	padding: 10px 12px;
	border: 1px dashed var(--border, rgba(127, 127, 127, 0.35));
	border-radius: 8px;
	font-size: 12px;
	line-height: 1.8;
}
