/* ===================== Custom Product Rail — Core Styles ===================== */
/* بدون فونت یا CDN خارجی — فونت از قالب فعلی سایت (مثلاً ایران‌یکان) به ارث می‌رسد */

.cpr-widget {
	position: relative;
	direction: rtl;
	font-family: inherit;
	width: 100%;
	box-sizing: border-box;
}
.cpr-widget * {
	box-sizing: border-box;
}

.cpr-viewport {
	overflow: hidden;
	width: 100%;
}

/* ریل اصلی — اسکرول نیتیو با snap، روان روی موبایل و دسکتاپ */
.cpr-track {
	--cpr-slides: 4;
	--cpr-gap: 16px;

	display: flex;
	gap: var(--cpr-gap);
	overflow-x: auto;
	overflow-y: hidden;
	scroll-snap-type: x proximity;
	scroll-behavior: smooth;
	-webkit-overflow-scrolling: touch;
	padding: 4px 2px 10px;
	margin: 0;
	list-style: none;
	cursor: grab;
	user-select: none;
}
.cpr-track.is-dragging {
	cursor: grabbing;
	scroll-behavior: auto;
	scroll-snap-type: none;
}
.cpr-track::-webkit-scrollbar {
	height: 6px;
}
.cpr-track::-webkit-scrollbar-thumb {
	background: rgba(0, 0, 0, 0.15);
	border-radius: 10px;
}
.cpr-track::-webkit-scrollbar-track {
	background: transparent;
}

/* هر کارت یک اسلاید ریل است */
.cpr-card {
	flex: 0 0 calc((100% - (var(--cpr-slides) - 1) * var(--cpr-gap)) / var(--cpr-slides));
	scroll-snap-align: start;
	background: #fff;
	border-radius: 14px;
	overflow: hidden;
	display: flex;
	flex-direction: column;
	transition: box-shadow 0.25s ease, transform 0.25s ease;
	pointer-events: auto;
}

.cpr-card-image {
	position: relative;
	display: block;
	width: 100%;
	height: 220px;
	overflow: hidden;
	background: #f5f5f5;
	pointer-events: none; /* جلوگیری از کلیک تصادفی حین درگ؛ با JS دوباره فعال می‌شود */
}
.cpr-card-image img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	pointer-events: none;
}
.cpr-badge-sale {
	position: absolute;
	top: 10px;
	inset-inline-start: 10px;
	background: #e74c3c;
	color: #fff;
	font-size: 12px;
	padding: 3px 10px;
	border-radius: 20px;
	pointer-events: none;
}

.cpr-card-body {
	padding: 14px;
	display: flex;
	flex-direction: column;
	gap: 8px;
	flex: 1;
}

.cpr-card-title {
	font-size: 15px;
	font-weight: 600;
	color: #1a1a1a;
	text-decoration: none;
	line-height: 1.6;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.cpr-rating {
	display: flex;
	gap: 2px;
	font-size: 13px;
}
.cpr-star {
	color: #d9d9d9;
}
.cpr-star.is-full {
	color: #f5a623;
}

.cpr-card-price {
	font-size: 15px;
	font-weight: 700;
	display: flex;
	align-items: center;
	gap: 8px;
}
.cpr-card-price del {
	font-weight: 400;
	font-size: 13px;
	opacity: 0.7;
	text-decoration: line-through;
}
.cpr-card-price ins {
	text-decoration: none;
}

.cpr-card-actions {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-top: auto;
}

.cpr-add-to-cart {
	flex: 1;
	text-align: center;
	background: #0a3d62;
	color: #fff;
	text-decoration: none;
	padding: 10px 12px;
	border-radius: 8px;
	font-size: 13px;
	font-weight: 600;
	transition: background-color 0.2s ease;
	white-space: nowrap;
}
.cpr-add-to-cart.loading {
	opacity: 0.6;
	pointer-events: none;
}
.cpr-add-to-cart.added::after {
	content: " ✓";
}

.cpr-view-link {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 38px;
	height: 38px;
	border-radius: 8px;
	background: #f2f2f2;
	color: #333;
	flex-shrink: 0;
}

/* فلش‌ها */
.cpr-arrow {
	position: absolute;
	top: 40%;
	transform: translateY(-50%);
	width: 40px;
	height: 40px;
	border-radius: 50%;
	background: #fff;
	border: 1px solid rgba(0, 0, 0, 0.08);
	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	z-index: 5;
	color: #1a1a1a;
	transition: background-color 0.2s ease;
}
.cpr-arrow:hover {
	background: #f2f2f2;
}
.cpr-arrow-prev {
	inset-inline-start: -6px;
}
.cpr-arrow-next {
	inset-inline-end: -6px;
}
.cpr-arrow[disabled] {
	opacity: 0.3;
	cursor: default;
	pointer-events: none;
}

/* نقطه‌ها */
.cpr-dots {
	display: flex;
	justify-content: center;
	gap: 6px;
	margin-top: 12px;
}
.cpr-dot {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: #d9d9d9;
	cursor: pointer;
	border: none;
	padding: 0;
	transition: background-color 0.2s ease, transform 0.2s ease;
}
.cpr-dot.is-active {
	background: #0a3d62;
	transform: scale(1.25);
}

@media (max-width: 767px) {
	.cpr-arrow {
		display: none; /* روی موبایل حرکت با لمس طبیعی‌تره؛ فلش‌ها فقط دسکتاپ */
	}
}
