/**
 * Optional layout tweaks for variation gallery (vertical thumbs like many themes).
 * Adjust selectors if your theme nests .woocommerce-product-gallery differently.
 */
 .woocommerce-product-gallery{
	gap: 5px;
}
.single-product.woocommerce .woocommerce-product-gallery .flex-control-nav.flex-control-thumbs > li{
	width: 100%;
}

.single-product.woocommerce .woocommerce-product-gallery .flex-viewport{
	border: 2px solid #ddd;
	border-radius: 15px;
}

.single-product.woocommerce .woocommerce-product-gallery .flex-control-nav.flex-control-thumbs > li img{
	border: 2px solid #dddddd;
	border-radius: 15px;
}
.woocommerce-product-gallery__image a img{
	height: 600px !important;
	object-fit: cover;
}
@media (max-width: 768px) {
	.woocommerce-product-gallery__image a img {
		height: 350px !important;
		object-fit: cover;
	}
}
.single-product.woocommerce .woocommerce-product-gallery .flex-control-nav.flex-control-thumbs > li img.flex-active{
	border-color: #ff5101
}

.single-product .woocommerce-product-gallery .flex-control-nav.flex-control-thumbs {
	width: 88px;
	height: 100%;
	overflow-y: auto;
	display: flex;
	flex-direction: column;
	gap: 8px;
	margin: 0 12px 0 0;
	max-height: 600px;
}

/* ── Thumbnail arrow navigation (when JS wraps with .cs-thumb-nav) ── */

.cs-thumb-nav {
	width: 88px;
	margin: 0 12px 0 0;
	display: flex;
	flex-direction: column;
	position: relative;
	max-height: 600px;
}

.cs-thumb-nav .flex-control-nav.flex-control-thumbs {
	/* width: 100% !important; */
	/* margin: 0 !important; */
	/* flex: 1; */
	/* min-height: 0; */
	/* overflow-y: scroll; */
	/* scrollbar-width: none; */
	-ms-overflow-style: none;
}

.cs-thumb-nav .flex-control-nav.flex-control-thumbs::-webkit-scrollbar {
	display: none;
}

.cs-thumb-arrow {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 26px;
	flex-shrink: 0;
	background: rgba(0, 0, 0, 0.45);
	border: none;
	border-radius: 0;
	color: #fff;
	cursor: pointer;
	padding: 0;
	transition: opacity 0.25s, background 0.2s;
	position: absolute;
}

.cs-thumb-arrow:hover {
	background: rgba(0, 0, 0, 0.75);
}

.cs-thumb-arrow.cs-hidden {
	opacity: 0;
	pointer-events: none;
}

.cs-thumb-arrow--up {margin-bottom: 6px;left: 0;right: 0;}
.cs-thumb-arrow--down {margin-top: 6px;bottom: 0;left: 0;right: 0;}

.cs-thumb-arrow::before {
	content: '';
	border: solid #fff;
	border-width: 0 2px 2px 0;
	display: inline-block;
	padding: 4px;
}

.cs-thumb-arrow--up::before {
	transform: rotate(-135deg);
	margin-top: 3px;
}

.cs-thumb-arrow--down::before {
	transform: rotate(45deg);
	margin-bottom: 3px;
}

.single-product .woocommerce-product-gallery .flex-control-nav.flex-control-thumbs li {
	width: 100%;
	float: none;
	margin: 0;
}

.single-product .woocommerce-product-gallery .flex-viewport,
.single-product .woocommerce-product-gallery .woocommerce-product-gallery__wrapper {
	flex: 1;
	min-width: 0;
}

.single-product .woocommerce-product-gallery.images {
	display: flex;
	flex-direction: row-reverse;
	align-items: flex-start;
}

/* 单图变体：PHP 输出双 slide 骗过 WC 以启用 FlexSlider；视觉上只保留一张缩略图 */
.single-product .hello-variation-gallery--dupe-second-slide .flex-control-nav.flex-control-thumbs li:not( :first-child ) {
	display: none !important;
}


/* Admin — 产品编辑页变体相册（需在后台 enqueue 本文件） */
.hello-variation-gallery-field {
	margin: 0 0 12px;
	padding: 10px 12px;
	background: #f6f7f7;
	border: 1px solid #dcdcde;
	border-radius: 4px;
	box-sizing: border-box;
}

.hello-variation-gallery-field .form-field label {
	font-weight: 600;
}

.hello-variation-gallery-field .description {
	display: block;
	margin: 0.25em 0 0.5em;
	color: #646970;
	font-size: 12px;
	line-height: 1.45;
}

.hello-variation-gallery-field > p:last-of-type {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
	margin: 0 0 8px;
}

.hello-variation-gallery-preview {
	display: flex;
	flex-direction: row;
	flex-wrap: nowrap;
	align-items: center;
	gap: 8px;
	list-style: none;
	margin: 0;
	padding: 8px 10px;
	max-width: 100%;
	overflow-x: auto;
	overflow-y: hidden;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: thin;
	background: #fff;
	border: 1px solid #c3c4c7;
	border-radius: 4px;
	min-height: 72px;
	box-sizing: border-box;
}

.hello-variation-gallery-preview:empty {
	display: none;
	min-height: 0;
	padding: 0;
	border: none;
	background: transparent;
}

.hello-variation-gallery-preview li.hello-variation-gallery-item {
	flex: 0 0 auto;
	margin: 0 !important;
	padding: 0 !important;
	width: auto !important;
	max-width: none !important;
	float: none !important;
}

.hello-variation-gallery-item-inner {
	position: relative;
	display: block;
	line-height: 0;
}

.hello-variation-gallery-preview img {
	display: block;
	width: 56px;
	height: 56px;
	object-fit: cover;
	border-radius: 4px;
	border: 1px solid #c3c4c7;
}

.hello-variation-gallery-remove {
	position: absolute;
	top: -5px;
	right: -5px;
	width: 22px;
	height: 22px;
	padding: 0;
	margin: 0;
	border: none;
	border-radius: 50%;
	background: rgba(30, 30, 30, 0.78);
	color: #fff;
	font-size: 16px;
	line-height: 20px;
	text-align: center;
	cursor: pointer;
	z-index: 2;
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
	transition: background 0.15s ease, transform 0.1s ease;
}

.hello-variation-gallery-remove:hover,
.hello-variation-gallery-remove:focus {
	background: #b32d2e;
	color: #fff;
	outline: none;
}

.hello-variation-gallery-remove:focus-visible {
	box-shadow: 0 0 0 2px #fff, 0 0 0 4px #2271b1;
}

@media (max-width: 768px) {
	.single-product .woocommerce-product-gallery.images {
		flex-direction: column;
		align-items: stretch;
	}

	/* 横向单行缩略图：覆盖桌面「每列 100% 宽」规则，避免手机上竖条堆叠、裁切 */
	.single-product .woocommerce-product-gallery .flex-control-nav.flex-control-thumbs > li {
		width: auto !important;
		flex: 0 0 auto;
		float: none;
	}

	.single-product .woocommerce-product-gallery .flex-control-nav.flex-control-thumbs {
		flex-direction: row !important;
		flex-wrap: nowrap !important;
		width: 100% !important;
		max-width: 100%;
		max-height: none !important;
		height: auto !important;
		margin: 10px 0 0 !important;
		overflow-x: auto;
		overflow-y: hidden;
		-webkit-overflow-scrolling: touch;
		scrollbar-width: thin;
		gap: 8px;
		scroll-snap-type: x proximity;
		margin: 0 !important;
	}

	.single-product .woocommerce-product-gallery .flex-control-nav.flex-control-thumbs > li {
		scroll-snap-align: start;
	}

	.single-product .woocommerce-product-gallery .flex-control-nav.flex-control-thumbs > li img {
		width: 72px;
		height: 72px;
		object-fit: cover;
		display: block;
	}

	/* 箭头容器在手机上改为左右夹住横向列表 */
	.cs-thumb-nav {
		width: 100% !important;
		max-width: 100%;
		margin: 10px 0 0 !important;
		flex-direction: row !important;
		align-items: center;
		gap: 6px;
	}

	.cs-thumb-nav .flex-control-nav.flex-control-thumbs {
		flex: 1 1 auto !important;
		min-width: 0 !important;
		flex-direction: row !important;
		flex-wrap: nowrap !important;
		overflow-x: auto !important;
		overflow-y: hidden !important;
		max-height: none !important;
		margin: 0 !important;
	}

	.cs-thumb-arrow {
		width: 19px;
		height: 100%;
		flex-shrink: 0;
		margin: 0;
	}

	/* 手机上由 JS 复用上下按钮做左右滚，箭头旋转 90° */
	.cs-thumb-nav .cs-thumb-arrow--up::before {
		transform: rotate(135deg);
		margin-top: 0;
		margin-left: 2px;
	}

	.cs-thumb-nav .cs-thumb-arrow--down::before {
		transform: rotate(-45deg);
		margin-bottom: 0;
		margin-right: 2px;
	}
	.cs-thumb-arrow--up {left: 0;}
	.cs-thumb-arrow--down {right: 0;left: auto;}
}