/* Custom Product Gallery - Vertical Thumbnails on Right */

/* Main gallery container */
.woocommerce-product-gallery.custom-vertical-gallery {
	display: flex;
	flex-direction: row;
	gap: 20px;
	position: relative;
}

/* Main image container */
.woocommerce-product-gallery.custom-vertical-gallery .woocommerce-product-gallery__wrapper {
	flex: 1;
	order: 1;
	position: relative;
}

/* Thumbnails container - vertical layout */
.woocommerce-product-gallery.custom-vertical-gallery .flex-control-thumbs {
	display: flex !important;
	flex-direction: column;
	gap: 15px;
	order: 2;
	width: 120px;
	flex-shrink: 0;
	margin: 0 !important;
	padding: 0;
	list-style: none;
	max-height: 600px;
	overflow-y: auto;
	overflow-x: hidden;
	scrollbar-width: thin;
	scrollbar-color: #ccc transparent;
}

.woocommerce-product-gallery.custom-vertical-gallery .flex-control-thumbs::-webkit-scrollbar {
	width: 4px;
}

.woocommerce-product-gallery.custom-vertical-gallery .flex-control-thumbs::-webkit-scrollbar-track {
	background: transparent;
}

.woocommerce-product-gallery.custom-vertical-gallery .flex-control-thumbs::-webkit-scrollbar-thumb {
	background: #ccc;
	border-radius: 2px;
}

.woocommerce-product-gallery.custom-vertical-gallery .flex-control-thumbs::-webkit-scrollbar-thumb:hover {
	background: #999;
}

/* Individual thumbnail */
.woocommerce-product-gallery.custom-vertical-gallery .flex-control-thumbs li {
	width: 100% !important;
	margin: 0 !important;
	padding: 0;
	float: none;
}

.woocommerce-product-gallery.custom-vertical-gallery .flex-control-thumbs li img {
	width: 100%;
	height: auto;
	border: 2px solid transparent;
	border-radius: 4px;
	cursor: pointer;
	transition: all 0.3s ease;
	display: block;
}

.woocommerce-product-gallery.custom-vertical-gallery .flex-control-thumbs li img:hover {
	border-color: #999;
	opacity: 0.8;
}

.woocommerce-product-gallery.custom-vertical-gallery .flex-control-thumbs li img.flex-active {
	border-color: #333;
}

/* Navigation arrows for thumbnails */
.woocommerce-product-gallery.custom-vertical-gallery .thumbnails-nav {
	display: flex;
	flex-direction: column;
	order: 2;
	width: 30px;
	flex-shrink: 0;
	justify-content: center;
	gap: 10px;
	padding: 0 5px;
}

.woocommerce-product-gallery.custom-vertical-gallery .thumbnails-nav-button {
	background: #fff;
	border: 1px solid #ddd;
	border-radius: 4px;
	width: 30px;
	height: 30px;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	transition: all 0.3s ease;
	color: #333;
	font-size: 16px;
	line-height: 1;
	padding: 0;
}

.woocommerce-product-gallery.custom-vertical-gallery .thumbnails-nav-button:hover {
	background: #f5f5f5;
	border-color: #999;
}

.woocommerce-product-gallery.custom-vertical-gallery .thumbnails-nav-button:disabled {
	opacity: 0.3;
	cursor: not-allowed;
}

/* Hide default horizontal thumbnails if they exist */
.woocommerce-product-gallery.custom-vertical-gallery .flex-control-nav.flex-control-thumbs {
	display: flex !important;
}

/* RTL Support */
.rtl .woocommerce-product-gallery.custom-vertical-gallery {
	flex-direction: row-reverse;
}

.rtl .woocommerce-product-gallery.custom-vertical-gallery .woocommerce-product-gallery__wrapper {
	order: 2;
}

.rtl .woocommerce-product-gallery.custom-vertical-gallery .flex-control-thumbs {
	order: 1;
}

/* For block-based gallery (FSE) */
.wp-block-woocommerce-product-image-gallery {
	position: relative;
}

.wp-block-woocommerce-product-image-gallery .woocommerce-product-gallery {
	display: flex;
	flex-direction: row;
	gap: 10px;
	align-items: flex-start;
}

.wp-block-woocommerce-product-image-gallery .woocommerce-product-gallery__wrapper {
	flex: 1;
	order: 1;
	min-width: 0; /* Allow flex item to shrink */
	margin-right: 0;
	width: 100%;
	display: block;
	max-height: 600px;
	overflow: hidden;
	text-align: center;
}

/* Hide original thumbnail images in block gallery (they are moved to thumbnails container) */
/* But keep them in DOM for JavaScript to access - use display none but keep in flexslider */
.wp-block-woocommerce-product-image-gallery .woocommerce-product-gallery__wrapper .woocommerce-product-gallery__image:not(:first-child) {
	display: block !important;
}

/* Also hide images outside wrapper that are not main image */
.wp-block-woocommerce-product-image-gallery .woocommerce-product-gallery > .woocommerce-product-gallery__image:not(:first-child) {
	display: none !important;
}

/* Main image stays visible - only first image in wrapper */
.wp-block-woocommerce-product-image-gallery .woocommerce-product-gallery__wrapper .woocommerce-product-gallery__image:first-child {
	display: block !important;
}

.wp-block-woocommerce-product-image-gallery .woocommerce-product-gallery__wrapper .woocommerce-product-gallery__image {
	width: 100%;
	height: auto;
	display: block;
}

.wp-block-woocommerce-product-image-gallery .woocommerce-product-gallery__wrapper .woocommerce-product-gallery__image img {
	width: 100%;
	height: auto;
	max-height: 600px;
	display: block;
	object-fit: contain;
	margin: 0 auto;
}

/* Thumbnails wrapper container */
.wp-block-woocommerce-product-image-gallery .thumbnails-wrapper {
	display: flex;
	flex-direction: column;
	gap: 10px;
	align-items: center;
	order: 2;
	flex-shrink: 0;
	width: 120px;
	min-width: 120px;
	position: relative;
	padding-bottom: 35px;
}

/* Thumbnails wrapper for block gallery */
.wp-block-woocommerce-product-image-gallery .woocommerce-product-gallery__thumbnails {
	display: flex !important;
	flex-direction: column;
	gap: 10px;
	width: 100%;
	flex-shrink: 0;
	max-height: 600px;
	overflow-y: auto;
	overflow-x: hidden;
	scrollbar-width: thin;
	scrollbar-color: #ccc transparent;
	margin: 0;
	padding: 0;
	list-style: none;
	order: 1;
}

.wp-block-woocommerce-product-image-gallery .woocommerce-product-gallery__thumbnails::-webkit-scrollbar {
	width: 4px;
}

.wp-block-woocommerce-product-image-gallery .woocommerce-product-gallery__thumbnails::-webkit-scrollbar-thumb {
	background: #ccc;
	border-radius: 2px;
}

.wp-block-woocommerce-product-image-gallery .woocommerce-product-gallery__thumbnails .thumbnail-item {
	width: 100%;
	margin: 0;
	padding: 0;
	flex-shrink: 0;
	height: 120px;
	overflow: hidden;
}

.wp-block-woocommerce-product-image-gallery .woocommerce-product-gallery__thumbnails img {
	width: 100%;
	height: 120px;
	object-fit: cover;
	border: 2px solid transparent;
	border-radius: 4px;
	cursor: pointer;
	transition: all 0.3s ease;
	display: block;
}

.wp-block-woocommerce-product-image-gallery .woocommerce-product-gallery__thumbnails img:hover {
	border-color: #999;
	opacity: 0.8;
}

.wp-block-woocommerce-product-image-gallery .woocommerce-product-gallery__thumbnails img.active {
	border-color: #333;
}

/* Navigation for block gallery - positioned absolutely below thumbnails, horizontal layout */
.wp-block-woocommerce-product-image-gallery .thumbnails-wrapper .thumbnails-nav {
	display: flex;
	flex-direction: row;
	width: 100%;
	flex-shrink: 0;
	justify-content: center;
	gap: 6px;
	padding: 0;
	margin: 0;
	position: absolute;
	bottom: 0;
	left: 0;
	right: 0;
	order: 2;
}

.wp-block-woocommerce-product-image-gallery .thumbnails-nav-button {
	background: #fff;
	border: 1px solid #e0e0e0;
	border-radius: 2px;
	width: 24px;
	height: 24px;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	transition: all 0.2s ease;
	color: #666;
	font-size: 12px;
	line-height: 1;
	padding: 0;
	flex-shrink: 0;
	box-shadow: none;
}

.wp-block-woocommerce-product-image-gallery .thumbnails-nav-button:hover {
	background: #f8f8f8;
	border-color: #ccc;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.wp-block-woocommerce-product-image-gallery .thumbnails-nav-button:disabled {
	opacity: 0.3;
	cursor: not-allowed;
}

/* RTL Support for block gallery */
.rtl .wp-block-woocommerce-product-image-gallery .woocommerce-product-gallery {
	flex-direction: row-reverse;
}

.rtl .wp-block-woocommerce-product-image-gallery .woocommerce-product-gallery__wrapper {
	order: 1;
}

.rtl .wp-block-woocommerce-product-image-gallery .thumbnails-wrapper {
	order: 2;
}

/* Responsive */
@media (max-width: 768px) {
	.woocommerce-product-gallery.custom-vertical-gallery {
		flex-direction: column;
	}

	.woocommerce-product-gallery.custom-vertical-gallery .flex-control-thumbs {
		flex-direction: row;
		width: 100%;
		max-height: none;
		overflow-x: auto;
		overflow-y: hidden;
		order: 2;
	}

	.woocommerce-product-gallery.custom-vertical-gallery .woocommerce-product-gallery__wrapper {
		order: 1;
	}

	.woocommerce-product-gallery.custom-vertical-gallery .thumbnails-nav {
		display: none;
	}

	/* Block gallery responsive */
	.wp-block-woocommerce-product-image-gallery .woocommerce-product-gallery {
		flex-direction: column;
		gap: 15px;
	}

	.wp-block-woocommerce-product-image-gallery .woocommerce-product-gallery__wrapper {
		order: 1;
		width: 100% !important;
	}

	.wp-block-woocommerce-product-image-gallery .thumbnails-wrapper {
		order: 2;
		width: 100%;
	}

	.wp-block-woocommerce-product-image-gallery .woocommerce-product-gallery__thumbnails {
		flex-direction: row;
		width: 100%;
		max-height: none;
		overflow-x: auto;
		overflow-y: hidden;
		order: 1;
	}

	.wp-block-woocommerce-product-image-gallery .thumbnails-nav {
		order: 2;
		display: flex;
	}
}

