/* =============================================================================
   Newsam Video Slider — v1.3
   ============================================================================= */

.newsam-vs-wrapper {
	width: 100%;
	box-sizing: border-box;
	background: #111;
	border-radius: 4px;
	overflow: hidden;
	/* CSS vars (overridable via shortcode attrs, also set inline on wrapper) */
	--nvs-vad-width: 160px;
	--nvs-had-height: 90px;
}

/* ── Ad Layout ───────────────────────────────────────────────────────────── */

.newsam-vs-row {
	display: flex;
	align-items: stretch;
}

.newsam-vs-main {
	flex: 1 1 auto;
	min-width: 0;
}

/* Vertical ad (left of video) — collapses to 0 width on stage 2+.
   Width is proportional: ~14% of the slider width (14vw, since the slider is
   full-bleed = 100vw on mobile), floored at 48px so it never vanishes and
   capped at the admin-configured desktop size (--nvs-vad-width, default 160px).
   Desktop → the cap wins (160px); phones → 14vw wins (~50–55px). */
.newsam-vs-vad {
	position: relative; /* anchor the absolutely-positioned inner */
	flex: 0 0 clamp(48px, 14vw, var(--nvs-vad-width));
	width: clamp(48px, 14vw, var(--nvs-vad-width));
	background: #0d0d0d;
	overflow: hidden;
	transition:
		flex-basis 0.5s ease,
		width 0.5s ease,
		opacity 0.3s ease 0.05s;
}

/* The ad content must not dictate the row height — it fills the height the
   video column establishes (16:9 player + thumb strip), so a tall 160×600
   skyscraper scales down to fit instead of stretching the whole slider. */
.newsam-vs-vad .newsam-vs-ad-inner {
	position: absolute;
	inset: 0;
}

/* Horizontal ad (below thumbnails) — collapses to 0 height on stage 3.
   Height is proportional: ~8% of the slider width (8vw), floored at 40px and
   capped at the admin-configured desktop height (--nvs-had-height, default
   90px). Desktop → the cap wins (90px); phones → 8vw wins (~30–40px). */
.newsam-vs-had {
	height: clamp(40px, 8vw, var(--nvs-had-height));
	background: #0d0d0d;
	overflow: hidden;
	transition:
		height 0.5s ease,
		opacity 0.3s ease 0.05s;
}

.newsam-vs-ad-inner {
	width: 100%;
	height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
}

.newsam-vs-ad-inner > * {
	max-width: 100%;
	max-height: 100%;
}

/* Images scale to fit the slot, keeping aspect ratio (no stretch / no crop) */
.newsam-vs-ad-inner img {
	width: auto;
	height: auto;
	max-width: 100%;
	max-height: 100%;
	object-fit: contain;
}

/* Default placeholder (visible until real ad HTML is passed) */
.newsam-vs-ad-placeholder {
	width: 100%;
	height: 100%;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 4px;
	background: repeating-linear-gradient(
		45deg,
		#1a1a1a,
		#1a1a1a 10px,
		#222 10px,
		#222 20px
	);
	color: #bbb;
	font-size: 12px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	text-align: center;
	padding: 8px;
	box-sizing: border-box;
}

.newsam-vs-ad-placeholder span {
	font-size: 10px;
	font-weight: 400;
	color: #888;
	letter-spacing: 0;
}

/* Stage 2: vertical ad hidden */
.newsam-vs-wrapper.nvs-stage-2 .newsam-vs-vad,
.newsam-vs-wrapper.nvs-stage-3 .newsam-vs-vad {
	flex: 0 0 0;
	width: 0;
	opacity: 0;
}

/* Stage 3: horizontal ad hidden */
.newsam-vs-wrapper.nvs-stage-3 .newsam-vs-had {
	height: 0;
	opacity: 0;
}

/* ── Main Player ─────────────────────────────────────────────────────────── */

.newsam-vs-iframe-container {
	position: relative;
	width: 100%;
	padding-bottom: 56.25%; /* 16:9 */
	background: #000;
}

/* YT API creates an <iframe> inside the div — target it */
.newsam-vs-iframe-container iframe,
#newsam-yt-player,
#newsam-yt-player iframe {
	position: absolute !important;
	top: 0 !important;
	left: 0 !important;
	width: 100% !important;
	height: 100% !important;
	border: 0;
}


/* ── Mute / Unmute button overlay ────────────────────────────────────────── */

.newsam-vs-mute-btn {
	display: none; /* hidden on desktop — YouTube native controls are sufficient */
}

.newsam-vs-mute-btn:hover,
.newsam-vs-mute-btn:focus {
	background: rgba(0, 0, 0, 0.85);
	outline: none;
}

.newsam-vs-mute-btn:active {
	transform: scale(0.92);
}

.newsam-vs-mute-btn svg {
	width: 22px;
	height: 22px;
	display: block;
	pointer-events: none;
}

@media (max-width: 768px) {
	.newsam-vs-mute-btn {
		display: flex;
		position: absolute;
		bottom: 44px;
		left: 8px;
		z-index: 10;
		width: 36px;
		height: 36px;
		border-radius: 50%;
		border: none;
		background: rgba(0, 0, 0, 0.65);
		color: #fff;
		cursor: pointer;
		align-items: center;
		justify-content: center;
		padding: 0;
		transition: background 0.18s, transform 0.12s;
		-webkit-tap-highlight-color: transparent;
	}
	.newsam-vs-mute-btn:active {
		transform: scale(0.92);
	}
	.newsam-vs-mute-btn svg {
		width: 18px;
		height: 18px;
		display: block;
		pointer-events: none;
	}
}

/* ── Thumbnail Strip ─────────────────────────────────────────────────────── */

.newsam-vs-strip {
	display: flex;
	align-items: stretch;
	height: 72px;
	background: #0d0d0d;
	padding: 0;
	box-sizing: border-box;
}

/* Arrows */
.newsam-vs-arrow {
	flex: 0 0 24px;
	width: 24px;
	height: 100%;
	background: transparent;
	border: none;
	cursor: pointer;
	padding: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	color: #999;
	transition: color 0.18s;
	border-radius: 2px;
}

.newsam-vs-arrow svg {
	width: 18px;
	height: 18px;
	display: block;
}

.newsam-vs-arrow:hover:not(:disabled) {
	color: #fff;
}

.newsam-vs-arrow:disabled {
	opacity: 0.2;
	cursor: default;
}

/* Viewport */
.newsam-vs-thumbs-viewport {
	flex: 1;
	overflow: hidden;
	align-self: stretch;
}

.newsam-vs-thumbs-track {
	display: flex;
	align-items: stretch;
	height: 100%;
	gap: 4px;
	padding: 0 3px;
	box-sizing: border-box;
}

/* Individual Thumbnail */
.newsam-vs-thumb {
	flex: 1 1 0;
	min-width: 0;
	position: relative;
	cursor: pointer;
	border-radius: 2px;
	overflow: hidden;
	border: 1.5px solid transparent;
	transition: border-color 0.18s;
	background: #222;
	align-self: stretch;
}

/* Thumbnail image — fills the slot absolutely */
.newsam-vs-thumb img {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.newsam-vs-thumb.active {
	border-color: #e2271a;
}

.newsam-vs-thumb:hover {
	border-color: rgba(255,255,255,0.4);
}


/* Play icon — centered overlay (Elementor red style) */
.newsam-vs-play-icon {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(0,0,0,0.25);
	pointer-events: none;
}

.newsam-vs-play-icon svg {
	width: 22px;
	height: 22px;
	background: #e2271a;
	border-radius: 50%;
	padding: 4px 4px 4px 5px; /* nudge triangle to centre */
	box-sizing: border-box;
	filter: drop-shadow(0 1px 3px rgba(0,0,0,0.5));
}

/* Title overlay — appears on hover */
.newsam-vs-hover-title {
	position: absolute;
	bottom: 0;
	left: 0;
	right: 0;
	background: rgba(0,0,0,0.82);
	color: #fff;
	font-size: 9px;
	line-height: 1.3;
	padding: 3px 4px;
	opacity: 0;
	transition: opacity 0.18s;
	pointer-events: none;
	/* 2-line max */
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.newsam-vs-thumb:hover .newsam-vs-hover-title {
	opacity: 1;
}

/* ── Responsive ─────────────────────────────────────────────────────────── */

@media (max-width: 768px) {
	.newsam-vs-strip { height: 36px; }
	.newsam-vs-arrow { flex: 0 0 20px; width: 20px; }
	.newsam-vs-arrow svg { width: 14px; height: 14px; }
	.newsam-vs-play-icon svg { width: 16px; height: 16px; }
}

/* Empty state */
.newsam-vs-empty {
	padding: 16px;
	text-align: center;
	color: #666;
}

/* ── Ad slots — mobile ──────────────────────────────────────────────────── */

@media (max-width: 768px) {
	.newsam-vs-wrapper {
		/* Ad sizes now scale proportionally via clamp() on .newsam-vs-vad /
		   .newsam-vs-had — no fixed-px overrides needed here. */
		/* Full-bleed on mobile: break out of the Elementor/theme container side
		   padding so the slider touches the screen edges. The reclaimed side
		   space gives the L-shaped ad (vertical-left + horizontal-bottom) room
		   to show properly. Ancestors are overflow:visible and <body> is
		   overflow-x:hidden, so this won't create a horizontal scrollbar. */
		width: 100vw;
		max-width: 100vw;
		margin-left: 50%;
		transform: translateX(-50%);
		border-radius: 0;
	}
}

