/* Product Layout Tweaker: video injection */

.woocommerce-product-gallery {
	position: relative !important;
}

/* Hide thumbnails only on mobile (keep visible on desktop) */
@media (max-width: 768px) {
	.woocommerce-product-gallery__thumbs,
	.woocommerce-product-gallery__thumbnails,
	.flex-control-thumbs {
		display: none !important;
		visibility: hidden !important;
		height: 0 !important;
		overflow: hidden !important;
	}
}

/* Enable smooth touch scrolling on mobile */
@media (max-width: 768px) {
	.woocommerce-product-gallery__wrapper {
		touch-action: pan-y pinch-zoom;
		-webkit-overflow-scrolling: touch;
	}
}

/* Allow lightbox clicks but remove zoom cursor */
.woocommerce-product-gallery__image img {
	cursor: pointer !important; /* Pointer for lightbox */
}

.woocommerce-product-gallery__image a {
	pointer-events: auto !important; /* Enable for lightbox */
	cursor: pointer !important;
}

/* Ensure zoom overlay doesn't interfere */
.woocommerce-product-gallery__trigger,
.zoomImg,
.woocommerce-product-gallery__image::after {
	display: none !important;
}

/* Prevent any overlays from covering arrows */
.woocommerce-product-gallery > * {
	position: relative;
	z-index: 1;
}

.custom-product-arrows {
	position: absolute !important;
	top: 50% !important;
	left: 0 !important;
	right: 0 !important;
	width: 100% !important;
	/* Mobile arrows are removed in JS; keep this hidden if legacy markup exists */
	display: none !important;
	visibility: visible !important;
	opacity: 1 !important;
	justify-content: space-between !important;
	padding: 0 15px !important;
	pointer-events: none !important;
	z-index: 99999 !important;
	transform: translateY(-50%) !important;
	box-sizing: border-box !important;
}

.custom-product-arrows .arrow {
	background: transparent !important;
	color: #10b981 !important; /* Soft green */
	border: none !important;
	padding: 8px !important;
	font-size: 22px !important;
	font-weight: 600 !important;
	cursor: pointer !important;
	pointer-events: auto !important;
	border-radius: 0 !important;
	transition: opacity 0.3s ease, transform 0.2s ease !important;
	line-height: 1 !important;
	z-index: 100000 !important;
	position: relative !important;
	min-width: 32px !important;
	min-height: 32px !important;
	display: flex !important;
	visibility: visible !important;
	opacity: 0.9 !important;
	align-items: center !important;
	justify-content: center !important;
	text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3) !important;
}

.custom-product-arrows .arrow:hover {
	opacity: 1 !important;
	transform: scale(1.15) !important;
	color: #059669 !important;
}

/* Ensure arrows are hidden on desktop even if has-multiple-images class exists */
@media (min-width: 769px) {
	.custom-product-arrows {
		display: none !important;
	}
}

/* Pagination dots - hidden on desktop, shown on mobile */
.custom-product-dots {
	display: none !important;
	justify-content: center !important;
	align-items: center !important;
	gap: 8px !important;
	padding: 8px 0 4px 0 !important;
	margin: 0 !important;
	list-style: none !important;
	visibility: visible !important;
	opacity: 1 !important;
}

/* Show dots only on mobile */
@media (max-width: 768px) {
	.custom-product-dots {
		display: flex !important;
	}
}

/* Make list items not affect layout */
.custom-product-dots > li {
	margin: 0 !important;
	padding: 0 !important;
	list-style: none !important;
}

.custom-product-dots .dot {
	width: 10px;
	height: 10px;
	border-radius: 50%;
	background: rgba(0, 0, 0, 0.3);
	border: none;
	cursor: pointer;
	padding: 0;
	transition: all 0.3s ease;
	flex-shrink: 0;
	display: block;
}

.custom-product-dots .dot:hover {
	background: rgba(0, 0, 0, 0.5);
	transform: scale(1.2);
}

.custom-product-dots .dot.active {
	background: rgba(0, 0, 0, 0.7);
	width: 12px;
	height: 12px;
}

/* Mobile adjustments for dots - closer to image */
@media (max-width: 768px) {
	.custom-product-dots {
		padding: 2px 0 0 0 !important;
		margin-top: 6px !important;
		gap: 6px !important;
	}

	.custom-product-dots .dot {
		width: 8px;
		height: 8px;
	}

	.custom-product-dots .dot.active {
		width: 10px;
		height: 10px;
	}
}

/* Video play triangle - mobile only (dots only show on mobile) */
.custom-product-dots .dot.has-video {
	background: transparent !important;
	border: none !important;
	width: 8px !important;
	height: 8px !important;
	padding: 0 !important;
	margin: 0 !important;
	line-height: 1 !important;
	border-radius: 0 !important;
	position: relative !important;
	display: flex !important;
	align-items: center !important;
	justify-content: center !important;
	cursor: pointer !important;
	transition: all 0.3s ease !important;
}

.custom-product-dots .dot.has-video::before {
	content: '' !important;
	width: 0 !important;
	height: 0 !important;
	border-style: solid !important;
	/* Keep triangle height aligned with 8px dots on mobile */
	border-width: 4px 0 4px 7px !important;
	border-color: transparent transparent transparent rgba(0, 0, 0, 0.3) !important;
	display: block !important;
	margin-left: 1px !important;
	margin-top: 0 !important;
	transform: translateY(0) !important;
}

.custom-product-dots .dot.has-video:hover::before {
	border-color: transparent transparent transparent rgba(0, 0, 0, 0.5) !important;
	transform: translateY(0) scale(1.2) !important;
}

.custom-product-dots .dot.has-video.active {
	width: 10px !important;
	height: 10px !important;
}

.custom-product-dots .dot.has-video.active::before {
	border-width: 5px 0 5px 8px !important;
	border-color: transparent transparent transparent rgba(0, 0, 0, 0.7) !important;
}

/* --------------------------------------------
 * Video container + custom volume UI
 * -------------------------------------------- */
.woocommerce-product-gallery__image .plt-video-container {
	position: relative;
	width: 100%;
	max-width: 100%;
	height: 0;
	padding-bottom: 56.25%; /* 16:9 */
	background: #fff;
	overflow: hidden;
	margin: 0;
	box-sizing: border-box;
	touch-action: pan-x pan-y;
}

.woocommerce-product-gallery__image .plt-video-container iframe,
.woocommerce-product-gallery__image .plt-video-container video {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	max-width: 100%;
	max-height: 100%;
	border: none;
	object-fit: contain;
	object-position: center;
	/* Allow swiping; controls are custom. */
	pointer-events: none;
}

/* Volume control button for videos */
.plt-video-container .plt-volume-control {
	position: absolute;
	bottom: 12px;
	right: 12px;
	width: 38px;
	height: 38px;
	background: rgba(0, 0, 0, 0.7);
	border: 2px solid rgba(255, 255, 255, 0.85);
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	z-index: 20;
	transition: all 0.2s ease;
	color: #fff;
	font-size: 16px;
	line-height: 1;
	pointer-events: auto;
	padding: 0;
}

.plt-video-container .plt-volume-control:hover {
	background: rgba(0, 0, 0, 0.85);
	transform: scale(1.05);
}

.plt-video-container .plt-volume-control.muted::before {
	content: '🔇';
}

.plt-video-container .plt-volume-control:not(.muted)::before {
	content: '🔊';
}

/* Volume slider (hidden by default, shown when unmuted) */
.plt-video-container .plt-volume-slider {
	position: absolute;
	bottom: 58px;
	right: 12px;
	width: 38px;
	height: 110px;
	background: rgba(0, 0, 0, 0.8);
	border-radius: 18px;
	padding: 10px 0;
	display: none;
	align-items: center;
	justify-content: center;
	z-index: 19;
	pointer-events: auto;
}

.plt-video-container .plt-volume-slider.show {
	display: flex;
}

.plt-video-container .plt-volume-slider input[type="range"] {
	width: 96px;
	height: 4px;
	transform: rotate(-90deg);
	background: rgba(255, 255, 255, 0.35);
	border-radius: 2px;
	outline: none;
	-webkit-appearance: none;
	appearance: none;
}

.plt-video-container .plt-volume-slider input[type="range"]::-webkit-slider-thumb {
	-webkit-appearance: none;
	appearance: none;
	width: 14px;
	height: 14px;
	background: #fff;
	border-radius: 50%;
	cursor: pointer;
}

.plt-video-container .plt-volume-slider input[type="range"]::-moz-range-thumb {
	width: 14px;
	height: 14px;
	background: #fff;
	border-radius: 50%;
	cursor: pointer;
	border: none;
}

/* --------------------------------------------
 * Desktop cue: play icon overlay on thumbnails
 * -------------------------------------------- */
@media (min-width: 769px) {
	.woocommerce-product-gallery__thumbnails li.plt-video-thumbnail,
	.flex-control-thumbs li.plt-video-thumbnail,
	.woocommerce-product-gallery__thumbnails .woocommerce-product-gallery__image.plt-video-thumbnail {
		position: relative !important;
	}

	.woocommerce-product-gallery__thumbnails li.plt-video-thumbnail::before,
	.flex-control-thumbs li.plt-video-thumbnail::before,
	.woocommerce-product-gallery__thumbnails .woocommerce-product-gallery__image.plt-video-thumbnail::before {
		content: '' !important;
		position: absolute !important;
		top: 50% !important;
		left: 50% !important;
		transform: translate(-50%, -50%) !important;
		width: 34px !important;
		height: 34px !important;
		border-radius: 50% !important;
		background: rgba(0, 0, 0, 0.65) !important;
		box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35) !important;
		z-index: 5 !important;
		pointer-events: none !important;
	}

	.woocommerce-product-gallery__thumbnails li.plt-video-thumbnail::after,
	.flex-control-thumbs li.plt-video-thumbnail::after,
	.woocommerce-product-gallery__thumbnails .woocommerce-product-gallery__image.plt-video-thumbnail::after {
		content: '' !important;
		position: absolute !important;
		top: 50% !important;
		left: 50% !important;
		transform: translate(-35%, -50%) !important;
		width: 0 !important;
		height: 0 !important;
		border-left: 12px solid rgba(255, 255, 255, 0.95) !important;
		border-top: 8px solid transparent !important;
		border-bottom: 8px solid transparent !important;
		z-index: 6 !important;
		pointer-events: none !important;
	}
}

