/**
 * PDP product gallery — 1688-style vertical thumbs + main image
 *
 * WooCommerce core gallery CSS is dequeued; this file restores and enhances it.
 */

/* Gallery shell */
.product-detail-gallery .woocommerce-product-gallery {
	display: flex;
	flex-direction: row-reverse;
	align-items: flex-start;
	gap: 12px;
	width: 100%;
	max-width: 100%;
	opacity: 1 !important;
	position: relative;
}

.product-detail-gallery .woocommerce-product-gallery .flex-viewport {
	flex: 1 1 auto;
	min-width: 0;
	width: 100%;
	overflow: hidden;
	border: 1px solid var(--color-border);
	border-radius: 10px;
	background: #f8fafc;
}

.product-detail-gallery .woocommerce-product-gallery .woocommerce-product-gallery__wrapper {
	margin: 0;
	padding: 0;
}

/* Main slide image */
.product-detail-gallery .woocommerce-product-gallery__image {
	margin: 0;
}

.product-detail-gallery .woocommerce-product-gallery__image a {
	display: block;
	line-height: 0;
}

.product-detail-gallery .woocommerce-product-gallery__image img {
	display: block;
	width: 100%;
	height: auto;
	max-height: min(560px, 62vh);
	margin: 0 auto;
	object-fit: contain;
	border-radius: 10px;
	transition: transform 0.25s ease;
}

.product-detail-gallery .woocommerce-product-gallery__image:hover img {
	transform: scale(1.02);
}

.product-detail-gallery .woocommerce-product-gallery__image--placeholder {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 360px;
	background: #f2f4f7;
}

/* Before flexslider: only show first image in wrapper */
.product-detail-gallery .woocommerce-product-gallery:not(.flexslider) .woocommerce-product-gallery__wrapper > .woocommerce-product-gallery__image:nth-child(n + 2) {
	display: none;
}

/* Vertical thumbnail strip (left) */
.product-detail-gallery .woocommerce-product-gallery .flex-control-thumbs {
	display: flex;
	flex-direction: column;
	flex: 0 0 72px;
	width: 72px;
	max-height: min(560px, 62vh);
	margin: 0;
	padding: 4px 0;
	overflow-x: hidden;
	overflow-y: auto;
	list-style: none;
	scrollbar-width: none;
	-ms-overflow-style: none;
	scroll-behavior: smooth;
}

.product-detail-gallery .woocommerce-product-gallery .flex-control-thumbs::-webkit-scrollbar {
	display: none;
}

/* Thumb scroll arrows (absolutely positioned above/below thumbs area) */
.product-detail-gallery .woocommerce-product-gallery .thumbs-nav-btn {
	position: absolute;
	left: 0;
	z-index: 4;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 28px;
	height: 28px;
	border: 1px solid var(--color-border);
	border-radius: 50%;
	background: var(--color-bg);
	color: var(--color-text-muted);
	cursor: pointer;
	transition: all 0.2s ease;
}

.product-detail-gallery .woocommerce-product-gallery .thumbs-nav-btn--up {
	top: 0;
}

.product-detail-gallery .woocommerce-product-gallery .thumbs-nav-btn--down {
	bottom: 0;
}

.product-detail-gallery .woocommerce-product-gallery .thumbs-nav-btn:hover {
	border-color: var(--color-primary);
	color: var(--color-primary);
	background: var(--color-primary-light);
}

.product-detail-gallery .woocommerce-product-gallery .thumbs-nav-btn[disabled] {
	opacity: 0.3;
	cursor: not-allowed;
}

.product-detail-gallery .woocommerce-product-gallery .thumbs-nav-btn svg {
	width: 14px;
	height: 14px;
}

.product-detail-gallery .woocommerce-product-gallery .flex-control-thumbs li {
	float: none;
	width: 72px;
	height: 72px;
	margin: 0 0 8px;
	padding: 0;
	list-style: none;
}

.product-detail-gallery .woocommerce-product-gallery .flex-control-thumbs li:last-child {
	margin-bottom: 0;
}

.product-detail-gallery .woocommerce-product-gallery .flex-control-thumbs li img {
	display: block;
	width: 72px;
	height: 72px;
	margin: 0;
	padding: 2px;
	object-fit: cover;
	border: 2px solid transparent;
	border-radius: 6px;
	background: #fff;
	cursor: pointer;
	opacity: 0.72;
	transition: border-color 0.2s ease, opacity 0.2s ease;
}

.product-detail-gallery .woocommerce-product-gallery .flex-control-thumbs li img:hover,
.product-detail-gallery .woocommerce-product-gallery .flex-control-thumbs li img.flex-active {
	border-color: var(--color-primary);
	opacity: 1;
}

/* Zoom trigger — refined hover button with SVG icon */
.product-detail-gallery .woocommerce-product-gallery__trigger {
	position: absolute;
	right: 12px;
	bottom: 12px;
	z-index: 2;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.92);
	box-shadow: 0 2px 8px rgba(16, 24, 40, 0.1);
	text-indent: 0;
	opacity: 0;
	transform: scale(0.9);
	transition: opacity 0.2s ease, transform 0.2s ease;
	pointer-events: none;
}

.product-detail-gallery:hover .woocommerce-product-gallery__trigger {
	opacity: 1;
	transform: scale(1);
	pointer-events: auto;
}

.product-detail-gallery .woocommerce-product-gallery__trigger:hover {
	background: var(--color-primary);
	color: #fff;
}

.product-detail-gallery .woocommerce-product-gallery__trigger::before {
	content: none;
}

.product-detail-gallery .woocommerce-product-gallery__trigger svg {
	width: 16px;
	height: 16px;
	color: var(--color-text-muted);
}

.product-detail-gallery:hover .woocommerce-product-gallery__trigger svg,
.product-detail-gallery .woocommerce-product-gallery__trigger:hover svg {
	color: inherit;
}

/* Sale badge in gallery */
.product-detail-gallery .onsale {
	position: absolute;
	top: 12px;
	left: 88px;
	z-index: 3;
}

/* Flexslider arrows (if shown) */
.product-detail-gallery .woocommerce-product-gallery .flex-direction-nav a {
	width: 36px;
	height: 36px;
	margin: -18px 0 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.95);
	box-shadow: 0 4px 12px rgba(16, 24, 40, 0.12);
	color: #344054;
	font-size: 0;
	line-height: 36px;
	text-align: center;
}

@media (max-width: 768px) {
	.product-detail-gallery .woocommerce-product-gallery {
		flex-direction: column-reverse;
	}

	.product-detail-gallery .woocommerce-product-gallery .thumbs-nav-btn {
		display: none;
	}

	.product-detail-gallery .woocommerce-product-gallery .flex-control-thumbs {
		flex-direction: row;
		flex: none;
		width: 100%;
		max-height: none;
		overflow-x: auto;
		overflow-y: hidden;
		scrollbar-width: none;
		-ms-overflow-style: none;
	}

	.product-detail-gallery .woocommerce-product-gallery .flex-control-thumbs::-webkit-scrollbar {
		display: none;
	}

	.product-detail-gallery .woocommerce-product-gallery .flex-control-thumbs li {
		flex: 0 0 64px;
		width: 64px;
		height: 64px;
		margin: 0 8px 0 0;
	}

	.product-detail-gallery .woocommerce-product-gallery .flex-control-thumbs li img {
		width: 64px;
		height: 64px;
	}

	.product-detail-gallery .onsale {
		left: 12px;
	}
}

[data-theme="dark"] .product-detail-gallery .woocommerce-product-gallery .flex-viewport,
[data-theme="dark"] .product-detail-gallery .woocommerce-product-gallery__image--placeholder {
	background: rgba(255, 255, 255, 0.04);
}

[data-theme="dark"] .product-detail-gallery .woocommerce-product-gallery .flex-control-thumbs li img {
	background: #1f2937;
}
