/* ویدئو آپارات */
.sfr-ap {
	--ap-accent: #f37021;
	--ap-card: #fff;
	--ap-cols: 3;
	--ap-gap: 22px;
	--ap-radius: 18px;
	--ap-ratio: 16 / 9;
	--ap-shade: .2;
	--ap-play: 68px;
	position: relative;
	direction: rtl;
	box-sizing: border-box;
}
.sfr-ap *, .sfr-ap *::before, .sfr-ap *::after { box-sizing: border-box; }

.sfr-ap-track {
	display: grid;
	grid-template-columns: repeat(var(--ap-cols), minmax(0, 1fr));
	gap: var(--ap-gap);
}
.sfr-ap-featured .sfr-ap-item:first-child { grid-column: 1 / -1; }
.sfr-ap-featured .sfr-ap-item:first-child .sfr-ap-title { font-size: 1.3em; }

/* اسلایدر */
.sfr-ap-carousel .sfr-ap-track {
	display: flex;
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	scroll-behavior: smooth;
	scrollbar-width: none;
	padding: 4px 2px 14px;
	overscroll-behavior-x: contain;
}
.sfr-ap-carousel .sfr-ap-track::-webkit-scrollbar { display: none; }
.sfr-ap-carousel .sfr-ap-item {
	flex: 0 0 calc((100% - (var(--ap-cols) - 1) * var(--ap-gap)) / var(--ap-cols));
	scroll-snap-align: start;
}
.sfr-ap-nav {
	position: absolute;
	top: calc(50% - 30px);
	z-index: 3;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: #fff;
	color: #1b2537;
	box-shadow: 0 6px 20px rgba(15, 23, 42, .18);
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	transition: transform .2s, opacity .2s, background .2s, color .2s;
}
.sfr-ap-nav:hover { background: var(--ap-accent); color: #fff; }
.sfr-ap-nav:focus-visible { outline: 3px solid var(--ap-accent); outline-offset: 2px; }
.sfr-ap-nav[disabled] { opacity: 0; pointer-events: none; }
.sfr-ap-prev { right: -14px; }
.sfr-ap-next { left: -14px; }

/* کارت */
.sfr-ap-item {
	position: relative;
	display: flex;
	flex-direction: column;
	background: var(--ap-card);
	border-radius: var(--ap-radius);
	overflow: hidden;
	box-shadow: 0 10px 30px rgba(15, 23, 42, .08);
	transition: transform .25s ease, box-shadow .25s ease;
	min-width: 0;
}
.sfr-ap-hover-yes .sfr-ap-item:hover { transform: translateY(-4px); box-shadow: 0 18px 40px rgba(15, 23, 42, .14); }
.sfr-ap-style-plain .sfr-ap-item { background: transparent; box-shadow: none; overflow: visible; }
.sfr-ap-style-plain .sfr-ap-media { border-radius: var(--ap-radius); }
.sfr-ap-style-plain .sfr-ap-body { padding-inline: 2px; }

.sfr-ap-media {
	position: relative;
	aspect-ratio: var(--ap-ratio);
	background: #0f172a;
	overflow: hidden;
}
.sfr-ap-media iframe {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	border: 0;
	display: block;
}
.sfr-ap-play {
	all: unset;
	position: absolute;
	inset: 0;
	display: block;
	cursor: pointer;
	overflow: hidden;
}
.sfr-ap-play:focus-visible { outline: 3px solid var(--ap-accent); outline-offset: -3px; }
.sfr-ap-cover {
	position: absolute;
	inset: 0;
	width: 100% !important;
	height: 100% !important;
	max-width: none !important;
	object-fit: cover;
	display: block;
	margin: 0 !important;
	border-radius: 0 !important;
	transition: transform .6s ease;
}
.sfr-ap-hover-yes .sfr-ap-play:hover .sfr-ap-cover { transform: scale(1.06); }
.sfr-ap-noimg {
	background:
		radial-gradient(circle at 75% 25%, color-mix(in srgb, var(--ap-accent) 55%, transparent), transparent 60%),
		linear-gradient(135deg, #1b2537, #0f172a);
}
.sfr-ap-shade {
	position: absolute;
	inset: 0;
	background: linear-gradient(to top, rgba(0, 0, 0, calc(var(--ap-shade) + .25)), rgba(0, 0, 0, var(--ap-shade)) 55%);
	transition: background .3s;
}
.sfr-ap-btn {
	position: absolute;
	top: 50%;
	left: 50%;
	width: var(--ap-play);
	height: var(--ap-play);
	margin: calc(var(--ap-play) / -2) 0 0 calc(var(--ap-play) / -2);
	border-radius: 50%;
	background: var(--ap-accent);
	color: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 0 0 0 color-mix(in srgb, var(--ap-accent) 55%, transparent), 0 10px 26px rgba(0, 0, 0, .3);
	transition: transform .25s ease;
	animation: sfr-ap-pulse 2.4s infinite;
}
.sfr-ap-btn svg { width: 42%; height: 42%; margin-left: 8%; }
.sfr-ap-play:hover .sfr-ap-btn { transform: scale(1.1); }
@keyframes sfr-ap-pulse {
	0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ap-accent) 50%, transparent), 0 10px 26px rgba(0, 0, 0, .3); }
	70% { box-shadow: 0 0 0 18px transparent, 0 10px 26px rgba(0, 0, 0, .3); }
	100% { box-shadow: 0 0 0 0 transparent, 0 10px 26px rgba(0, 0, 0, .3); }
}
.sfr-ap-dur {
	position: absolute;
	bottom: 10px;
	left: 10px;
	padding: 3px 9px;
	border-radius: 8px;
	background: rgba(0, 0, 0, .7);
	color: #fff;
	font-size: 12px;
	font-weight: 600;
	line-height: 1.6;
	direction: ltr;
	font-variant-numeric: tabular-nums;
}

.sfr-ap-body { padding: 14px 18px 18px; }
.sfr-ap-title {
	margin: 0;
	font-size: 16px;
	font-weight: 700;
	line-height: 1.7;
	color: #1b2537;
}
.sfr-ap-desc {
	margin: 6px 0 0;
	font-size: 13.5px;
	line-height: 1.9;
	color: #6b7280;
}
.sfr-ap-link {
	display: inline-block;
	margin-top: 8px;
	font-size: 13px;
	font-weight: 700;
	color: var(--ap-accent);
	text-decoration: none;
}
.sfr-ap-link:hover { text-decoration: underline; }

/* عنوان روی تصویر */
.sfr-ap-style-overlay .sfr-ap-item { display: block; }
.sfr-ap-style-overlay .sfr-ap-body {
	position: absolute;
	right: 0;
	left: 0;
	bottom: 0;
	padding: 40px 18px 16px;
	background: linear-gradient(to top, rgba(0, 0, 0, .78), transparent);
	pointer-events: none;
}
.sfr-ap-style-overlay .sfr-ap-link { pointer-events: auto; }
.sfr-ap-style-overlay .sfr-ap-title { color: #fff; }
.sfr-ap-style-overlay .sfr-ap-desc { color: rgba(255, 255, 255, .82); }
.sfr-ap-style-overlay .sfr-ap-dur { top: 10px; bottom: auto; }
.sfr-ap-style-overlay .sfr-ap-item.is-playing .sfr-ap-body { display: none; }

/* پخش در همان کادر */
.sfr-ap-item.is-playing .sfr-ap-media { background: #000; }

/* لایت‌باکس */
.sfr-ap-modal {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 24px;
	background: rgba(8, 12, 22, .88);
	opacity: 0;
	transition: opacity .25s ease;
	direction: rtl;
}
.sfr-ap-modal.open { opacity: 1; }
.sfr-ap-modal-box {
	position: relative;
	width: min(1100px, 100%);
	transform: scale(.96);
	transition: transform .25s ease;
}
.sfr-ap-modal.open .sfr-ap-modal-box { transform: none; }
.sfr-ap-modal-frame {
	position: relative;
	aspect-ratio: 16 / 9;
	max-height: calc(100vh - 120px);
	margin: 0 auto;
	border-radius: 16px;
	overflow: hidden;
	background: #000;
	box-shadow: 0 30px 80px rgba(0, 0, 0, .5);
}
.sfr-ap-modal-frame.vertical { aspect-ratio: 9 / 16; width: auto; height: calc(100vh - 120px); }
.sfr-ap-modal-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.sfr-ap-modal-title {
	margin: 12px 4px 0;
	color: #fff;
	font-size: 15px;
	font-weight: 700;
	text-align: center;
}
.sfr-ap-close {
	position: absolute;
	top: -52px;
	left: 0;
	width: 42px;
	height: 42px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, .14);
	color: #fff;
	font-size: 26px;
	line-height: 42px;
	cursor: pointer;
	transition: background .2s;
}
.sfr-ap-close:hover, .sfr-ap-close:focus-visible { background: rgba(255, 255, 255, .3); outline: none; }
html.sfr-ap-lock { overflow: hidden; }

.sfr-ap-empty {
	padding: 26px;
	border: 2px dashed #d1d5db;
	border-radius: 14px;
	color: #6b7280;
	text-align: center;
	font-size: 14px;
}

@media (max-width: 767px) {
	.sfr-ap-prev { right: 4px; }
	.sfr-ap-next { left: 4px; }
	.sfr-ap-nav { width: 38px; height: 38px; }
	.sfr-ap-carousel .sfr-ap-item { flex-basis: 84%; }
	.sfr-ap-modal { padding: 12px; }
	.sfr-ap-close { top: -50px; }
}
@media (prefers-reduced-motion: reduce) {
	.sfr-ap-btn { animation: none; }
	.sfr-ap-cover, .sfr-ap-item, .sfr-ap-modal, .sfr-ap-modal-box { transition: none; }
	.sfr-ap-carousel .sfr-ap-track { scroll-behavior: auto; }
}
