/* ==========================================================================
   استریپ استوری + پلیر ریلز — افزونه ویدیوی محصول
   همه‌ی مقادیر قابل تنظیم به‌صورت CSS Variable از سمت PHP تزریق می‌شوند تا این
   فایل ثابت و کاملاً قابل کش بماند.
   ========================================================================== */

.wcpv-reels {
	--wcpv-size: 84px;
	--wcpv-size-m: 68px;
	--wcpv-gap: 14px;
	--wcpv-pad: 8px;
	--wcpv-ring-w: 3px;
	--wcpv-ring: linear-gradient(45deg, #f09433, #bc1888);
	--wcpv-name-size: 12px;
	--wcpv-name-color: #333;
	--wcpv-justify: flex-start;

	position: relative;
	width: 100%;
	margin: 0 0 16px;
}

.wcpv-reels-head {
	display: flex;
	align-items: center;
	justify-content: var(--wcpv-justify);
	margin-bottom: 8px;
}

.wcpv-reels-title {
	margin: 0;
	font-size: 1rem;
	font-weight: 700;
}

.wcpv-reels-viewport {
	position: relative;
}

.wcpv-reels-strip {
	display: flex;
	justify-content: var(--wcpv-justify);
	gap: var(--wcpv-gap);
	list-style: none;
	margin: 0;
	padding: var(--wcpv-pad) 2px;
	overflow-x: auto;
	overflow-y: hidden;
	scroll-behavior: smooth;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: none;
}

.wcpv-reels-strip::-webkit-scrollbar {
	display: none;
}

.wcpv-reel-cell {
	flex: 0 0 auto;
	margin: 0;
	padding: 0;
	list-style: none;
}

.wcpv-reel-item {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 6px;
	width: calc(var(--wcpv-size) + var(--wcpv-ring-w) * 2 + 6px);
	padding: 0;
	border: 0;
	background: none;
	cursor: pointer;
	font: inherit;
	color: inherit;
	-webkit-tap-highlight-color: transparent;
}

.wcpv-ring {
	display: block;
	width: calc(var(--wcpv-size) + var(--wcpv-ring-w) * 2 + 4px);
	height: calc(var(--wcpv-size) + var(--wcpv-ring-w) * 2 + 4px);
	padding: var(--wcpv-ring-w);
	border-radius: 50%;
	background: var(--wcpv-ring);
	transition: transform 0.18s ease;
}

.wcpv-reel-item:hover .wcpv-ring,
.wcpv-reel-item:focus-visible .wcpv-ring {
	transform: scale(1.04);
}

.wcpv-ring-inner {
	display: block;
	width: 100%;
	height: 100%;
	padding: 2px;
	border-radius: 50%;
	background: #fff;
}

.wcpv-ring-inner img {
	display: block;
	width: 100%;
	height: 100%;
	border-radius: 50%;
	object-fit: cover;
	background: #f2f2f2;
}

.wcpv-reel-name {
	max-width: 100%;
	overflow: hidden;
	color: var(--wcpv-name-color);
	font-size: var(--wcpv-name-size);
	line-height: 1.5;
	text-align: center;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.wcpv-no-name .wcpv-reel-item {
	gap: 0;
}

.wcpv-strip-nav {
	position: absolute;
	top: 50%;
	z-index: 2;
	display: none;
	width: 40px;
	height: 40px;
	transform: translateY(-50%);
	align-items: center;
	justify-content: center;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.95);
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.16);
	color: #222;
	cursor: pointer;
	font-size: 24px;
	line-height: 1;
}

.wcpv-strip-prev { right: -6px; }
.wcpv-strip-next { left: -6px; }

@media (min-width: 783px) {
	.wcpv-strip-nav:not([hidden]) { display: flex; }
}

@media (max-width: 782px) {
	.wcpv-reels {
		--wcpv-size: var(--wcpv-size-m);
	}
	.wcpv-hide-mobile { display: none !important; }
}

@media (min-width: 783px) {
	.wcpv-hide-desktop { display: none !important; }
}

/* ==========================================================================
   پلیر ریلز
   ========================================================================== */

body.wcpv-reels-lock {
	position: fixed;
	width: 100%;
	overflow: hidden;
}

.wcpv-overlay {
	direction: rtl;
	--wcpv-player-bg: #000;
	--wcpv-btn-bg: #fff;
	--wcpv-btn-color: #111;
	--wcpv-btn-radius: 12px;
	--wcpv-like-color: #ff2d55;
	--wcpv-thumb: 48px;

	position: fixed;
	inset: 0;
	z-index: 999999;
	display: none;
	background: var(--wcpv-player-bg);
	color: #fff;
	font-family: inherit;
	overscroll-behavior: contain;
}

.wcpv-overlay.is-open {
	display: block;
}

.wcpv-track {
	width: 100%;
	height: 100%;
	overflow-x: hidden;
	overflow-y: auto;
	scroll-snap-type: y mandatory;
	overscroll-behavior: contain;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: none;
}

.wcpv-track::-webkit-scrollbar {
	display: none;
}

.wcpv-slide {
	position: relative;
	width: 100%;
	height: 100%;
	scroll-snap-align: start;
	scroll-snap-stop: always;
	overflow: hidden;
}

.wcpv-stage {
	position: relative;
	width: 100%;
	height: 100%;
	overflow: hidden;
}

.wcpv-frames {
	display: flex;
	width: 100%;
	height: 100%;
	direction: ltr;
	overflow-x: auto;
	overflow-y: hidden;
	scroll-snap-type: x mandatory;
	overscroll-behavior-x: contain;
	scrollbar-width: none;
}

.wcpv-frames::-webkit-scrollbar {
	display: none;
}

.wcpv-frame {
	position: relative;
	flex: 0 0 100%;
	width: 100%;
	height: 100%;
	scroll-snap-align: center;
	scroll-snap-stop: always;
	background-position: center;
	background-repeat: no-repeat;
	background-size: cover;
}

.wcpv-fit-contain .wcpv-frame {
	background-size: contain;
}

.wcpv-frame video,
.wcpv-frame img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.wcpv-fit-contain .wcpv-frame video,
.wcpv-fit-contain .wcpv-frame img {
	object-fit: contain;
}

.wcpv-frame-gallery img {
	object-fit: contain;
	background: #0a0a0a;
}

/* لایه‌ی تیره برای خوانا ماندن متن‌ها */
.wcpv-stage::after {
	content: "";
	position: absolute;
	inset: auto 0 0 0;
	height: 50%;
	pointer-events: none;
	background: linear-gradient(to top, rgba(0, 0, 0, 0.78), rgba(0, 0, 0, 0.35) 45%, rgba(0, 0, 0, 0));
}

.wcpv-ui {
	position: absolute;
	inset: 0;
	z-index: 3;
	pointer-events: none;
}

.wcpv-ui > * {
	pointer-events: auto;
}

/* نوارهای بالا و پایین خودشان ضربه نمی‌گیرند تا تک‌ضربه روی نواحی خالی
   به ویدیو برسد؛ فقط عناصر تعاملی داخلشان فعال‌اند. */
.wcpv-top,
.wcpv-bottom,
.wcpv-meta {
	pointer-events: none;
}

.wcpv-top > *,
.wcpv-thumbs,
.wcpv-dots,
.wcpv-actions,
.wcpv-meta-buttons {
	pointer-events: auto;
}

/* نوار پیشرفت */
.wcpv-progress {
	position: absolute;
	top: 0;
	right: 0;
	left: 0;
	height: 3px;
	background: rgba(255, 255, 255, 0.25);
}

.wcpv-progress span {
	display: block;
	width: 0;
	height: 100%;
	background: #fff;
	transform-origin: right center;
}

/* دکمه‌های بالا */
.wcpv-top {
	position: absolute;
	top: 14px;
	right: 12px;
	left: 12px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
}

.wcpv-icon-btn {
	display: flex;
	width: 48px;
	height: 48px;
	align-items: center;
	justify-content: center;
	border: 0;
	border-radius: 50%;
	background: rgba(0, 0, 0, 0.45);
	color: #fff;
	cursor: pointer;
	font-size: 22px;
	line-height: 1;
	backdrop-filter: blur(6px);
	-webkit-tap-highlight-color: transparent;
}

.wcpv-icon-btn svg {
	width: 26px;
	height: 26px;
	fill: currentColor;
}

/* بلوک پایین: تامبنیل‌ها + (اطلاعات محصول | ستون کنش‌ها) */
.wcpv-bottom {
	position: absolute;
	right: 0;
	bottom: 0;
	left: 0;
	display: flex;
	flex-direction: column;
	gap: 10px;
	padding: 0 14px 18px;
}

.wcpv-bottom-row {
	display: flex;
	align-items: flex-end;
	gap: 12px;
}

/* ستون کنش‌ها — سمت راست، مثل اینستاگرام */
.wcpv-actions {
	flex: 0 0 auto;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 18px;
}

.wcpv-action {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 4px;
	min-width: 48px;
	padding: 4px;
	border: 0;
	background: none;
	color: #fff;
	cursor: pointer;
	font: inherit;
	-webkit-tap-highlight-color: transparent;
}

.wcpv-action svg {
	width: 36px;
	height: 36px;
	fill: #fff;
	filter: drop-shadow(0 1px 4px rgba(0, 0, 0, 0.55));
	transition: transform 0.16s ease;
}

.wcpv-action:active svg {
	transform: scale(0.86);
}

.wcpv-action .wcpv-count {
	font-size: 13px;
	font-weight: 700;
	text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}

.wcpv-like.is-liked svg {
	fill: var(--wcpv-like-color);
}

/* اطلاعات محصول */
.wcpv-meta {
	flex: 1 1 auto;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 8px;
	text-align: right;
}

.wcpv-meta-title {
	margin: 0;
	overflow: hidden;
	font-size: 15px;
	font-weight: 700;
	line-height: 1.6;
	text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
}

.wcpv-meta-price {
	font-size: 13px;
	opacity: 0.92;
	text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
}

.wcpv-meta-buttons {
	display: flex;
	gap: 8px;
	flex-wrap: wrap;
}

.wcpv-cta {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 11px 18px;
	border: 0;
	border-radius: var(--wcpv-btn-radius);
	background: var(--wcpv-btn-bg);
	color: var(--wcpv-btn-color);
	cursor: pointer;
	font-size: 14px;
	font-weight: 700;
	text-decoration: none;
}

.wcpv-cta-alt {
	background: rgba(255, 255, 255, 0.18);
	color: #fff;
	backdrop-filter: blur(6px);
}

.wcpv-cta[disabled] {
	opacity: 0.65;
	cursor: default;
}

/* نوار تامبنیل تصاویر محصول */
.wcpv-thumbs {
	display: flex;
	gap: 8px;
	direction: ltr;
	overflow-x: auto;
	overscroll-behavior-x: contain;
	padding: 2px 0;
	scrollbar-width: none;
	-webkit-overflow-scrolling: touch;
}

.wcpv-thumbs::-webkit-scrollbar {
	display: none;
}

.wcpv-thumb {
	position: relative;
	flex: 0 0 auto;
	width: var(--wcpv-thumb, 48px);
	height: calc(var(--wcpv-thumb, 48px) * 1.3);
	padding: 0;
	overflow: hidden;
	border: 2px solid transparent;
	border-radius: 9px;
	background: rgba(255, 255, 255, 0.14);
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
	cursor: pointer;
	opacity: 0.72;
	transition: opacity 0.18s ease, border-color 0.18s ease;
	-webkit-tap-highlight-color: transparent;
}

.wcpv-thumb img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.wcpv-thumb.is-on {
	border-color: #fff;
	opacity: 1;
}

/* نشانه‌ی پخش روی تامبنیل ویدیو */
.wcpv-thumb-video::after {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	width: 0;
	height: 0;
	margin: -7px 0 0 -4px;
	border-top: 7px solid transparent;
	border-bottom: 7px solid transparent;
	border-left: 11px solid #fff;
	filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.7));
}

/* نگه داشتن انگشت روی ویدیو: مکث + محو شدن رابط کاربری */
.wcpv-slide.is-holding .wcpv-bottom,
.wcpv-slide.is-holding .wcpv-top {
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.2s ease;
}

.wcpv-slide.is-holding .wcpv-top > *,
.wcpv-slide.is-holding .wcpv-thumbs,
.wcpv-slide.is-holding .wcpv-dots,
.wcpv-slide.is-holding .wcpv-actions,
.wcpv-slide.is-holding .wcpv-meta-buttons {
	pointer-events: none;
}

.wcpv-slide.is-holding .wcpv-stage::after {
	opacity: 0;
	transition: opacity 0.2s ease;
}

/* نقطه‌های گالری (وقتی تامبنیل خاموش است) */
.wcpv-dots {
	display: flex;
	justify-content: center;
	gap: 5px;
}

.wcpv-dots i {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.45);
	transition: background 0.2s ease, transform 0.2s ease;
}

.wcpv-dots i.is-on {
	background: #fff;
	transform: scale(1.25);
}

/* نشانه‌ی مکث/پخش وسط صفحه (تک‌ضربه روی ویدیو) */
.wcpv-tap-icon {
	position: absolute;
	top: 50%;
	left: 50%;
	z-index: 4;
	display: flex;
	width: 82px;
	height: 82px;
	margin: -41px 0 0 -41px;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	background: rgba(0, 0, 0, 0.42);
	opacity: 0;
	pointer-events: none;
	transform: scale(0.72);
	transition: opacity 0.16s ease, transform 0.16s ease;
	backdrop-filter: blur(4px);
}

.wcpv-tap-icon svg {
	width: 42px;
	height: 42px;
	fill: #fff;
	filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.45));
}

.wcpv-tap-icon.is-on {
	opacity: 1;
	transform: scale(1);
}

.wcpv-tap-icon.is-flash {
	animation: wcpv-tap-flash 0.6s ease-out;
}

@keyframes wcpv-tap-flash {
	0%   { opacity: 0; transform: scale(0.72); }
	22%  { opacity: 1; transform: scale(1); }
	55%  { opacity: 1; transform: scale(1); }
	100% { opacity: 0; transform: scale(1.22); }
}

/* هنگام نگه داشتن انگشت، مثل بقیه‌ی رابط محو می‌شود. */
.wcpv-slide.is-holding .wcpv-tap-icon {
	opacity: 0;
	transition: opacity 0.2s ease;
}

/* قلب دابل‌تپ */
.wcpv-burst {
	position: absolute;
	top: 50%;
	left: 50%;
	z-index: 4;
	margin: -40px 0 0 -40px;
	opacity: 0;
	pointer-events: none;
}

.wcpv-burst svg {
	width: 80px;
	height: 80px;
	fill: #fff;
	filter: drop-shadow(0 2px 10px rgba(0, 0, 0, 0.5));
}

.wcpv-burst.is-on {
	animation: wcpv-burst 0.75s ease-out;
}

@keyframes wcpv-burst {
	0%   { opacity: 0; transform: scale(0.4); }
	25%  { opacity: 1; transform: scale(1.12); }
	60%  { opacity: 1; transform: scale(1); }
	100% { opacity: 0; transform: scale(1.3); }
}

/* اسپینر و توست */
.wcpv-spinner {
	position: absolute;
	top: 50%;
	left: 50%;
	z-index: 2;
	width: 30px;
	height: 30px;
	margin: -15px 0 0 -15px;
	border: 3px solid rgba(255, 255, 255, 0.25);
	border-top-color: #fff;
	border-radius: 50%;
	animation: wcpv-spin 0.8s linear infinite;
}

@keyframes wcpv-spin {
	to { transform: rotate(360deg); }
}

.wcpv-toast {
	position: fixed;
	bottom: 26px;
	left: 50%;
	z-index: 1000000;
	padding: 10px 18px;
	transform: translateX(-50%) translateY(12px);
	border-radius: 999px;
	background: rgba(20, 20, 20, 0.92);
	color: #fff;
	font-size: 13px;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.2s ease, transform 0.2s ease;
}

.wcpv-toast.is-on {
	opacity: 1;
	transform: translateX(-50%) translateY(0);
}

@media (min-width: 783px) {
	.wcpv-slide {
		display: flex;
		align-items: center;
		justify-content: center;
	}
	.wcpv-stage {
		position: relative;
		width: min(440px, 46vh);
		height: 100%;
		max-height: 100%;
		overflow: hidden;
	}
}

@media (prefers-reduced-motion: reduce) {
	.wcpv-reels-strip,
	.wcpv-track { scroll-behavior: auto; }
	.wcpv-burst.is-on { animation-duration: 0.01s; }
	.wcpv-tap-icon { transition: opacity 0.01s linear; }
	.wcpv-ring { transition: none; }
}
