/**
 * Frontend styles for WC Product Video Carousel
 *
 * @package Circulux_Product_Video_Gallery
 */

/* Swiper Gallery Styles */
/* Swiper Gallery Styles */
.woocommerce-product-gallery.circulux-pvc-swiper-gallery {
	position: relative;
	opacity: 1 !important;
	/* Ensure visibility */
}

/* 
 * We let the theme handle the width/float of .woocommerce-product-gallery and .images.
 * By adding the 'images' class in PHP, the theme's CSS should now apply correctly.
 */

.circulux-pvc-slider {
	width: 100%;
	position: relative;
	margin-bottom: 0;
}

.circulux-pvc-slider .swiper-wrapper {
	display: flex;
}

.circulux-pvc-slider .swiper-slide {
	width: 100%;
	height: auto;
	display: flex;
	align-items: center;
	justify-content: center;
	margin: 0;
	padding: 0;
}

.circulux-pvc-slide-content {
	width: 100%;
	position: relative;
	margin: 0;
	padding: 0;
}

.circulux-pvc-image-slide img {
	width: 100%;
	height: auto;
	display: block;
}

/* Video Slide Styles */
.circulux-pvc-video-slide {
	position: relative;
	margin: 0;
	padding: 0;
}

.circulux-pvc-video-container {
	position: relative;
	width: 100%;
	padding-bottom: 56.25%;
	/* 16:9 aspect ratio */
	height: 0;
	overflow: hidden;
	background: #000;
}

.circulux-pvc-video-container img {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.circulux-pvc-video-overlay {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(0, 0, 0, 0.3);
	cursor: pointer;
	z-index: 5;
	transition: background 0.3s ease;
}

.circulux-pvc-video-overlay:hover {
	background: rgba(0, 0, 0, 0.5);
}

.circulux-pvc-play-button {
	background: transparent;
	border: none;
	cursor: pointer;
	padding: 0;
	z-index: 6;
	transition: transform 0.2s;
	position: relative;
}

.circulux-pvc-play-button:hover {
	transform: scale(1.1);
}

.circulux-pvc-video-iframe {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	border: 0;
	z-index: 10;
}

.circulux-pvc-video-slide {
	position: relative;
	width: 100%;
	height: 0;
	overflow: hidden;
}

.circulux-pvc-video-wrapper {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
}

.circulux-pvc-main-video .circulux-pvc-video-thumbnail {
	width: 100%;
	height: 100%;
	object-fit: cover;
	position: absolute;
	top: 0;
	left: 0;
}

.circulux-pvc-play-button {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	background: transparent;
	border: none;
	cursor: pointer;
	padding: 0;
	z-index: 10;
	transition: transform 0.2s;
}

.circulux-pvc-play-button:hover {
	transform: translate(-50%, -50%) scale(1.1);
}

.circulux-pvc-play-button svg {
	width: 68px;
	height: 48px;
	transition: transform 0.2s;
}

.circulux-pvc-main-video .circulux-pvc-video-iframe {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	border: 0;
}

/* Swiper Navigation Arrows */
.swiper-button-next,
.swiper-button-prev {
	width: 44px;
	height: 44px;
	margin-top: -22px;
	z-index: 10;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: all 0.3s ease;
	background-color: transparent;
	/* Default */
}

.swiper-button-next {
	right: 10px;
}

.swiper-button-prev {
	left: 10px;
}

/* Keep Swiper icon inside arrow background */
.swiper-navigation-icon {
	width: 80% !important;
	height: 80% !important;
}

/* Custom pseudo-element arrows disabled after Swiper update. */

.circulux-pvc-arrow-default .swiper-button-next,
.circulux-pvc-arrow-default .swiper-button-prev {
	background-color: transparent !important;
	box-shadow: none !important;
}

.circulux-pvc-arrow-circle .swiper-button-next,
.circulux-pvc-arrow-circle .swiper-button-prev {
	border-radius: 50% !important;
	background-color: rgba(255, 255, 255, 0.9);
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.circulux-pvc-arrow-square .swiper-button-next,
.circulux-pvc-arrow-square .swiper-button-prev {
	border-radius: 0 !important;
	background-color: rgba(255, 255, 255, 0.9);
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.circulux-pvc-arrow-minimal .swiper-button-next,
.circulux-pvc-arrow-minimal .swiper-button-prev {
	background-color: transparent !important;
	box-shadow: none !important;
}

/* Custom minimal pseudo-element arrows disabled after Swiper update. */

/* Pagination */
.circulux-pvc-pagination {
	position: absolute;
	bottom: 10px;
	left: 50%;
	transform: translateX(-50%);
	z-index: 10;
}

.swiper-pagination-bullet {
	width: 8px;
	height: 8px;
	background: rgba(0, 0, 0, 0.3);
	opacity: 1;
	margin: 0 4px;
	cursor: pointer;
	transition: all 0.3s;
}

.swiper-pagination-bullet-active {
	background: #000;
	transform: scale(1.2);
}

.swiper-pagination-fraction {
	color: #000;
	font-size: 14px;
}

.swiper-pagination-progressbar {
	height: 4px;
	background: rgba(0, 0, 0, 0.1);
}

.swiper-pagination-progressbar-fill {
	background: #000;
	height: 100%;
}

/* Thumbnails */
.circulux-pvc-thumbnails {
	margin-top: 15px;
	width: 100%;
	clear: both;
}

.woocommerce-product-gallery .circulux-pvc-thumbnails {
	margin-top: 1em;
}

/* Thumbnail slider (only when more than 5 items) */
.circulux-pvc-thumbnails-slider {
	width: 100%;
}

.circulux-pvc-thumbnails-slider .swiper-slide {
	width: auto !important;
	flex-shrink: 0;
}

.circulux-pvc-thumbnails-slider .circulux-pvc-thumbnail-slide {
	max-width: 120px;
}

.circulux-pvc-thumbnail-slide {
	cursor: pointer;
	opacity: 0.6;
	transition: all 0.3s;
	border: 2px solid transparent;
}

.circulux-pvc-thumbnail-slide:hover,
.circulux-pvc-thumbnail-slide.swiper-slide-thumb-active,
.circulux-pvc-thumbnail-slide.active {
	opacity: 1;
	border-color: #000;
}

.circulux-pvc-thumbnail {
	width: 120px;
	height: 120px;
	display: block;
	object-fit: cover;
}

.circulux-pvc-video-thumbnail {
	position: relative;
}

.circulux-pvc-video-icon {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	color: #fff;
	background: rgba(0, 0, 0, 0.6);
	border-radius: 50%;
	width: 32px;
	height: 32px;
	display: flex;
	align-items: center;
	justify-content: center;
	pointer-events: none;
}

.circulux-pvc-video-icon svg {
	width: 16px;
	height: 16px;
}

/* Grid Layout for Thumbnails */
.circulux-pvc-thumbnails-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
	gap: 10px;
	margin-top: 15px;
}

.circulux-pvc-thumbnails-grid .circulux-pvc-thumbnail {
	width: 100px;
	height: 100px;
}

.circulux-pvc-thumbnails-grid .circulux-pvc-thumbnail-slide {
	width: 100%;
	opacity: 0.6;
	cursor: pointer;
	transition: all 0.3s;
	border: 2px solid transparent;
	position: relative;
}

.circulux-pvc-thumbnails-grid .circulux-pvc-thumbnail-slide:hover,
.circulux-pvc-thumbnails-grid .circulux-pvc-thumbnail-slide.active {
	opacity: 1;
	border-color: #000;
}

.circulux-pvc-thumbnails-grid .circulux-pvc-thumbnail {
	width: 100%;
	height: auto;
	display: block;
	/* max-width: 100px; */
	max-height: 100px;
	object-fit: cover;
}

/* Vertical layout */
/* Vertical layout */
.circulux-pvc-vertical {
	display: flex;
	gap: 15px;
	/* Increased gap slightly */
}

.circulux-pvc-vertical .circulux-pvc-slider {
	width: calc(100% - 120px - 15px);
	/* Full width minus thumbnails and gap */
	flex-grow: 1;
	order: 2;
	/* Default order, thumbnails first (left) */
}

.circulux-pvc-vertical .circulux-pvc-thumbnails {
	width: 120px;
	/* Fixed width exactly like competitor */
	margin-top: 0;
	order: 1;
	/* Left by default */
	flex-shrink: 0;
}

/* Vertical Right */
.circulux-pvc-vertical.circulux-pvc-right {
	flex-direction: row-reverse;
}

.circulux-pvc-vertical.circulux-pvc-right .circulux-pvc-slider {
	margin-right: 0;
}

/* Ensure vertical thumbnails take height */
.circulux-pvc-vertical .circulux-pvc-thumbnails-slider {
	/* Height will be handled by JS or max-height */
	height: 100%;
	max-height: 500px;
}

.circulux-pvc-vertical .circulux-pvc-thumbnails-slider .swiper-slide {
	width: 100% !important;
	/* Full width in vertical mode */
	height: auto !important;
	margin-bottom: 15px !important;
	/* Matching gap */
}

.circulux-pvc-vertical .circulux-pvc-thumbnail {
	width: 100% !important;
	height: 100%;
	/* Let JS control height or fill container if fixed */
	margin: 0;
	padding: 0;
	object-fit: cover;
	display: block;
}

/* RTL Support */
[dir="rtl"] .swiper-button-next {
	right: auto;
	left: 10px;
}

[dir="rtl"] .swiper-button-prev {
	left: auto;
	right: 10px;
}

/* RTL pseudo-element arrow overrides disabled after Swiper update. */

/* Responsive */
@media (max-width: 768px) {
	.circulux-pvc-vertical {
		flex-direction: column !important;
		/* Force vertical stacking on mobile */
	}

	.circulux-pvc-vertical .circulux-pvc-slider {
		width: 100%;
		order: 1;
	}

	.circulux-pvc-vertical .circulux-pvc-thumbnails {
		width: 100%;
		order: 2;
		height: auto;
	}

	.circulux-pvc-vertical .circulux-pvc-thumbnails-slider {
		height: auto;
	}

	.swiper-button-next,
	.swiper-button-prev {
		width: 36px;
		height: 36px;
	}

	.circulux-pvc-play-button svg {
		width: 48px;
		height: 34px;
	}
}

/* Vertical Thumbnails Arrows */
.circulux-pvc-vertical .circulux-pvc-thumbnails-slider .swiper-button-next,
.circulux-pvc-vertical .circulux-pvc-thumbnails-slider .swiper-button-prev {
	left: 50%;
	right: auto;
	transform: translateX(-50%) rotate(90deg);
	margin-top: 0 !important;
}

.circulux-pvc-vertical .circulux-pvc-thumbnails-slider .swiper-button-prev {
	top: 5px;
	bottom: auto;
}

.circulux-pvc-vertical .circulux-pvc-thumbnails-slider .swiper-button-next {
	bottom: 5px;
	top: auto;
}
