/* ==========================================================================
   Floating Video Player  —  Instagram Reel style (portrait, full-bleed video)
   ========================================================================== */

/* ---- Container ---- */
.wcsv-fv-player {
	position: fixed;
	z-index: 9999998;       /* just below story lightbox */
	width: 280px;           /* overridden by JS from settings */
	height: 500px;          /* overridden by JS from settings (Player Height) */
	/* Never let the player overflow the screen, whatever the saved height is. */
	max-width: calc(100vw - var(--fv-offset-x, 20px) - 12px);
	max-height: calc(100vh - var(--fv-offset-y, 20px) - 12px);
	max-height: calc(100dvh - var(--fv-offset-y, 20px) - 12px);
	background: #000;
	border-radius: 16px;
	box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45), 0 2px 8px rgba(0, 0, 0, 0.3);
	overflow: hidden;
	display: flex;
	flex-direction: column;
	user-select: none;
	-webkit-user-select: none;
	touch-action: none;     /* lets us drag on touch screens without scrolling the page */
	transition: opacity 0.35s ease, transform 0.35s ease;

	/* Hidden / slid-out before JS initialises */
	opacity: 0;
	pointer-events: none;
	transform: translateY(30px);
}

/* Slide-in state added by JS */
.wcsv-fv-player.wcsv-fv-visible {
	opacity: 1;
	pointer-events: auto;
	transform: translateY(0);
}

/* While being dragged */
.wcsv-fv-player.wcsv-fv-dragging {
	transition: none;
	box-shadow: 0 16px 48px rgba(0, 0, 0, 0.6);
	cursor: grabbing;
}
body.wcsv-fv-drag-active,
body.wcsv-fv-drag-active * {
	user-select: none !important;
	-webkit-user-select: none !important;
}

/* ---- Overlay bar (title + controls) — sits ON TOP of the video ---- */
.wcsv-fv-header {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	z-index: 4;
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 8px;
	padding: 10px;
	background: linear-gradient(to bottom, rgba(0, 0, 0, 0.55), rgba(0, 0, 0, 0));
	/* The bar itself never intercepts clicks (so the video underneath stays
	   clickable/draggable); only the buttons below are interactive. */
	pointer-events: none;
}

.wcsv-fv-title {
	font-size: 0.8rem;
	font-weight: 600;
	color: #fff;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	flex: 1;
	min-width: 0;
	line-height: 32px;      /* vertically centre with the 32px buttons */
	text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}

.wcsv-fv-controls {
	display: flex;
	gap: 6px;
	flex-shrink: 0;
	margin-left: auto;      /* always keep the buttons on the right */
	pointer-events: auto;   /* buttons are always clickable */
}

/* ---- Icon buttons ---- */
.wcsv-fv-btn {
	background: rgba(0, 0, 0, 0.45) !important;
	border: none !important;
	color: #fff !important;
	width: 32px;
	height: 32px;
	min-width: 32px;
	border-radius: 50%;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0 !important;
	margin: 0 !important;
	box-shadow: none !important;
	transition: background 0.18s;
	flex-shrink: 0;
	line-height: 1;
	-webkit-backdrop-filter: blur(4px);
	backdrop-filter: blur(4px);
	touch-action: manipulation;
}
.wcsv-fv-btn:hover {
	background: rgba(0, 0, 0, 0.7) !important;
}
.wcsv-fv-btn svg {
	display: block;
	pointer-events: none;
}

/* Muted state — icon turns red-ish */
.wcsv-fv-player.wcsv-fv-muted .wcsv-fv-mute-btn {
	background: rgba(229, 57, 53, 0.6) !important;
}

/* ---- Video wrapper (fills the entire card) ---- */
.wcsv-fv-video-wrap {
	position: relative;
	flex: 1 1 auto;
	min-height: 0;
	width: 100%;
	background: #000;
	cursor: pointer;
	overflow: hidden;
}

.wcsv-fv-video {
	width: 100%;
	height: 100%;
	display: block;
	object-fit: cover;      /* fills the reel frame */
}

/* ---- Play overlay (only interactive while paused) ---- */
.wcsv-fv-play-overlay {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(0, 0, 0, 0.25);
	opacity: 0;
	transition: opacity 0.2s;
	pointer-events: none;
	z-index: 2;
}
.wcsv-fv-player.wcsv-fv-paused .wcsv-fv-play-overlay {
	opacity: 1;
}
.wcsv-fv-play-btn {
	width: 60px;
	height: 60px;
	border-radius: 50%;
	background: rgba(0, 0, 0, 0.55) !important;
	border: 2px solid rgba(255, 255, 255, 0.85) !important;
	color: #fff !important;
	padding: 0 !important;
	margin: 0 !important;
	box-shadow: none !important;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	pointer-events: none;
}
.wcsv-fv-player.wcsv-fv-paused .wcsv-fv-play-btn {
	pointer-events: auto;
}
.wcsv-fv-play-btn svg {
	display: block;
	margin-left: 3px;       /* optically centre the triangle */
	pointer-events: none;
}

/* ---- Positional helpers (set via JS) ---- */
.wcsv-fv-pos-bottom-left  { bottom: var(--fv-offset-y, 20px); left:  var(--fv-offset-x, 20px); }
.wcsv-fv-pos-bottom-right { bottom: var(--fv-offset-y, 20px); right: var(--fv-offset-x, 20px); }
.wcsv-fv-pos-top-left     { top:    var(--fv-offset-y, 20px); left:  var(--fv-offset-x, 20px); }
.wcsv-fv-pos-top-right    { top:    var(--fv-offset-y, 20px); right: var(--fv-offset-x, 20px); }

/* ---- Hide on mobile when setting is on ---- */
@media (max-width: 599px) {
	.wcsv-fv-player.wcsv-fv-hide-mobile {
		display: none !important;
	}
}

/* ---- Expanded (fullscreen-ish) state ---- */
.wcsv-fv-player.wcsv-fv-expanded {
	position: fixed !important;
	inset: 0 !important;
	width: 100vw !important;
	height: 100vh !important;
	height: 100dvh !important;
	max-width: none !important;
	max-height: none !important;
	border-radius: 0 !important;
	z-index: 9999999;
}
.wcsv-fv-player.wcsv-fv-expanded .wcsv-fv-video-wrap {
	flex: 1;
	height: 100%;
}
/* Show the whole portrait reel (with black bars) instead of cropping it. */
.wcsv-fv-player.wcsv-fv-expanded .wcsv-fv-video {
	object-fit: contain;
}

/* ---- Linked product card — visible ONLY when the player is expanded ---- */
.wcsv-fv-product {
	display: none;
}
.wcsv-fv-player.wcsv-fv-expanded .wcsv-fv-product {
	display: flex;
	align-items: center;
	gap: 12px;
	position: absolute;
	left: 50%;
	bottom: calc(18px + env(safe-area-inset-bottom, 0px));
	transform: translateX(-50%);
	width: min(420px, calc(100% - 24px));
	box-sizing: border-box;
	padding: 10px 14px 10px 10px;
	background: #fff;
	color: #111 !important;
	border-radius: 14px;
	box-shadow: 0 6px 24px rgba(0, 0, 0, 0.45);
	text-decoration: none !important;
	z-index: 5;
	cursor: pointer;
	transition: transform 0.18s;
}
.wcsv-fv-player.wcsv-fv-expanded .wcsv-fv-product:hover {
	transform: translateX(-50%) scale(1.02);
}
.wcsv-fv-product-img {
	flex: 0 0 60px;
	width: 60px;
	height: 60px;
	border-radius: 10px;
	overflow: hidden;
	background: #f0f0f0;
}
.wcsv-fv-product-img img {
	display: block;
	width: 100% !important;
	height: 100% !important;
	max-width: none !important;
	object-fit: cover;
	border-radius: 0 !important;
	margin: 0 !important;
}
.wcsv-fv-product-info {
	flex: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 3px;
	text-align: left;
}
.wcsv-fv-product-name {
	font-size: 0.9rem;
	font-weight: 700;
	line-height: 1.25;
	color: #111;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}
.wcsv-fv-product-price {
	font-size: 0.85rem;
	font-weight: 600;
	color: #c2410c;
}
.wcsv-fv-product-price del {
	color: #888;
	font-weight: 400;
	margin-right: 4px;
}
.wcsv-fv-product-price ins {
	text-decoration: none;
	background: none;
}
.wcsv-fv-product-arrow {
	flex-shrink: 0;
	font-size: 1.8rem;
	line-height: 1;
	color: #111;
}

/* ---- Reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
	.wcsv-fv-player { transition: opacity 0.1s; }
}
