/* Video Tutorials Gallery 2.0 */
:root, .yvt-wrap {
	--yvt-navy: #1a2744;
	--yvt-navy-dk: #080e1a;
	--yvt-surface: #131e30;
	--yvt-border: #1e2e47;
	--yvt-gold: #DDB913;
	--yvt-gold-lt: #f0d040;
	--yvt-teal: #6EC1E4;
	--yvt-text: #dde6f0;
	--yvt-muted: #6e849e;
}

.yvt-wrap {
	position: relative;
	max-width: 1200px;
	margin: 0 auto;
	padding: 32px 16px;
	direction: rtl;
	box-sizing: border-box;
}

/* תווית גרסה קטנה בפינה, כדי לדעת איזו גרסה רצה באתר */
.yvt-version {
	position: absolute;
	top: 8px;
	left: 16px;
	color: var(--yvt-muted);
	font-size: 11px;
	line-height: 1;
	letter-spacing: .02em;
	opacity: .8;
	user-select: all;
}

.yvt-wrap *, .yvt-wrap *::before, .yvt-wrap *::after,
.yvt-modal *, .yvt-modal *::before, .yvt-modal *::after,
.yvt-share-menu *, .yvt-share-menu *::before, .yvt-share-menu *::after {
	box-sizing: border-box;
}

/* מונע מ-display של הרכיבים "לנצח" את תכונת hidden (הבאג מגרסה 1.0.2) */
.yvt-wrap [hidden], .yvt-modal [hidden], .yvt-share-menu [hidden] { display: none !important; }

.yvt-title {
	color: var(--yvt-gold);
	font-size: 28px;
	font-weight: 700;
	text-align: center;
	margin: 0 0 28px;
}

.yvt-empty { text-align: center; color: var(--yvt-muted); }

.yvt-subtitle {
	text-align: center;
	color: var(--yvt-text);
	font-size: 15px;
	line-height: 1.65;
	max-width: 720px;
	margin: 0 auto 32px;
	opacity: .85;
}

/* ---------- סינון לפי נושא ---------- */
.yvt-filters {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 8px;
	margin: 0 0 22px;
}
.yvt-wrap .yvt-chip {
	min-height: 0;
	margin: 0;
	padding: 8px 16px;
	border: 1px solid var(--yvt-border);
	border-radius: 999px;
	background: var(--yvt-surface);
	color: var(--yvt-text);
	box-shadow: none;
	font: inherit;
	font-size: 14px;
	font-weight: 600;
	line-height: 1.2;
	text-transform: none;
	letter-spacing: normal;
	cursor: pointer;
	transition: background .15s, border-color .15s, color .15s;
}
.yvt-wrap .yvt-chip:hover { border-color: var(--yvt-gold); }
.yvt-wrap .yvt-chip:focus-visible { outline: 2px solid var(--yvt-teal); outline-offset: 2px; }
.yvt-wrap .yvt-chip[aria-pressed="true"] { background: var(--yvt-gold); border-color: var(--yvt-gold); color: var(--yvt-navy-dk); }

/* ---------- גלריה ---------- */
.yvt-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
	gap: 20px;
}

.yvt-card {
	position: relative;
	background: var(--yvt-surface);
	border: 1px solid var(--yvt-border);
	border-radius: 12px;
	overflow: hidden;
	transition: border-color .2s, transform .2s;
}
.yvt-card:hover, .yvt-card:focus-within { border-color: var(--yvt-gold); transform: translateY(-3px); }

.yvt-wrap .yvt-card-main {
	display: block;
	width: 100%;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	background: none;
	box-shadow: none;
	color: var(--yvt-text);
	font: inherit;
	text-align: right;
	text-transform: none;
	letter-spacing: normal;
	cursor: pointer;
}
.yvt-wrap .yvt-card-main:focus-visible { outline: 2px solid var(--yvt-gold); outline-offset: -2px; }

.yvt-thumb {
	position: relative;
	display: block;
	aspect-ratio: 16 / 9;
	background: var(--yvt-navy-dk);
}
.yvt-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

.yvt-play {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 40px;
	color: var(--yvt-gold);
	background: rgba(8, 14, 26, .25);
	opacity: 0;
	transition: opacity .2s;
}
.yvt-card:hover .yvt-play, .yvt-card-main:focus-visible .yvt-play { opacity: 1; }

.yvt-num {
	position: absolute;
	top: 8px;
	right: 8px;
	background: var(--yvt-gold);
	color: var(--yvt-navy-dk);
	font-size: 12px;
	font-weight: 700;
	padding: 2px 8px;
	border-radius: 999px;
}

.yvt-duration {
	position: absolute;
	left: 8px;
	bottom: 8px;
	background: rgba(8, 14, 26, .85);
	color: var(--yvt-teal);
	font-size: 12px;
	padding: 2px 6px;
	border-radius: 4px;
}

.yvt-card-title {
	display: block;
	padding: 12px 14px;
	font-size: 15px;
	line-height: 1.4;
}

.yvt-card-views {
	display: flex;
	align-items: center;
	gap: 5px;
	padding: 0 14px 12px;
	margin-top: -4px;
	color: var(--yvt-muted);
	font-size: 12.5px;
}
.yvt-card-views svg { flex: none; }

.yvt-wrap .yvt-card-share {
	position: absolute;
	top: 8px;
	left: 8px;
	width: 34px;
	height: 34px;
	min-height: 0;
	padding: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	border: 0;
	border-radius: 50%;
	background: rgba(8, 14, 26, .8);
	color: var(--yvt-gold);
	box-shadow: none;
	cursor: pointer;
	opacity: .9;
}
.yvt-wrap .yvt-card-share:hover, .yvt-wrap .yvt-card-share:focus-visible { background: var(--yvt-gold); color: var(--yvt-navy-dk); outline: none; }

/* ---------- חלון הנגן ---------- */
body.yvt-lock { overflow: hidden; }

.yvt-modal {
	position: fixed;
	inset: 0;
	z-index: 99990;
	align-items: center;
	justify-content: center;
	overflow-y: auto;
	padding: 16px;
	direction: rtl;
	font-family: inherit;
	color: var(--yvt-text);
}
/* קריטי: בלי :not([hidden]) ה-display:flex "מנצח" את hidden והחלון נשאר מוצג תמיד */
.yvt-modal:not([hidden]) { display: flex; }

.yvt-modal-backdrop {
	position: fixed;
	inset: 0;
	background: rgba(8, 14, 26, .92);
	z-index: 0;
}

.yvt-modal-frame {
	position: relative;
	z-index: 1;
	margin: auto;
	/* הרוחב מוגבל גם לפי הגובה, כדי שהסרטון + כתוביות + כפתורים ייכנסו במסך */
	width: min(96vw, 1040px, calc((100vh - 190px) * 16 / 9));
	min-width: min(96vw, 320px);
	background: var(--yvt-navy);
	border: 1px solid var(--yvt-gold);
	border-radius: 12px;
	padding: 10px;
}

.yvt-modal-header {
	display: flex;
	align-items: center;
	gap: 10px;
	flex-wrap: wrap;
	margin-bottom: 8px;
}
.yvt-modal-views {
	margin-inline-start: 4px;
	color: var(--yvt-muted);
	font-size: .8em;
	font-weight: 400;
	white-space: nowrap;
}
.yvt-modal-title {
	flex: 1;
	margin: 0;
	padding: 0;
	color: var(--yvt-gold);
	font-size: clamp(15px, 2.2vw, 20px);
	font-weight: 700;
	line-height: 1.3;
	text-align: right;
}

.yvt-modal .yvt-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	min-height: 0;
	margin: 0;
	padding: 8px 14px;
	border: 0;
	border-radius: 8px;
	background: #243556;
	color: #fff;
	box-shadow: none;
	font: inherit;
	font-size: 14px;
	font-weight: 600;
	line-height: 1.2;
	text-transform: none;
	letter-spacing: normal;
	cursor: pointer;
}
.yvt-modal a.yvt-btn { text-decoration: none; }
.yvt-modal .yvt-btn-download { background: var(--yvt-teal); color: var(--yvt-navy-dk); }
.yvt-modal .yvt-btn-download:hover { background: #8fd4f0; color: var(--yvt-navy-dk); }
.yvt-modal .yvt-btn:hover { background: #2e4270; }
.yvt-modal .yvt-btn:focus-visible { outline: 2px solid var(--yvt-teal); outline-offset: 2px; }
.yvt-modal .yvt-btn:disabled { opacity: .4; cursor: default; }
.yvt-modal .yvt-btn-close, .yvt-modal .yvt-btn-gold, .yvt-modal .yvt-btn[aria-pressed="true"] { background: var(--yvt-gold); color: var(--yvt-navy-dk); }
.yvt-modal .yvt-btn-close:hover, .yvt-modal .yvt-btn-gold:hover, .yvt-modal .yvt-btn[aria-pressed="true"]:hover { background: var(--yvt-gold-lt); }

.yvt-player { background: #000; border-radius: 8px; overflow: hidden; display: flex; flex-direction: column; }

.yvt-video-wrap { position: relative; aspect-ratio: 16 / 9; background: #000; }
.yvt-video-wrap video {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: contain;
	background: #000;
	border: 0;
}

/* הכתוביות בפס נפרד מתחת לסרטון — לא מסתירות את ההקלטה */
.yvt-subs {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: calc(2.9em + 20px);
	padding: 10px 4%;
	background: #0b1220;
	color: #fff;
	font-size: clamp(15px, 2vw, 24px);
	font-weight: 600;
	line-height: 1.45;
	text-align: center;
	direction: rtl;
}
.yvt-line { display: inline-block; max-width: 100%; }
.yvt-now { color: var(--yvt-gold); }

.yvt-end {
	position: absolute;
	inset: 0;
	z-index: 2;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 14px;
	padding: 20px;
	background: rgba(8, 14, 26, .88);
	text-align: center;
}
.yvt-end-title { margin: 0; color: #fff; font-size: clamp(16px, 2.6vw, 22px); font-weight: 700; }
.yvt-end-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }

.yvt-error {
	position: absolute;
	inset: 0;
	z-index: 2;
	display: flex;
	align-items: center;
	justify-content: center;
	margin: 0;
	padding: 20px;
	background: rgba(8, 14, 26, .9);
	color: #ffd2d2;
	text-align: center;
}

.yvt-toolbar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
	margin-top: 10px;
}
.yvt-spacer { flex: 1; }

/* מסך מלא: הנגן + פס הכתוביות */
.yvt-player:fullscreen, .yvt-player:-webkit-full-screen { width: 100%; height: 100%; border-radius: 0; background: #000; }
.yvt-player:fullscreen .yvt-video-wrap, .yvt-player:-webkit-full-screen .yvt-video-wrap { flex: 1 1 auto; aspect-ratio: auto; min-height: 0; }
.yvt-player:fullscreen .yvt-subs, .yvt-player:-webkit-full-screen .yvt-subs { font-size: clamp(20px, 2.6vw, 40px); }

/* ---------- שיתוף ---------- */
.yvt-share-menu {
	position: fixed;
	z-index: 99999;
	min-width: 220px;
	max-width: calc(100vw - 16px);
	padding: 8px;
	background: var(--yvt-surface);
	border: 1px solid var(--yvt-gold);
	border-radius: 10px;
	box-shadow: 0 8px 30px rgba(0, 0, 0, .5);
	color: var(--yvt-text);
	direction: rtl;
	font-family: inherit;
	font-size: 14px;
}
.yvt-share-head { margin: 2px 6px 8px; color: var(--yvt-muted); font-size: 12px; line-height: 1.3; }
.yvt-share-menu .yvt-share-item {
	display: block;
	width: 100%;
	margin: 0;
	padding: 9px 12px;
	border: 0;
	border-radius: 6px;
	background: none;
	color: #fff;
	font: inherit;
	text-align: right;
	text-decoration: none;
	text-transform: none;
	cursor: pointer;
}
.yvt-share-menu .yvt-share-item:hover, .yvt-share-menu .yvt-share-item:focus-visible { background: #243556; outline: none; }
.yvt-share-time { display: block; margin: 6px 12px 2px; font-size: 13px; color: var(--yvt-text); cursor: pointer; }

.yvt-toast {
	position: fixed;
	left: 50%;
	bottom: 28px;
	z-index: 100000;
	transform: translate(-50%, 20px);
	padding: 10px 18px;
	border-radius: 999px;
	background: var(--yvt-gold);
	color: var(--yvt-navy-dk);
	font-size: 14px;
	font-weight: 700;
	opacity: 0;
	pointer-events: none;
	transition: opacity .2s, transform .2s;
}
.yvt-toast.yvt-show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 480px) {
	.yvt-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
	.yvt-title { font-size: 22px; }
	.yvt-subtitle { font-size: 13px; }
	.yvt-modal { padding: 8px; }
	.yvt-modal-frame { width: 100%; }
	.yvt-modal .yvt-btn { padding: 8px 10px; font-size: 13px; }
}

@media (prefers-reduced-motion: reduce) {
	.yvt-card, .yvt-toast, .yvt-play { transition: none; }
}
