@keyframes fade-in-up {
	0% {
		opacity: 0;
   }
	100% {
		transform: translateY(0);
		opacity: 1;
   }
}

/* =============================================
   GENESIS FRAMEWORK COMPATIBILITY
   Genesis themes create stacking contexts with .site-container { position: relative }
   and pseudo-elements with z-index: -1. This can affect position: fixed behavior.
   These rules ensure the sticky player works inside Genesis theme containers.
   ============================================= */

/* Break any stacking context from Genesis .site-container */
.site-container .video.stuck,
.site-container .wpj-sticky-carousel {
	position: fixed !important;
	isolation: isolate !important;
}

/* Ensure video-wrap doesn't inherit relative positioning from Genesis */
.site-container .video-wrap {
	position: relative !important;
	z-index: auto !important;
}

/* =============================================
   UNIVERSAL THEME COMPATIBILITY OVERRIDES
   These rules ensure the sticky player works with any theme.
   High specificity + !important to override theme-specific styles.
   ============================================= */

/* Override any theme's video embed containers when stuck.
   Covers both: (1) inside original wrap, and (2) direct child of body
   after the JS moves .video.stuck to body to avoid stacking-context issues. */
body .video-wrap .video.stuck iframe,
body .elementor-video-wrapper .video.stuck iframe,
body .wpb_wrapper .video.stuck iframe,
body .vc_video-wrapper .video.stuck iframe,
body .et_pb_video_wrap .video.stuck iframe,
body .fl-video .video.stuck iframe,
body .wp-block-embed .video.stuck iframe,
body .wp-embed-responsive .video.stuck iframe,
body .ast-oembed-container .video.stuck iframe,
body > .video.stuck iframe {
	max-width: 100% !important;
	max-height: 100% !important;
	position: relative !important;
	top: 0 !important;
	left: 0 !important;
	width: 100% !important;
	height: 100% !important;
}

/* Core stuck styles — highest specificity.
   body > .video.stuck covers the case where JS moved the element to body. */
body .video-wrap .video.stuck,
body .elementor-video-wrapper .video.stuck,
body .wpb_wrapper .video.stuck,
body .et_pb_video_wrap .video.stuck,
body .ast-oembed-container .video.stuck,
body .site-container .video.stuck,
body > .video.stuck,
.video.stuck {
	position: fixed !important;
	transform: translateY(0) !important;
	animation: fade-in-up 0.25s ease forwards !important;
	z-index: 2147483647 !important;
	opacity: 1 !important;
	display: block !important;
	visibility: visible !important;
	isolation: isolate !important;
}

/* Ensure video-wrap doesn't interfere and maintains proper height */
.video-wrap {
	position: relative;
	display: block !important;
	visibility: visible !important;
	opacity: 1 !important;
	width: 100%;
	height: auto;
	min-height: inherit;
}

/* Normal video state (non-sticky) - ensure proper display */
.video-wrap .video:not(.stuck) {
	position: relative !important;
	display: block !important;
	visibility: visible !important;
	opacity: 1 !important;
	width: 100%;
	height: auto;
	line-height: 0;
}

/* Ensure iframe displays properly in normal state */
.video-wrap .video:not(.stuck) iframe {
	position: relative !important;
	display: block !important;
	visibility: visible !important;
	opacity: 1 !important;
	width: 100%;
	height: auto;
	aspect-ratio: 16 / 9;
}

/* Fix WordPress responsive embed padding issue - prevents 75% padding-top */
.wp-embed-responsive .wp-embed-aspect-4-3 .wp-block-embed__wrapper:before,
.wp-embed-responsive .wp-embed-aspect-16-9 .wp-block-embed__wrapper:before,
.wp-embed-responsive .wp-embed-aspect-21-9 .wp-block-embed__wrapper:before {
	padding-top: 0 !important;
}

/* Fix WordPress responsive embed iframe height - allow natural height */
.wp-embed-responsive .wp-has-aspect-ratio iframe {
	height: revert-layer !important;
}

/* Only remove WordPress responsive embed padding when video is stuck 
   This prevents breaking normal video aspect ratios */
.video.stuck:before,
.video.stuck:after {
	display: none !important;
	content: none !important;
	padding-top: 0 !important;
}

.video-wrap .video.stuck {
	position: fixed !important;
}

/* Top Bar - Above Video */
.video.stuck .wpj-video-top-bar {
	position: absolute !important;
	bottom: 100% !important;
	left: 0 !important;
	right: 0 !important;
	height: 30px !important;
	display: flex !important;
	align-items: center !important;
	justify-content: flex-end !important;
	gap: 2px !important;
	padding: 0 4px !important;
	z-index: 2147483647 !important;
	background: rgba(0, 0, 0, 0.85); /* No !important — JS overrides for custom theme */
	border-radius: 6px 6px 0 0 !important;
}

/* Top bar icon buttons */
/* color is overridden by JS based on icon_color setting */
.wpj-top-btn {
	width: 26px !important;
	height: 24px !important;
	display: flex !important;
	align-items: center !important;
	justify-content: center !important;
	background: transparent !important;
	border: none !important;
	border-radius: 4px !important;
	cursor: pointer !important;
	color: #fff; /* No !important — JS overrides per icon_color setting */
	transition: background 0.2s ease !important;
	flex-shrink: 0 !important;
}

.wpj-top-btn:hover {
	background: rgba(128, 128, 128, 0.2) !important;
}

.wpj-top-btn svg {
	width: 14px !important;
	height: 14px !important;
	display: block !important;
}

/* Move button pushed to the left */
.wpj-video-top-bar .wpj-drag-handle {
	margin-right: auto !important;
}

/* Hide top bar on normal videos */
.video:not(.stuck) .wpj-video-top-bar {
	display: none !important;
}

/* Mobile adjustments for top bar */
@media (max-width: 768px) {
	.video.stuck .wpj-video-top-bar {
		height: 28px !important;
		padding: 0 3px !important;
	}

	.wpj-top-btn {
		width: 24px !important;
		height: 22px !important;
	}

	.wpj-top-btn svg {
		width: 12px !important;
		height: 12px !important;
	}
}

/* ===== PRO FEATURES CSS ===== */

/* PRO: Resize Handles — visible circle is 22px, invisible hit target is 48px */
.wpj-resize-handle {
	position: absolute !important;
	width: 22px !important;
	height: 22px !important;
	background: rgba(255, 255, 255, 0.95) !important;
	border: 2.5px solid rgba(0, 0, 0, 0.5) !important;
	box-shadow: 0 1px 4px rgba(0,0,0,0.25) !important;
	border-radius: 50% !important;
	z-index: 2147483647 !important;
	cursor: pointer !important;
	touch-action: none !important;
	transition: transform 0.15s ease, background 0.15s ease !important;
}

/* Invisible 48px hit target for easier grabbing */
.wpj-resize-handle::before {
	content: '' !important;
	position: absolute !important;
	top: -13px !important;
	left: -13px !important;
	right: -13px !important;
	bottom: -13px !important;
}

.wpj-resize-handle:hover {
	background: #fff !important;
	transform: scale(1.3) !important;
	border-color: rgba(0, 0, 0, 0.7) !important;
	box-shadow: 0 2px 8px rgba(0,0,0,0.35) !important;
}

/* Resize handle positions — pulled inward so visible circle overlaps the video edge */
.wpj-resize-se {
	bottom: -7px !important;
	right: -7px !important;
	cursor: se-resize !important;
}

.wpj-resize-sw {
	bottom: -7px !important;
	left: -7px !important;
	cursor: sw-resize !important;
}

.wpj-resize-ne {
	top: -7px !important;
	right: -7px !important;
	cursor: ne-resize !important;
}

.wpj-resize-nw {
	top: -7px !important;
	left: -7px !important;
	cursor: nw-resize !important;
}

/* Hide resize handles on normal videos */
.video:not(.stuck) .wpj-resize-handle {
	display: none !important;
}

/* PRO: HTML5 Video Support */
.video.stuck video {
	position: relative !important;
	top: 0 !important;
	left: 0 !important;
	width: 100% !important;
	height: 100% !important;
	object-fit: contain !important;
}

.video-wrap .video:not(.stuck) video {
	position: relative !important;
	display: block !important;
	width: 100% !important;
	height: auto !important;
	aspect-ratio: 16 / 9;
}

/* PRO: Multiple Videos - Stack effect */
.video.stuck[data-video-id="1"] {
	z-index: 999998 !important;
}

.video.stuck[data-video-id="2"] {
	z-index: 999997 !important;
}

.video.stuck[data-video-id="3"] {
	z-index: 999996 !important;
}

/* PRO: Mobile resize handles adjustments */
@media (max-width: 768px) {
	.wpj-resize-handle {
		width: 28px !important;
		height: 28px !important;
		border-width: 3px !important;
	}

	.wpj-resize-handle::before {
		top: -14px !important;
		left: -14px !important;
		right: -14px !important;
		bottom: -14px !important;
	}

	.wpj-resize-se {
		bottom: -9px !important;
		right: -9px !important;
	}

	.wpj-resize-sw {
		bottom: -9px !important;
		left: -9px !important;
	}

	.wpj-resize-ne {
		top: -9px !important;
		right: -9px !important;
	}

	.wpj-resize-nw {
		top: -9px !important;
		left: -9px !important;
	}
}

/* PRO: Smooth resizing transition */
.video.stuck {
	transition: width 0.1s ease, height 0.1s ease !important;
}

/* Disable transition during active resize to prevent visual jump */
.video.stuck.wpj-resizing,
.wpj-sticky-carousel.wpj-resizing {
	transition: none !important;
}

/* ===== PRO: CAROUSEL STYLES ===== */

/* Carousel Container */
.wpj-sticky-carousel {
	position: fixed !important;
	z-index: 2147483647 !important;
	background: #000; /* No !important — JS overrides for custom theme */
	/* box-shadow set by JS via dropShadow setting */
	overflow: visible !important;
	isolation: isolate !important;
	max-width: calc(100vw - 20px) !important;
	box-sizing: border-box !important;
}

/* Carousel Inner - no border-radius: iframe must have square corners */
.wpj-carousel-inner {
	position: relative !important;
	width: 100% !important;
	overflow: hidden !important;
}

/* Carousel Slide */
.wpj-carousel-slide {
	width: 100% !important;
	position: relative !important;
}

.wpj-carousel-slide iframe,
.wpj-carousel-slide video {
	width: 100% !important;
	height: 100% !important;
	display: block !important;
	border: none !important;
	position: absolute !important;
	top: 0 !important;
	left: 0 !important;
}

/* Carousel Controls Container */
/* Always sits below the video in normal flow for all themes */
.wpj-carousel-controls {
	display: flex !important;
	align-items: center !important;
	justify-content: center !important;
	gap: 10px !important;
	height: 30px !important; /* Match top bar height for uniform appearance */
	padding: 0 4px !important;
	background: rgba(0, 0, 0, 0.8); /* No !important — JS overrides for theme */
	border-radius: 0 0 8px 8px !important;
	left: 0 !important;
	right: 0 !important;
}

/* Carousel Arrows - now in top bar, styled via .wpj-top-btn */

/* Carousel Dots Container */
.wpj-carousel-dots {
	display: flex !important;
	align-items: center !important;
	justify-content: center !important;
	gap: 6px !important;
}

/* Carousel Dot — background/opacity set by JS based on icon_color setting */
.wpj-carousel-dot {
	width: 8px !important;
	height: 8px !important;
	border-radius: 50% !important;
	cursor: pointer !important;
	transition: all 0.2s ease !important;
}

.wpj-carousel-dot.active {
	transform: scale(1.2) !important;
}

/* Carousel Top Bar - Above Video */
.wpj-sticky-carousel .wpj-video-top-bar {
	position: absolute !important;
	bottom: 100% !important;
	left: 0 !important;
	right: 0 !important;
	height: 30px !important;
	display: flex !important;
	align-items: center !important;
	justify-content: flex-end !important;
	gap: 2px !important;
	padding: 0 4px !important;
	background: rgba(0, 0, 0, 0.85); /* No !important — JS overrides for custom theme */
	z-index: 2147483647 !important;
	border-radius: 6px 6px 0 0 !important;
}

/* ===== PRO: DRAG HANDLE / REPOSITION ===== */

/* Drag Handle */
.wpj-drag-handle {
	cursor: grab !important;
}

.wpj-drag-handle:active {
	cursor: grabbing !important;
}

/* ===== PRO: VIDEO PLACEHOLDER ===== */

/* Shortcode wrapper — maintains 16:9 aspect ratio */
.wpj-shortcode-video {
	position: relative;
	width: 100%;
}

.wpj-shortcode-video iframe {
	width: 100%;
	border: none;
	display: block;
}

.wpj-video-placeholder {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	aspect-ratio: 16 / 9;
	cursor: pointer;
	border-radius: 4px;
	overflow: hidden;
}

.wpj-video-placeholder:hover .wpj-placeholder-play {
	opacity: 1;
	transform: scale(1.1);
}

.wpj-placeholder-play {
	position: absolute;
	font-size: 48px;
	opacity: 0.6;
	transition: opacity 0.2s ease, transform 0.2s ease;
	pointer-events: none;
}

.wpj-placeholder-iframe iframe {
	width: 100%;
	height: 100%;
	border: none;
	display: block;
}

/* ===== Mobile Carousel Adjustments ===== */
@media (max-width: 768px) {
	.wpj-carousel-controls {
		padding: 6px !important;
		gap: 8px !important;
		height: 28px !important;
	}

	.wpj-carousel-dot {
		width: 10px !important;
		height: 10px !important;
		min-width: 10px !important;
		min-height: 10px !important;
	}

	.wpj-sticky-carousel .wpj-video-top-bar {
		height: 28px !important;
		padding: 0 3px !important;
	}

	.wpj-sticky-carousel {
		max-width: calc(100vw - 10px) !important;
	}

	.wpj-carousel-arrow {
		width: 28px !important;
		height: 26px !important;
	}
}

/* ===== Tablet Carousel Adjustments ===== */
@media (min-width: 769px) and (max-width: 1024px) {
	.wpj-carousel-controls {
		padding: 4px 6px !important;
		gap: 10px !important;
	}

	.wpj-carousel-dot {
		width: 9px !important;
		height: 9px !important;
	}
}

