/* PLM Reels - تنسيقات العرض بأسلوب تيك توك */

.plmr-feed {
	height: 100vh;
	height: 100dvh;
	overflow-y: scroll;
	scroll-snap-type: y mandatory;
	scroll-behavior: smooth;
	background: #000;
	-webkit-overflow-scrolling: touch;
	/* يمنع "سحب للتحديث" وارتداد الصفحة الخلفية عند السحب من أول/آخر مقطع. */
	overscroll-behavior-y: contain;
}

/* عند استخدام الشورت كود داخل صفحة عادية بالقالب، نمنع تمرير الصفحة نفسها
   ونجعل حاوية الفيديوهات فقط هي القابلة للتمرير، حتى تبقى تجربة "تيك توك"
   متماسكة حتى مع وجود هيدر/فوتر Jannah حول الشورت كود. */
.plmr-feed {
	max-height: 100vh;
	max-height: 100dvh;
}

.plmr-reel {
	position: relative;
	width: 100%;
	height: 100vh;
	height: 100dvh;
	scroll-snap-align: start;
	scroll-snap-stop: always;
	background: #000;
	overflow: hidden;
	/* يعزل رسم كل مقطع عن بقية الصفحة فيخفّ عمل المتصفح أثناء التمرير. */
	contain: layout paint;
}

.plmr-reel__media,
.plmr-reel__iframe,
.plmr-reel__img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	border: 0;
	background: #000;
}

/* صورة الغلاف (يوتيوب): تغطي المشغّل حتى يبدأ التشغيل فعلاً بدل الشاشة السوداء.
   تُقصّ من المنتصف لتطابق الفيديو العمودي 9:16. لا تستقبل أي ضغطة. */
.plmr-reel__poster {
	position: absolute;
	inset: 0;
	z-index: 1;
	width: 100%;
	height: 100%;
	object-fit: cover;
	background: #000;
	pointer-events: none;
	transition: opacity 0.28s ease;
}
.plmr-reel:not(.plmr-loaded) .plmr-reel__poster {
	transition: none;
}
.plmr-reel.plmr-loaded .plmr-reel__poster {
	opacity: 0;
}

/* الطبقة الشفافة التي تنقل لصفحة صاحب المقطع عند الضغط على الفيديو نفسه. */
.plmr-reel__overlay-link {
	position: absolute;
	inset: 0;
	z-index: 2;
	display: block;
	background: transparent;
	text-decoration: none;
}

.plmr-reel__logo {
	position: absolute;
	top: max(16px, env(safe-area-inset-top));
	inset-inline-start: 16px;
	z-index: 3;
	opacity: 0.82;
	max-width: 120px;
	line-height: 0;
	transition: opacity 0.15s ease;
}
.plmr-reel__logo:hover,
.plmr-reel__logo:focus-within {
	opacity: 1;
}
.plmr-reel__logo img {
	max-width: 100%;
	height: auto;
	display: block;
	filter: drop-shadow(0 1px 4px rgba(0, 0, 0, 0.5));
}
.plmr-reel__logo .plmr-logo-fallback {
	color: #fff;
	font-weight: 700;
	text-decoration: none;
	text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
	font-size: 15px;
}

.plmr-reel__whatsapp {
	position: absolute;
	bottom: max(28px, env(safe-area-inset-bottom));
	inset-inline-end: 18px;
	z-index: 3;
	display: flex;
	align-items: center;
	gap: 8px;
	background: #25d366;
	color: #fff;
	padding: 12px 18px;
	border-radius: 999px;
	text-decoration: none;
	font-weight: 700;
	font-size: 14px;
	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
	transition: transform 0.15s ease;
}
.plmr-reel__whatsapp:hover,
.plmr-reel__whatsapp:focus {
	transform: scale(1.05);
	color: #fff;
}
.plmr-reel__whatsapp-icon {
	display: flex;
}

.plmr-empty {
	text-align: center;
	padding: 40px 16px;
	color: #666;
}

/* الصفحة المستقلة /reels/: نمنع أي هوامش افتراضية من المتصفح. */
body.plmr-fullpage-body {
	margin: 0;
	padding: 0;
	background: #000;
	overscroll-behavior: none;
}

@media (min-width: 900px) {
	/* على الشاشات الكبيرة نحصر عرض العمود مثل تجربة الجوال، مع خلفية داكنة حوله. */
	.plmr-feed {
		max-width: 480px;
		margin: 0 auto;
		box-shadow: 0 0 40px rgba(0, 0, 0, 0.5);
	}
	body.plmr-fullpage-body {
		background: #111;
	}
}

/* زر الصوت: فوق الطبقة الشفافة (z-index 2) حتى يستقبل الضغطة، ومنتصف الأعلى لأنه المكان الفارغ. */
.plmr-reel__sound {
	position: absolute;
	top: max(16px, env(safe-area-inset-top));
	left: 50%;
	transform: translateX(-50%);
	z-index: 4;
	display: flex;
	align-items: center;
	gap: 6px;
	padding: 9px 14px;
	border: 0;
	border-radius: 999px;
	background: rgba(0, 0, 0, 0.6);
	color: #fff;
	font-size: 13px;
	font-weight: 700;
	line-height: 1;
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
}
.plmr-reel__sound .plmr-ico-on { display: none; }
.plmr-sound-on .plmr-reel__sound .plmr-ico-on { display: block; }
.plmr-sound-on .plmr-reel__sound .plmr-ico-muted { display: none; }
/* عند تشغيل الصوت نُخفي النص ونُبقي الأيقونة فقط. */
.plmr-sound-on .plmr-reel__sound-label { display: none; }

/* الصورة تُعرض كاملة داخل الشاشة (بدون قص) على خلفية سوداء. */
.plmr-reel__img {
	object-fit: contain;
}

/* تنبيه لطيف على زر الصوت عندما يكون الفيديو مكتوماً. */
/* النبضة تحرّك transform و opacity فقط (تُنفَّذ على كرت الرسوميات دون إعادة رسم). */
@keyframes plmr-pulse {
	0%   { transform: scale(1);    opacity: 0.6; }
	70%, 100% { transform: scale(1.35); opacity: 0; }
}
.plmr-reel__sound::after,
.plmr-gate::after {
	content: '';
	position: absolute;
	inset: 0;
	border-radius: inherit;
	border: 2px solid rgba(255, 255, 255, 0.75);
	opacity: 0;
	pointer-events: none;
}
html:not(.plmr-sound-on) .plmr-reel__sound::after {
	animation: plmr-pulse 1.8s ease-out infinite;
}

/* زر "اضغط لتشغيل الصوت" في الصفحة المستقلة: يظهر حتى أول ضغطة من المستخدم. */
.plmr-gate {
	position: fixed;
	left: 50%;
	bottom: 24%;
	transform: translateX(-50%);
	z-index: 10;
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 14px 22px;
	border: 0;
	border-radius: 999px;
	background: #fff;
	color: #111;
	font-size: 16px;
	font-weight: 800;
	box-shadow: 0 6px 24px rgba(0, 0, 0, 0.45);
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
}
.plmr-gate::after { animation: plmr-pulse 1.8s ease-out infinite; }
.plmr-gate[hidden] { display: none; }

/* زر المشاركة: منتصف الجهة اليسرى (الفارغة)، فوق الطبقة الشفافة ليستقبل الضغطة. */
.plmr-reel__share {
	position: absolute;
	top: 42%;
	inset-inline-end: 14px;
	z-index: 4;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 46px;
	height: 46px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(0, 0, 0, 0.55);
	color: #fff;
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
}

/* رسالة صغيرة مؤقتة (مثل: تم نسخ الرابط). */
.plmr-toast {
	position: fixed;
	left: 50%;
	bottom: 12%;
	transform: translateX(-50%);
	z-index: 20;
	padding: 10px 18px;
	border-radius: 999px;
	background: rgba(0, 0, 0, 0.82);
	color: #fff;
	font-size: 14px;
	font-weight: 700;
	pointer-events: none;
}

/* تلميح "اسحب للأعلى" (1.3.0): أول زيارة فقط، ويزول عند أول تمرير. لا يستقبل أي ضغطة. */
.plmr-hint {
	position: fixed;
	left: 50%;
	bottom: 11%;
	transform: translateX(-50%);
	z-index: 9;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 2px;
	padding: 10px 18px;
	border-radius: 16px;
	background: rgba(0, 0, 0, 0.55);
	color: #fff;
	font-size: 14px;
	font-weight: 700;
	pointer-events: none;
	transition: opacity 0.35s ease;
}
.plmr-hint.is-hiding { opacity: 0; }
.plmr-hint svg { animation: plmr-swipe 1.4s ease-in-out infinite; }
/* تتحرك transform و opacity فقط. */
@keyframes plmr-swipe {
	0%   { transform: translateY(8px);  opacity: 0.2; }
	60%  { transform: translateY(-6px); opacity: 1; }
	100% { transform: translateY(-6px); opacity: 0; }
}

/* زر الأقسام: أعلى اليسار (الزاوية الفارغة)، فوق كل شيء. */
.plmr-filter-btn {
	position: fixed;
	top: max(14px, env(safe-area-inset-top));
	inset-inline-end: 14px;
	z-index: 12;
	display: flex;
	align-items: center;
	gap: 6px;
	padding: 9px 14px;
	border: 0;
	border-radius: 999px;
	background: rgba(0, 0, 0, 0.6);
	color: #fff;
	font-size: 13px;
	font-weight: 700;
	line-height: 1;
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
}
.plmr-filter-btn.is-active { background: #25d366; color: #fff; }

.plmr-filter-sheet {
	position: fixed;
	inset: 0;
	z-index: 30;
	display: flex;
	align-items: flex-end;
	background: rgba(0, 0, 0, 0.55);
}
.plmr-filter-sheet[hidden] { display: none; }
.plmr-filter-sheet__panel {
	width: 100%;
	max-height: 78%;
	overflow-y: auto;
	padding: 16px 16px calc(20px + env(safe-area-inset-bottom));
	border-radius: 18px 18px 0 0;
	background: #fff;
	color: #111;
}
.plmr-filter-sheet__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 10px;
	font-size: 16px;
}
.plmr-filter-sheet__close {
	border: 0;
	background: none;
	font-size: 28px;
	line-height: 1;
	color: #444;
	cursor: pointer;
}
.plmr-filter-group { margin-top: 14px; }
.plmr-filter-group__title { margin-bottom: 8px; font-size: 13px; font-weight: 800; color: #555; }
.plmr-filter-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.plmr-chip {
	display: inline-block;
	padding: 8px 14px;
	border-radius: 999px;
	background: #f0f2f5;
	color: #111;
	font-size: 14px;
	text-decoration: none;
}
.plmr-chip small { color: #777; }
.plmr-chip.is-active { background: #111; color: #fff; }
.plmr-chip.is-active small { color: #ddd; }

.plmr-empty { padding: 40px 20px; text-align: center; color: #fff; }
.plmr-empty a { color: #25d366; }

/* احترام إعداد "تقليل الحركة" في جهاز الزائر. */
@media (prefers-reduced-motion: reduce) {
	.plmr-feed { scroll-behavior: auto; }
	.plmr-reel__sound::after,
	.plmr-gate::after { animation: none; }
	.plmr-reel__poster { transition: none; }
	.plmr-hint svg { animation: none; }
	.plmr-hint { transition: none; }
}
