/* لودر انتقال بین صفحات */
.cspwa-page-loader {
	position: fixed !important;
	inset: 0 !important;
	background: rgba(10,10,14,0.75);
	backdrop-filter: blur(2px);
	z-index: 9999999 !important;
	display: flex;
	align-items: center;
	justify-content: center;
	opacity: 0;
	visibility: hidden;
	transition: opacity 150ms ease;
	pointer-events: none;
}
.cspwa-page-loader.is-visible {
	opacity: 1;
	visibility: visible;
	pointer-events: all;
}
.cspwa-page-loader-spinner {
	width: 42px;
	height: 42px;
	border: 3px solid rgba(255,255,255,0.2);
	border-top-color: #e50914;
	border-radius: 50%;
	animation: cspwa-spin 0.7s linear infinite;
}
@keyframes cspwa-spin {
	to { transform: rotate(360deg); }
}

/* منوی پایین (Bottom Navigation) */
.cspwa-bottom-nav {
	position: fixed !important;
	bottom: 0 !important;
	top: auto !important;
	right: 0;
	left: 0;
	z-index: 99999 !important;
	background: #14141a;
	border-top: 1px solid rgba(255,255,255,0.08);
	display: flex;
	justify-content: space-around;
	align-items: center;
	padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
	direction: rtl;
	margin: 0;
}

.cspwa-nav-item {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 3px;
	color: #9a9aa5;
	text-decoration: none !important;
	font-size: 11px;
	flex: 1;
	padding: 4px 2px;
	border-radius: 10px;
	transition: color .2s, background .2s;
}

.cspwa-nav-item svg {
	width: 22px;
	height: 22px;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.8;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.cspwa-nav-item.is-active {
	color: #ffffff;
}

.cspwa-nav-item:hover {
	color: #ffffff;
}

body.cspwa-has-bottom-nav {
	padding-bottom: 62px;
}

/* حالت تلویزیون - فوکوس واضح برای ریموت */
.cspwa-tv-ready .cspwa-nav-item:focus {
	outline: 3px solid #e50914;
	outline-offset: 2px;
	background: rgba(255,255,255,0.08);
}

/* دکمه نصب */
.cspwa-install-btn {
	position: fixed !important;
	z-index: 99998 !important;
	bottom: 80px !important;
	top: auto !important;
	display: none !important;
	align-items: center !important;
	gap: 8px;
	background: #e50914 !important;
	color: #fff !important;
	border: none !important;
	padding: 10px 18px !important;
	border-radius: 30px !important;
	font-size: 14px;
	cursor: pointer !important;
	box-shadow: 0 4px 14px rgba(0,0,0,0.3);
	margin: 0 !important;
	line-height: 1.2 !important;
}
/* فقط با افزودن این کلاس توسط جاوااسکریپت نمایش داده می‌شود - نه به‌صورت پیش‌فرض */
.cspwa-install-btn.cspwa-visible {
	display: flex !important;
}
#cspwa-install-btn.cspwa-pos-bottom-right { right: 16px !important; left: auto !important; }
#cspwa-install-btn.cspwa-pos-bottom-left { left: 16px !important; right: auto !important; }
#cspwa-install-btn.cspwa-pos-bottom-center { left: 50% !important; transform: translateX(-50%); }

/* دکمه برگشت شناور */
.cspwa-back-btn {
	position: fixed !important;
	top: 14px !important;
	bottom: auto !important;
	z-index: 999997 !important;
	width: 42px !important;
	height: 42px !important;
	border-radius: 50% !important;
	background: rgba(20,20,26,0.75) !important;
	backdrop-filter: blur(4px);
	color: #fff !important;
	border: 1px solid rgba(255,255,255,0.15) !important;
	display: flex !important;
	align-items: center !important;
	justify-content: center !important;
	cursor: pointer !important;
	box-shadow: 0 2px 10px rgba(0,0,0,0.25);
	margin: 0 !important;
	padding: 0 !important;
	line-height: 1 !important;
}
#cspwa-back-btn.cspwa-back-top-right { right: 14px !important; left: auto !important; }
#cspwa-back-btn.cspwa-back-top-right svg { transform: rotate(180deg); } /* در سمت راست، فلش رو به راست باز می‌شود */
#cspwa-back-btn.cspwa-back-top-left { left: 14px !important; right: auto !important; }

/* دکمه پخش با پلیر خارجی - کنار تب‌های کیفیت */
.cspwa-ext-player-trigger {
	cursor: pointer !important;
	position: relative;
}
.cspwa-ext-player-trigger .server {
	display: inline-flex !important;
	align-items: center;
	gap: 4px;
}
.cspwa-ext-player-trigger .server::before {
	content: "▶";
	font-size: 10px;
}

.cspwa-ext-player-popup {
	position: fixed !important;
	inset: 0 !important;
	background: rgba(0,0,0,0.65);
	z-index: 999996 !important;
	display: none;
	align-items: center;
	justify-content: center;
	padding: 16px;
}
.cspwa-ext-player-popup.is-open {
	display: flex !important;
}
.cspwa-ext-player-popup-inner {
	background: #1c1c22;
	color: #fff;
	width: 100%;
	max-width: 420px;
	border-radius: 14px;
	padding: 22px;
	position: relative;
	direction: rtl;
	max-height: 80vh;
	overflow-y: auto;
}
.cspwa-ext-player-popup-inner h4 {
	margin: 0 0 14px;
	font-size: 16px;
}
.cspwa-ext-player-popup-inner ul {
	list-style: none;
	margin: 0;
	padding: 0;
}
.cspwa-ext-player-popup-inner ul li {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	padding: 10px 0;
	border-bottom: 1px solid rgba(255,255,255,0.08);
	flex-wrap: wrap;
}
.cspwa-ext-quality-label {
	font-size: 13px;
	color: #ddd;
}
.cspwa-ext-player-actions {
	display: flex;
	gap: 8px;
}
.cspwa-ext-player-actions a {
	font-size: 12px;
	background: rgba(255,255,255,0.08);
	color: #fff !important;
	padding: 6px 10px;
	border-radius: 6px;
	text-decoration: none !important;
	white-space: nowrap;
}
.cspwa-ext-player-actions a.cspwa-ext-open {
	background: #e50914;
}
.cspwa-ext-hint {
	font-size: 11px;
	color: #999;
	margin-top: 14px;
	line-height: 1.7;
}
.cspwa-ext-status {
	width: 100%;
	font-size: 11px;
	color: #f5b942;
	margin-top: 6px;
	line-height: 1.8;
}
.cspwa-ext-manual-open {
	display: inline-block;
	margin-top: 4px;
	color: #fff !important;
	background: rgba(255,255,255,0.12);
	padding: 5px 10px;
	border-radius: 6px;
	font-size: 11px;
	text-decoration: none !important;
}
.cspwa-ext-close {
	position: absolute;
	top: 10px;
	left: 12px;
	background: none;
	border: none;
	color: #aaa;
	font-size: 22px;
	cursor: pointer;
}

/* پنهان‌سازی گزینه دانلود از کنترل‌های پیش‌فرض ویدیو (پشتیبان CSS برای controlsList) */
body.cspwa-hide-video-dl video::-internal-media-controls-download-button {
	display: none !important;
}
body.cspwa-hide-video-dl video::-webkit-media-controls-enclosure {
	overflow: hidden !important;
}

/* مودال راهنمای iOS */
.cspwa-ios-modal {
	position: fixed;
	inset: 0;
	background: rgba(0,0,0,0.6);
	z-index: 999999;
	display: flex;
	align-items: flex-end;
	justify-content: center;
}
.cspwa-ios-modal-content {
	background: #1c1c22;
	color: #fff;
	width: 100%;
	max-width: 480px;
	border-radius: 16px 16px 0 0;
	padding: 24px;
	position: relative;
	direction: rtl;
}
.cspwa-ios-modal-content ol {
	padding-right: 20px;
	line-height: 2;
}
.cspwa-ios-close {
	position: absolute;
	top: 12px;
	left: 16px;
	background: none;
	border: none;
	color: #aaa;
	font-size: 22px;
	cursor: pointer;
}
