/**
 * Block Style: Home Videos (المكتبة المرئية: بطاقات مقاطع ونافذة تشغيل منبثقة)
 */

.videos-section {
	background: transparent !important;
	padding: 70px 0;
}

.videos-section .section-header {
	margin-bottom: 45px;
}

.videos-section .section-badge-wrapper {
	display: block;
	margin-bottom: 14px;
}

/* الشارة العليا تأخذ خلفية من اللون الرئيسي ولون الخط الثانوي، كبقية الأقسام */
.videos-section .section-badge {
	display: inline-flex;
	align-items: center;
	background: rgba(var(--theme-primary-rgb), 0.12) !important;
	color: var(--theme-text-light) !important;
	padding: 6px 18px;
	border-radius: 50px;
	font-weight: 700;
	font-size: 0.88rem;
}

.videos-section .section-title {
	color: var(--theme-text-dark) !important;
	font-weight: 800;
	font-size: 2.1rem;
	margin-bottom: 0;
	line-height: 1.4;
	max-width: 800px;
	margin-left: auto;
	margin-right: auto;
}

/* السلايدر */
.videos-swiper {
	padding: 10px 4px 45px !important;
	overflow: hidden;
}

.videos-swiper .swiper-wrapper {
	align-items: stretch !important;
}

.videos-swiper .swiper-slide {
	height: auto !important;
	display: flex !important;
	flex-direction: column !important;
}

.videos-slider-pagination {
	display: flex;
	justify-content: center;
	align-items: center;
	gap: 6px;
	margin-top: 36px !important;
	padding-top: 10px !important;
	position: relative !important;
}

.videos-slider-pagination .swiper-pagination-bullet {
	width: 10px;
	height: 10px;
	border-radius: 50px;
	background: rgba(var(--theme-primary-rgb), 0.25);
	opacity: 1;
	transition: all 0.3s ease;
}

.videos-slider-pagination .swiper-pagination-bullet-active {
	width: 32px;
	background: var(--theme-primary) !important;
	box-shadow: 0 2px 8px rgba(var(--theme-primary-rgb), 0.4);
}

/* بطاقة المقطع: زر (أو رابط) يملأ الشريحة */
.video-card {
	display: flex;
	flex: 1;
	flex-direction: column;
	width: 100%;
	padding: 0;
	border: 1px solid rgba(var(--theme-primary-rgb), 0.08);
	border-radius: 18px;
	background: var(--theme-bg-white, #fff);
	box-shadow: 0 6px 22px rgba(15, 23, 42, 0.06);
	overflow: hidden;
	font: inherit;
	text-align: start;
	color: inherit;
	text-decoration: none;
	cursor: pointer;
	transition: transform 0.35s ease, box-shadow 0.35s ease;
}

.video-card:hover,
.video-card:focus-visible {
	transform: translateY(-5px);
	box-shadow: var(--theme-shadow-hover, 0 18px 36px rgba(15, 23, 42, 0.12));
}

.video-card:focus-visible {
	outline: 3px solid rgba(var(--theme-secondary-rgb), 0.6);
	outline-offset: 3px;
}

.video-thumb {
	position: relative;
	display: block;
	aspect-ratio: 16 / 9;
	background: linear-gradient(135deg, var(--theme-primary), rgba(var(--theme-primary-rgb), 0.7));
	overflow: hidden;
}

.video-thumb img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.5s ease;
}

.video-card:hover .video-thumb img {
	transform: scale(1.05);
}

/* تعتيم خفيف فوق الصورة ليبرز زر التشغيل */
.video-thumb::after {
	content: '';
	position: absolute;
	inset: 0;
	background: rgba(15, 23, 42, 0.18);
	transition: background 0.35s ease;
}

.video-card:hover .video-thumb::after {
	background: rgba(15, 23, 42, 0.32);
}

.video-play {
	position: absolute;
	top: 50%;
	left: 50%;
	z-index: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 62px;
	height: 62px;
	margin: -31px 0 0 -31px;
	padding-left: 4px; /* توسيط المثلث بصرياً */
	border-radius: 50%;
	background: var(--theme-secondary);
	color: #fff;
	box-shadow: 0 0 0 8px rgba(var(--theme-secondary-rgb), 0.28);
	transition: transform 0.35s ease, box-shadow 0.35s ease;
}

.video-card:hover .video-play {
	transform: scale(1.1);
	box-shadow: 0 0 0 12px rgba(var(--theme-secondary-rgb), 0.22);
}

.video-title {
	display: -webkit-box;
	margin: 0;
	padding: 16px 18px 18px;
	overflow: hidden;
	color: var(--theme-heading, var(--theme-text-dark));
	font-size: 1.05rem;
	font-weight: 700;
	line-height: 1.55;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
}

/* زر «استعرض كل المقاطع» أسفل قسم الرئيسية */
.videos-all-wrapper {
	margin-top: 45px;
}

.btn-videos-all {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	padding: 12px 30px;
	border-radius: 50px;
	border: 2px solid var(--theme-primary) !important;
	background: transparent;
	color: var(--theme-primary) !important;
	font-weight: 800;
	font-size: 0.98rem;
	text-decoration: none !important;
	transition: all 0.3s ease;
}

.btn-videos-all:hover {
	background: var(--theme-primary) !important;
	color: #ffffff !important;
	box-shadow: 0 8px 24px rgba(var(--theme-primary-rgb), 0.25);
}

/* صفحة المكتبة المرئية: شبكة بطاقات بنفس تصميم بطاقة الرئيسية */
.videos-archive {
	padding: 40px 15px 80px;
}

/* شريط البحث أعلى الصفحة (بنفس تصميم شريط الأخبار) */
.videos-filter-bar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 20px;
	margin-bottom: 35px;
	padding: 22px 28px;
	border: 1px solid var(--theme-border-color, #e2e8f0);
	border-radius: var(--theme-radius-lg, 20px);
	background: #ffffff;
	box-shadow: var(--theme-shadow-sm, 0 4px 14px rgba(0, 0, 0, 0.04));
}

.videos-pill {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 8px 20px;
	border: 1.5px solid var(--theme-border-color, #e2e8f0);
	border-radius: 50px;
	background: var(--theme-bg-light, #f8fafc);
	color: var(--theme-text-dark, #0f172a);
	font-size: 0.9rem;
	font-weight: 700;
	text-decoration: none !important;
	transition: all 0.25s ease;
}

.videos-pill:hover,
.videos-pill.active {
	border-color: var(--theme-primary);
	background: var(--theme-primary);
	color: #ffffff !important;
	box-shadow: 0 4px 14px rgba(var(--theme-primary-rgb), 0.22);
}

.videos-pill__count {
	padding: 2px 8px;
	border-radius: 12px;
	background: rgba(0, 0, 0, 0.08);
	font-size: 0.78rem;
}

.videos-pill.active .videos-pill__count {
	background: rgba(255, 255, 255, 0.25);
}

.videos-search {
	display: flex;
	align-items: center;
	gap: 10px;
	width: 100%;
	max-width: 340px;
}

.videos-search__field {
	position: relative;
	flex: 1;
}

.videos-search__input {
	width: 100%;
	padding: 10px 42px 10px 16px;
	border: 1.5px solid var(--theme-border-color, #e2e8f0);
	border-radius: 50px;
	background: #ffffff;
	font-family: inherit;
	font-size: 0.9rem;
	outline: none;
	transition: border-color 0.2s ease;
}

.videos-search__input:focus {
	border-color: var(--theme-primary);
}

.videos-search__icon {
	position: absolute;
	top: 50%;
	right: 14px;
	display: flex;
	color: var(--theme-text-light);
	transform: translateY(-50%);
	pointer-events: none;
}

.videos-search__btn {
	padding: 10px 22px;
	border: none;
	border-radius: 50px;
	background: var(--theme-primary);
	color: #ffffff;
	font-family: inherit;
	font-size: 0.9rem;
	font-weight: 700;
	white-space: nowrap;
	cursor: pointer;
	transition: box-shadow 0.25s ease;
}

.videos-search__btn:hover,
.videos-search__btn:focus-visible {
	box-shadow: 0 4px 14px rgba(var(--theme-primary-rgb), 0.3);
}

.videos-search-summary {
	margin: -15px 0 22px;
	color: var(--theme-text-light);
	font-size: 0.95rem;
	font-weight: 600;
}

.videos-empty__back {
	margin-top: 20px;
}

@media (max-width: 640px) {
	.videos-filter-bar {
		padding: 18px;
	}

	.videos-search {
		max-width: none;
	}
}

.videos-grid {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 28px;
	align-items: stretch;
}

.videos-archive__pagination {
	margin-top: 50px;
}

.videos-empty {
	padding: 70px 20px;
	border: 2px dashed var(--theme-border-color, #cbd5e1);
	border-radius: var(--theme-radius-lg, 20px);
	background: #ffffff;
	text-align: center;
}

.videos-empty__icon {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 70px;
	height: 70px;
	margin: 0 auto 18px;
	border-radius: 50%;
	background: rgba(var(--theme-primary-rgb), 0.08);
	color: var(--theme-primary);
}

.videos-empty__title {
	margin: 0 0 8px;
	color: var(--theme-text-dark);
	font-size: 1.25rem;
	font-weight: 800;
}

.videos-empty__text {
	margin: 0;
	color: var(--theme-text-light);
	font-size: 0.95rem;
}

@media (max-width: 1024px) {
	.videos-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 22px;
	}
}

@media (max-width: 640px) {
	.videos-grid {
		grid-template-columns: minmax(0, 1fr);
	}
}

/* نافذة التشغيل المنبثقة */
.video-modal {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
}

.video-modal[hidden] {
	display: none;
}

.video-modal__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(15, 23, 42, 0.82);
}

.video-modal__box {
	position: relative;
	width: min(960px, 100%);
}

.video-modal__frame {
	aspect-ratio: 16 / 9;
	border-radius: 14px;
	background: #000;
	overflow: hidden;
	box-shadow: 0 25px 60px rgba(0, 0, 0, 0.45);
}

.video-modal__frame iframe {
	display: block;
	width: 100%;
	height: 100%;
	border: 0;
}

.video-modal__close {
	position: absolute;
	top: -48px;
	inset-inline-end: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.15);
	color: #fff;
	cursor: pointer;
	transition: background 0.25s ease;
}

.video-modal__close:hover,
.video-modal__close:focus-visible {
	background: var(--theme-secondary);
}

body.video-modal-open {
	overflow: hidden;
}

@media (max-width: 768px) {
	.videos-section .section-title {
		font-size: 1.6rem;
	}
}

@media (prefers-reduced-motion: reduce) {
	.video-card,
	.video-thumb img,
	.video-play {
		transition: none;
	}
}
