/* =====================================================
   Video Popup Manager — Public Styles
   ===================================================== */

/* ── Floating Button ─────────────────────────────── */
.vpm-floating-btn {
	position: fixed;
	z-index: 9999990;
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 12px 20px;
	border-radius: 50px;
	border: none;
	cursor: pointer;
	font-size: 14px;
	font-weight: 700;
	font-family: inherit;
	line-height: 1;
	letter-spacing: .3px;
	text-decoration: none;
	box-shadow: 0 4px 20px rgba(0,0,0,.25);
	transition: transform .2s, opacity .3s;
	will-change: transform;
}
.vpm-floating-btn:hover {
	transform: translateY(-3px) scale(1.03);
}

/* Positions */
.vpm-floating-btn--bottom-right  { bottom: 24px; right: 24px; }
.vpm-floating-btn--bottom-left   { bottom: 24px; left: 24px; }
.vpm-floating-btn--bottom-center { bottom: 24px; left: 50%; transform: translateX(-50%); }
.vpm-floating-btn--bottom-center:hover { transform: translateX(-50%) translateY(-3px) scale(1.03); }

/* Animations */
.vpm-floating-btn--anim-pulse {
	will-change: transform;
}
/* Ripple ring via pseudo-element — only transform+opacity, fully GPU-composited */
.vpm-floating-btn--anim-pulse::after {
	content: '';
	position: absolute;
	inset: 0;
	border-radius: inherit;
	background: currentColor;
	opacity: 0;
	animation: vpmPulse 2.5s ease-out infinite;
	pointer-events: none;
	will-change: transform, opacity;
}
.vpm-floating-btn--anim-bounce {
	animation: vpmBounce 1.5s infinite;
	will-change: transform;
}
.vpm-floating-btn--anim-shake {
	animation: vpmShake 3s infinite;
	will-change: transform;
}

@keyframes vpmPulse {
	0%   { transform: scale(0.9); opacity: 0.35; }
	100% { transform: scale(1.7); opacity: 0; }
}
@keyframes vpmBounce {
	0%, 100% { transform: translateY(0); }
	50%       { transform: translateY(-8px); }
}
@keyframes vpmShake {
	0%, 100%, 60% { transform: rotate(0); }
	70%  { transform: rotate(-4deg); }
	80%  { transform: rotate(4deg); }
	90%  { transform: rotate(-2deg); }
	95%  { transform: rotate(2deg); }
}

/* Icon */
.vpm-btn-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 18px;
	height: 18px;
	flex-shrink: 0;
}
.vpm-btn-icon svg { width: 16px; height: 16px; fill: currentColor; }

/* Entrance */
.vpm-floating-btn--hidden  { opacity: 0; pointer-events: none; }
.vpm-floating-btn--visible { opacity: 1; pointer-events: auto; }

/* ── Overlay ─────────────────────────────────────── */
.vpm-overlay {
	position: fixed;
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
	z-index: 9999999;
	background: rgba(0,0,0,.75);
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
	opacity: 0;
	visibility: hidden;
	transition: opacity .3s ease, visibility .3s ease;
	backdrop-filter: blur(4px);
	-webkit-backdrop-filter: blur(4px);
	box-sizing: border-box;
	will-change: opacity;
}
.vpm-overlay--open {
	opacity: 1;
	visibility: visible;
}

/* ── Popup Container ─────────────────────────────── */
.vpm-popup {
	background: #000;
	border-radius: 12px;
	overflow: hidden;
	width: 100%;
	max-width: 860px;
	position: relative;
	transform: scale(.93) translateY(24px);
	transition: transform .3s cubic-bezier(.34, 1.56, .64, 1);
	box-shadow: 0 25px 60px rgba(0,0,0,.6);
	max-height: calc(100vh - 40px);
	display: flex;
	flex-direction: column;
	will-change: transform;
}
.vpm-overlay--open .vpm-popup {
	transform: scale(1) translateY(0);
}
/* Video wrapper must flex-grow to fill the popup */
.vpm-popup .vpm-video-wrapper {
	flex: 1 1 auto;
}

/* ── Close Button ────────────────────────────────── */
.vpm-close {
	position: absolute;
	top: 12px;
	right: 12px;
	z-index: 10;
	background: rgba(0,0,0,.5);
	border: none;
	color: #fff;
	width: 36px !important;
	height: 36px !important;
	min-width: 36px;
	min-height: 36px;
	max-width: 36px;
	max-height: 36px;
	border-radius: 50% !important;
	cursor: pointer;
	display: flex !important;
	align-items: center;
	justify-content: center;
	font-size: 20px;
	line-height: 1;
	padding: 0 !important;
	margin: 0;
	box-sizing: border-box !important;
	flex-shrink: 0;
	transition: filter .2s;
}
.vpm-close:hover { filter: brightness(1.6); }

/* ── Video Wrapper ───────────────────────────────── */
.vpm-video-wrapper {
	position: relative;
	width: 100%;
	padding-bottom: 56.25%; /* 16:9 */
	background: #111;
}
.vpm-video-wrapper iframe,
.vpm-video-wrapper video {
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
	width: 100%;
	height: 100%;
	border: none;
}

/* ── Thumbnail / Loading ─────────────────────────── */
.vpm-thumb-overlay {
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
	background-size: cover;
	background-position: center;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
}
.vpm-play-circle {
	width: 72px;
	height: 72px;
	background: rgba(255,255,255,.9);
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 4px 20px rgba(0,0,0,.4);
	transition: transform .2s;
}
.vpm-thumb-overlay:hover .vpm-play-circle { transform: scale(1.1); }
.vpm-play-circle svg { width: 28px; height: 28px; fill: #1e293b; margin-left: 4px; }

/* Loading spinner */
.vpm-loading {
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	background: #111;
}
.vpm-spinner {
	width: 40px;
	height: 40px;
	border: 3px solid rgba(255,255,255,.2);
	border-top-color: #fff;
	border-radius: 50%;
	animation: vpmSpin .8s linear infinite;
}
@keyframes vpmSpin { to { transform: rotate(360deg); } }

/* Progress bar */
.vpm-progress-wrap {
	position: absolute;
	bottom: 0;
	left: 0;
	right: 0;
	height: 3px;
	background: rgba(255,255,255,.2);
}
.vpm-progress-bar {
	height: 100%;
	background: #ef4444;
	width: 100%;
	transform: scaleX(0);
	transform-origin: left;
	transition: transform .5s linear;
	will-change: transform;
}

/* ── Popup Footer (CTA) ──────────────────────────── */
.vpm-popup-footer {
	background: #1a1a1a;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 0;
	text-align: center;
	flex-shrink: 0;
}
.vpm-popup-title {
	display: block !important;
	color: rgba(255,255,255,.7) !important;
	font-size: 12px !important;
	font-weight: 500 !important;
	margin: 0 !important;
	padding: 10px 20px 0 !important;
	white-space: nowrap !important;
	overflow: hidden !important;
	text-overflow: ellipsis !important;
	max-width: 100% !important;
}
.vpm-cta-btn {
	display: block !important;
	width: 100%;
	padding: 14px 20px !important;
	box-sizing: border-box;
	font-size: 15px;
	font-weight: 700;
	color: #fff !important;
	text-align: center;
	text-decoration: none !important;
	white-space: nowrap;
	letter-spacing: .3px;
	transition: filter .2s;
}
.vpm-cta-btn:hover { filter: brightness(1.12); }

/* ── Mobile ──────────────────────────────────────── */
@media (max-width: 600px) {
	/* Button */
	.vpm-floating-btn            { padding: 10px 16px; font-size: 13px; }
	.vpm-floating-btn--bottom-right  { bottom: 16px; right: 16px; }
	.vpm-floating-btn--bottom-left   { bottom: 16px; left: 16px; }
	.vpm-floating-btn--bottom-center { bottom: 16px; }

	/* Bottom-sheet popup on mobile */
	.vpm-overlay {
		align-items: flex-end;
		padding: 0;
	}
	.vpm-popup {
		border-radius: 16px 16px 0 0;
		max-height: 92vh;
		max-width: 100%;
		transform: translateY(100%);
	}
	.vpm-overlay--open .vpm-popup {
		transform: translateY(0);
	}

	/* Keep 16:9 ratio on the video explicitly on mobile */
	.vpm-video-wrapper {
		padding-bottom: 56.25%;
		height: 0;
		flex: 0 0 auto;
	}

	/* Footer */
	.vpm-cta-btn      { padding: 12px 16px !important; }
	.vpm-popup-title  { white-space: normal; padding: 8px 16px 0; }
}

/* ── Corner Mini Player ──────────────────────────── */
.vpm-corner-player {
	position: fixed;
	z-index: 9999989;
	background: #000;
	border-radius: 10px;
	overflow: hidden;
	box-shadow: 0 8px 30px rgba(0,0,0,.45);
	transition: opacity .3s ease, transform .3s ease;
	will-change: opacity, transform;
	font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
.vpm-corner-player--bottom-right { bottom: 24px; right: 24px; }
.vpm-corner-player--bottom-left  { bottom: 24px; left:  24px; }
.vpm-corner-player--top-right    { top: 72px;    right: 24px; }
.vpm-corner-player--top-left     { top: 72px;    left:  24px; }

.vpm-corner-player--hidden  { opacity: 0; pointer-events: none; transform: translateY(16px); }
.vpm-corner-player--visible { opacity: 1; pointer-events: auto; transform: translateY(0); }

/* Header */
.vpm-cp-header {
	display: flex;
	flex-direction: column;
	padding: 5px 8px;
	background: #1a1a1a;
	gap: 3px;
}
.vpm-cp-title {
	color: #e2e8f0 !important;
	font-size: 11px !important;
	font-weight: 600 !important;
	overflow: hidden !important;
	text-overflow: ellipsis !important;
	white-space: nowrap !important;
	display: block !important;
	line-height: 1.3 !important;
	margin: 0 !important;
	padding: 0 !important;
	width: 100%;
}
.vpm-cp-actions {
	display: flex;
	gap: 4px;
	justify-content: flex-end;
	flex-shrink: 0;
}
.vpm-cp-btn {
	background: rgba(255,255,255,.15);
	border: none;
	color: #fff;
	width: 22px;
	height: 22px;
	border-radius: 4px;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-size: 15px;
	line-height: 1;
	padding: 0;
	transition: filter .15s;
	font-family: inherit;
}
.vpm-cp-btn:hover { filter: brightness(1.5); }
.vpm-cp-btn svg {
	display: block !important;
	width: 16px !important;
	height: 16px !important;
	min-width: 16px !important;
	min-height: 16px !important;
	fill: #fff !important;
	visibility: visible !important;
	opacity: 1 !important;
	overflow: visible !important;
	padding-right: 0px;
}
.vpm-cp-btn svg path,
.vpm-cp-btn svg rect,
.vpm-cp-btn svg polygon,
.vpm-cp-btn svg circle {
	fill: #fff !important;
	visibility: visible !important;
}

/* Video area — 16:9 intrinsic ratio */
.vpm-cp-video {
	position: relative;
	width: 100%;
	padding-bottom: 56.25%;
	background: #111;
}
.vpm-cp-video iframe,
.vpm-cp-video video {
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
	width: 100%;
	height: 100%;
	border: none;
	object-fit: cover;
}

/* CTA footer inside corner player */
.vpm-cp-footer {
	padding: 6px 8px;
	background: #111;
	border-top: 1px solid rgba(255,255,255,.08);
}
.vpm-cp-cta {
	display: block !important;
	width: 100%;
	padding: 6px 10px;
	border-radius: 5px;
	font-size: 11px;
	font-weight: 700;
	text-align: center;
	text-decoration: none !important;
	color: #fff !important;
	box-sizing: border-box;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	transition: filter .2s, transform .15s;
	font-family: inherit;
}
.vpm-cp-cta:hover { filter: brightness(1.15); transform: translateY(-1px); }

/* Small-screen: shrink to 160 px, stay in corner */
@media (max-width: 480px) {
	.vpm-corner-player                 { width: 160px !important; }
	.vpm-cp-title                      { display: none; }
	.vpm-corner-player--bottom-right   { bottom: 12px; right: 12px; }
	.vpm-corner-player--bottom-left    { bottom: 12px; left:  12px; }
	.vpm-corner-player--top-right      { top: 60px;    right: 12px; }
	.vpm-corner-player--top-left       { top: 60px;    left:  12px; }
	.vpm-cp-cta                        { font-size: 10px; padding: 5px 8px; }
}

/* ── YouTube Shorts / Portrait Mode ─────────────── */
.vpm-popup--portrait {
	max-width: 380px;
}
.vpm-popup--portrait .vpm-video-wrapper {
	padding-bottom: 177.78%; /* 9:16 */
	flex: 0 0 auto; /* stop flex-grow from stretching beyond the aspect ratio */
}
.vpm-corner-player .vpm-cp-video.vpm-cp-video--portrait {
	padding-bottom: 177.78%; /* 9:16 */
	height: 0;
	overflow: hidden;
}
/*
 * YouTube's embed player is always 16:9 internally.
 * At small sizes it doesn't switch to portrait — so we size the iframe
 * based on the container HEIGHT (16:9 of height = 317% of width),
 * centre it, and let overflow:hidden crop to the portrait video column.
 * Math: container is 9:16, height = width × 16/9
 *       iframe width for 16:9 = height × 16/9 = width × (16/9)² = 256/81 ≈ 317%
 *       The Shorts portrait content fills exactly the centre 9/16 of that iframe.
 */
.vpm-corner-player .vpm-cp-video.vpm-cp-video--portrait iframe {
	position: absolute;
	width: 317%;
	height: 100%;
	left: 50%;
	top: 0;
	transform: translateX(-50%);
	border: none;
}
/* mobile media query resets padding-bottom to 56.25% — override it back */
@media (max-width: 600px) {
	.vpm-popup--portrait .vpm-video-wrapper {
		padding-bottom: 177.78%;
		height: 0;
		flex: 0 0 auto;
	}
}

/* ── Newspaper Theme Compat ──────────────────────── */
.vpm-overlay,
.vpm-floating-btn {
	font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
}
