/* استایل ماژول‌های فاز ۲ — کاملاً RTL با ویژگی‌های منطقی. */

/* نشان درصد تخفیف (لنگر قیمت) */
.sp-discount-badge {
	display: inline-block;
	background: #d63638;
	color: #fff;
	font-size: 12px;
	font-weight: 700;
	padding: 2px 8px;
	border-radius: 12px;
	margin-inline-start: 6px;
}

/* اثر طعمه (Decoy) */
.sp-decoy-title {
	font-size: 18px;
	font-weight: 700;
	margin-block-end: 12px;
	text-align: center;
}

.sp-decoy-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 14px;
	align-items: stretch;
}

@media (max-width: 600px) {
	.sp-decoy-grid {
		grid-template-columns: 1fr;
	}

	/* روی موبایل بزرگ‌نمایی کارت برتر سرریز افقی ایجاد نکند. */
	.sp-decoy-best {
		transform: none;
	}
}

.sp-decoy-card {
	position: relative;
	border: 1px solid #e0e0e0;
	border-radius: 10px;
	padding: 20px 14px 14px;
	text-align: center;
	background: #fff;
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.sp-decoy-best {
	border-color: #1a7f37;
	border-width: 2px;
	box-shadow: 0 4px 14px rgba(26, 127, 55, 0.18);
	transform: scale(1.03);
}

.sp-decoy-ribbon {
	position: absolute;
	inset-block-start: -12px;
	/* مرکز‌چین مستقل از جهت (RTL/LTR) بدون transform جهت‌دار. */
	inset-inline: 0;
	margin-inline: auto;
	inline-size: max-content;
	max-inline-size: 90%;
	background: #1a7f37;
	color: #fff;
	font-size: 12px;
	font-weight: 700;
	padding: 3px 12px;
	border-radius: 12px;
	white-space: nowrap;
}

.sp-decoy-name {
	font-weight: 700;
	font-size: 16px;
}

.sp-decoy-price {
	font-size: 18px;
	color: #1d2327;
}

.sp-decoy-note {
	color: #646970;
	font-size: 13px;
}

.sp-decoy-btn {
	margin-block-start: auto;
}

/* کمیابی */
.sp-scarcity {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	color: #b32d2e;
	background: #fdeceb;
	border: 1px solid #f4c7c5;
	border-radius: 6px;
	padding: 6px 12px;
	font-weight: 600;
	font-size: 14px;
}

.sp-scarcity--loop {
	font-size: 12px;
	padding: 3px 8px;
}

/* فوریت و شمارش معکوس */
.sp-urgency-banner {
	background: #fff4e5;
	border: 1px solid #ffd8a8;
	border-radius: 6px;
	padding: 8px 12px;
	color: #b26a00;
	font-weight: 600;
	margin-block-end: 8px;
}

.sp-countdown {
	display: flex;
	gap: 8px;
	direction: ltr;
	justify-content: flex-end;
}

.sp-cd-part {
	background: #1d2327;
	color: #fff;
	border-radius: 8px;
	padding: 8px 10px;
	min-inline-size: 54px;
	text-align: center;
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.sp-cd-num {
	font-size: 20px;
	font-weight: 700;
	font-variant-numeric: tabular-nums;
}

.sp-cd-lbl {
	font-size: 11px;
	opacity: 0.85;
}

/* هشدار افزایش قیمت (مینیمال) */
.sp-price-warning {
	display: flex;
	align-items: center;
	gap: 8px;
	background: transparent;
	border: none;
	border-inline-start: 3px solid #cfe3fb;
	border-radius: 0;
	padding: 4px 12px;
	color: #475467;
	font-size: 13px;
}

/* فروش مکمل نسخه (مینیمال) */
.sp-variant-upsell {
	background: transparent;
	border: none;
	border-inline-start: 3px solid #46b450;
	border-radius: 0;
	padding: 4px 12px;
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.sp-vu-text {
	font-weight: 600;
	color: #1a7f37;
}

.sp-vu-btn {
	align-self: flex-start;
}

/* وفاداری/کش‌بک */
.sp-loyalty-box {
	background: #fbf7ff;
	border: 1px solid #e6d6fb;
	border-radius: 8px;
	padding: 10px 14px;
	margin-block-end: 12px;
}

.sp-loyalty-balance {
	margin-block-end: 6px;
}

.sp-loyalty-redeem-label {
	display: flex;
	align-items: center;
	gap: 6px;
	cursor: pointer;
}

.sp-loyalty-min {
	color: #646970;
	font-size: 13px;
}

.sp-loyalty-account {
	margin-block: 16px;
	max-inline-size: 100%;
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}

.sp-loyalty-history {
	inline-size: 100%;
}

.sp-loyalty-history th,
.sp-loyalty-history td {
	text-align: start;
}

/* نشان پرفروش‌ترین (روی صفحه‌ی محصول: بج کوچک) */
.sp-bestseller-badge {
	display: inline-block;
	background: #f0a500;
	color: #fff;
	font-size: 12px;
	font-weight: 700;
	padding: 3px 10px;
	border-radius: 12px;
	margin-block-end: 6px;
	z-index: 2;
	position: relative;
}

/* نشان پرفروش‌ترین روی کارت محصول: ریبون گوشه (بدون ایموجی) */
.woocommerce ul.products li.product,
ul.products li.product,
.products .product,
li.product {
	position: relative;
}

.sp-bestseller-ribbon {
	position: absolute;
	top: 0;
	left: 0;
	right: auto;
	inline-size: 120px;
	block-size: 120px;
	overflow: hidden;
	z-index: 4;
	pointer-events: none;
}

.sp-bestseller-ribbon-text {
	position: absolute;
	top: 26px;
	left: -46px;
	right: auto;
	inline-size: 180px;
	transform: rotate(-45deg);
	background: #f0a500;
	color: #fff;
	text-align: center;
	font-size: 12px;
	font-weight: 800;
	padding: 6px 0;
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

/* ===== فاز ۳ ===== */

/* پیشنهاد هوشمند */
.sp-smart-offer {
	display: flex;
	align-items: center;
	gap: 8px;
	flex-wrap: wrap;
	background: #fff4e5;
	border: 1px solid #ffd8a8;
	border-radius: 8px;
	padding: 10px 14px;
	color: #8a5a00;
	font-weight: 600;
}

.sp-smart-offer-coupon code {
	background: #1d2327;
	color: #fff;
	padding: 2px 8px;
	border-radius: 4px;
	direction: ltr;
	display: inline-block;
	overflow-wrap: anywhere;
}

/* پاپ‌آپ بازیابی سبد */
.sp-cr-overlay {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.55);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 99999;
	direction: rtl;
}

.sp-cr-overlay[hidden] {
	display: none;
}

.sp-cr-popup {
	position: relative;
	background: #fff;
	border-radius: 12px;
	padding: 28px 24px;
	max-inline-size: 420px;
	inline-size: calc(100% - 32px);
	max-block-size: 90vh;
	overflow-y: auto;
	text-align: center;
	box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
}

.sp-cr-close {
	position: absolute;
	inset-block-start: 8px;
	inset-inline-end: 12px;
	background: none;
	border: none;
	font-size: 26px;
	line-height: 1;
	cursor: pointer;
	color: #646970;
}

.sp-cr-title {
	margin-block-start: 0;
	font-size: 22px;
}

.sp-cr-text {
	color: #50575e;
	margin-block-end: 16px;
}

.sp-cr-coupon {
	background: #f3fbf5;
	border: 1px dashed #46b450;
	border-radius: 8px;
	padding: 10px;
	margin-block-end: 16px;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	flex-wrap: wrap;
}

.sp-cr-coupon[hidden] {
	display: none;
}

.sp-cr-coupon-code {
	font-size: 18px;
	font-weight: 700;
	color: #1a7f37;
	direction: ltr;
	background: #fff;
	padding: 4px 10px;
	border-radius: 6px;
	overflow-wrap: anywhere;
}

.sp-cr-buttons {
	display: flex;
	gap: 10px;
	flex-wrap: wrap;
}

.sp-cr-cta {
	display: inline-block;
	flex: 1 1 0;
	text-align: center;
	min-inline-size: 120px;
}

.sp-cr-primary {
	background: #1a7f37 !important;
	color: #fff !important;
	font-weight: 700;
}

.sp-cr-secondary {
	background: #f0f0f1 !important;
	color: #1d2327 !important;
}

@media (max-width: 420px) {
	.sp-cr-buttons { flex-direction: column; }
}

/* ===== فاز ۵ ===== */

/* نشان تاریخچه‌ی قیمت */
.sp-pricehist {
	margin-block: 8px;
}

.sp-pricehist-badge {
	display: inline-block;
	font-size: 13px;
	font-weight: 700;
	padding: 4px 12px;
	border-radius: 8px;
	color: #fff;
}

.sp-pricehist-badge.sp-best {
	background: #1a7f37;
}

.sp-pricehist-badge.sp-near {
	background: #2271b1;
}

/* اثبات اجتماعی زنده‌ی سبد */
.sp-live-cart {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	background: #fff4e5;
	border: 1px solid #ffd8a8;
	border-radius: 8px;
	padding: 6px 12px;
	color: #8a5a00;
	font-size: 14px;
	font-weight: 600;
}

.sp-live-cart-dot {
	inline-size: 9px;
	block-size: 9px;
	border-radius: 50%;
	background: #e8590c;
	animation: sp-pulse 1.6s infinite;
}

@keyframes sp-pulse {
	0% {
		box-shadow: 0 0 0 0 rgba(232, 89, 12, 0.5);
	}
	70% {
		box-shadow: 0 0 0 8px rgba(232, 89, 12, 0);
	}
	100% {
		box-shadow: 0 0 0 0 rgba(232, 89, 12, 0);
	}
}

/* پاپ‌آپ فروش مکمل تسویه‌حساب */
.sp-xs-overlay {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.55);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 99999;
	direction: rtl;
}

.sp-xs-overlay[hidden] {
	display: none;
}

.sp-xs-popup {
	position: relative;
	background: #fff;
	border-radius: 12px;
	padding: 24px;
	max-inline-size: 560px;
	inline-size: calc(100% - 32px);
	max-block-size: 90vh;
	overflow-y: auto;
	box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
}

.sp-xs-close {
	position: absolute;
	inset-block-start: 8px;
	inset-inline-end: 12px;
	background: none;
	border: none;
	font-size: 26px;
	line-height: 1;
	cursor: pointer;
	color: #646970;
}

.sp-xs-title {
	margin-block-start: 0;
	text-align: center;
}

.sp-xs-incentive {
	text-align: center;
	color: #1a7f37;
	font-weight: 700;
	margin-block-end: 12px;
}

.sp-xs-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 12px;
}

@media (max-width: 560px) {
	.sp-xs-grid {
		grid-template-columns: 1fr;
	}
}

.sp-xs-item {
	border: 1px solid #eee;
	border-radius: 8px;
	padding: 10px;
	text-align: center;
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.sp-xs-item img {
	inline-size: 100%;
	block-size: auto;
	border-radius: 6px;
}

.sp-xs-name {
	display: block;
	font-size: 13px;
}

.sp-xs-add {
	margin-block-start: auto;
}

.sp-xs-add.sp-xs-added {
	background: #1a7f37 !important;
	border-color: #1a7f37 !important;
	color: #fff !important;
}

.sp-xs-add.sp-xs-failed {
	background: #d63638 !important;
	border-color: #d63638 !important;
	color: #fff !important;
}

/* جدول مشخصات محصول (هم‌سبک با کارت‌های خاکستریِ قالب) */
.sp-specs-title {
	font-size: 16px;
	font-weight: 800;
	margin-block-end: 12px;
	color: #1d2327;
}

.sp-specs-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
	gap: 12px;
}

.sp-spec-item {
	background: #f3f4f7;
	border: none;
	border-radius: 14px;
	padding: 16px 14px;
	text-align: center;
}

.sp-spec-label {
	font-size: 13px;
	color: #8a909c;
	margin-block-end: 6px;
}

.sp-spec-value {
	font-weight: 800;
	color: #1d2327;
	font-size: 15px;
	line-height: 1.6;
}

@media (max-width: 480px) {
	.sp-specs-grid {
		grid-template-columns: repeat(2, 1fr);
		gap: 8px;
	}
	.sp-spec-item {
		padding: 12px 10px;
	}
}

/* پکیج‌ساز خودکار */
.sp-packages-title {
	font-size: 20px;
	font-weight: 800;
	margin-block-end: 14px;
	text-align: center;
}

.sp-packages-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
	gap: 16px;
}

.sp-package-card {
	border: 1px solid #eaecf0;
	border-radius: 12px;
	padding: 16px;
	background: #fff;
	box-shadow: 0 6px 18px rgba(16, 24, 40, 0.06);
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.sp-package-name {
	font-weight: 800;
	font-size: 17px;
	color: #5b3df5;
}

.sp-package-items {
	display: flex;
	gap: 8px;
	flex-wrap: wrap;
}

.sp-package-item {
	flex: 1 1 70px;
	text-align: center;
	font-size: 11px;
}

.sp-package-item img {
	inline-size: 100%;
	block-size: auto;
	border-radius: 8px;
}

.sp-package-price {
	display: flex;
	align-items: center;
	gap: 8px;
	flex-wrap: wrap;
}

.sp-package-price del {
	color: #98a2b3;
}

.sp-package-price ins {
	text-decoration: none;
	font-weight: 800;
	font-size: 18px;
	color: #1a7f37;
}

.sp-package-off {
	background: #d63638;
	color: #fff;
	border-radius: 8px;
	padding: 2px 8px;
	font-size: 12px;
	font-weight: 700;
}

.sp-package-add {
	margin-block-start: auto;
	text-align: center;
}
