/**
 * Custom Product Gallery — desktop vertical / mobile horizontal carousel
 */

.cvw-gallery {
	--cvw-red: #e10024;
	--cvw-gray: #d9d9d9;
	--cvw-black: #111111;
	--cvw-font: "pyda", sans-serif;
	direction: rtl;
	font-family: var(--cvw-font);
	width: 100%;
	max-width: 100%;
}

.cvw-gallery__layout {
	display: flex;
	flex-direction: row;
	align-items: flex-start;
	gap: 16px;
}

.cvw-gallery__main {
	flex: 1;
	min-width: 0;
	background: #ffffff;
	border-radius: 12px;
	overflow: hidden;
	display: flex;
	align-items: center;
	justify-content: center;
	order: 2;
}

.cvw-gallery__main-img {
	display: block;
	width: 100%;
	height: auto;
	max-height: 520px;
	object-fit: contain;
}

.cvw-gallery__thumbs-column {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 8px;
	flex-shrink: 0;
	width: 90px;
	order: 1;
}

.cvw-gallery__thumbs-viewport {
	width: 90px;
	max-height: 360px;
	overflow-x: hidden;
	overflow-y: auto;
	scroll-behavior: smooth;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: none;
}

.cvw-gallery__thumbs-viewport::-webkit-scrollbar {
	display: none;
}

.cvw-gallery__thumbs-track {
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.cvw-gallery__thumb {
	display: block;
	width: 80px;
	height: 80px;
	padding: 4px;
	border: 2px solid transparent;
	border-radius: 8px;
	background: #ffffff;
	cursor: pointer;
	overflow: hidden;
	flex-shrink: 0;
	transition: border-color 0.2s ease;
}

.cvw-gallery__thumb.is-active {
	border-color: var(--cvw-red);
}

.cvw-gallery__thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	border-radius: 4px;
	display: block;
}

.cvw-gallery__nav {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 28px;
	border: 1px solid var(--cvw-gray);
	border-radius: 6px;
	background: #ffffff;
	color: var(--cvw-black);
	cursor: pointer;
	padding: 0;
	transition: background 0.2s ease;
}

.cvw-gallery__nav:hover {
	background: #f5f5f5;
}

.cvw-gallery__nav:disabled {
	opacity: 0.35;
	cursor: default;
}

/* Mobile: thumbs below main image, horizontal carousel */
@media (max-width: 767px) {
	.cvw-gallery__layout {
		flex-direction: column;
	}

	.cvw-gallery__main {
		order: 1;
	}

	.cvw-gallery__main-img {
		max-height: 340px;
	}

	.cvw-gallery__thumbs-column {
		order: 2;
		flex-direction: row;
		width: 100%;
		max-width: 100%;
	}

	.cvw-gallery__thumbs-viewport {
		width: 100%;
		max-width: calc(100% - 80px);
		max-height: none;
		overflow-x: auto;
		overflow-y: hidden;
		-webkit-overflow-scrolling: touch;
		scrollbar-width: none;
	}

	.cvw-gallery__thumbs-viewport::-webkit-scrollbar {
		display: none;
	}

	.cvw-gallery__thumbs-track {
		flex-direction: row;
		width: max-content;
	}

	.cvw-gallery__nav--prev svg {
		transform: rotate(90deg);
	}

	.cvw-gallery__nav--next svg {
		transform: rotate(90deg);
	}
}
