/**
 * Multiview gallery lightbox and inline view switcher.
 *
 * @package CustomProductBuilderProWC
 */

/* Gallery lightbox — all canvas views (light product-page style) */
.cpbpwc-mv-gallery {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 24px 16px;
	box-sizing: border-box;
}

.cpbpwc-mv-gallery__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(15, 23, 42, 0.45);
	backdrop-filter: blur(6px);
	-webkit-backdrop-filter: blur(6px);
}

.cpbpwc-mv-gallery__panel {
	position: relative;
	display: flex;
	flex-direction: column;
	width: min(720px, 100%);
	max-height: min(90vh, 820px);
	margin: 0 auto;
	background: #ffffff;
	color: #0f172a;
	border-radius: 18px;
	box-shadow: 0 28px 80px rgba(15, 23, 42, 0.28), 0 0 0 1px rgba(15, 23, 42, 0.06);
	overflow: hidden;
	font-family: var(--cpb-font-sans);
}

.cpbpwc-mv-gallery__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 18px 22px 14px;
	border-bottom: 1px solid #eef2f7;
	flex-shrink: 0;
	background: #fafbfc;
}

.cpbpwc-mv-gallery__title {
	margin: 0;
	font-size: 1.05rem;
	font-weight: 700;
	letter-spacing: -0.02em;
	color: #0f172a;
	flex: 1;
	min-width: 0;
}

.cpbpwc-mv-gallery__head-right {
	display: flex;
	align-items: center;
	gap: 10px;
	flex-shrink: 0;
}

.cpbpwc-mv-gallery__addtocart {
	appearance: none;
	border: 0;
	border-radius: 10px;
	padding: 10px 18px;
	font-size: 0.875rem;
	font-weight: 600;
	cursor: pointer;
	background: #0f172a;
	color: #ffffff;
	box-shadow: 0 2px 8px rgba(15, 23, 42, 0.18);
	transition: background 0.15s ease, transform 0.15s ease;
	font-family: inherit;
}

.cpbpwc-mv-gallery__addtocart:hover:not(:disabled) {
	background: #1e293b;
}

.cpbpwc-mv-gallery__addtocart:disabled {
	opacity: 0.6;
	cursor: wait;
}

.cpbpwc-mv-gallery__close {
	border: 0;
	background: #f1f5f9;
	width: 36px;
	height: 36px;
	font-size: 1.35rem;
	line-height: 1;
	cursor: pointer;
	color: #64748b;
	padding: 0;
	border-radius: 10px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	transition: background 0.15s ease, color 0.15s ease;
}

.cpbpwc-mv-gallery__close:hover {
	color: #0f172a;
	background: #e2e8f0;
}

.cpbpwc-mv-gallery__stage {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	padding: 20px 16px 8px;
	flex: 1;
	min-height: 0;
	background: linear-gradient(180deg, #f8fafc 0%, #ffffff 55%);
}

.cpbpwc-mv-gallery__nav {
	flex-shrink: 0;
	width: 42px;
	height: 42px;
	border-radius: 50%;
	border: 1px solid #e2e8f0;
	background: #ffffff;
	color: #334155;
	font-size: 1.05rem;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
	transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.cpbpwc-mv-gallery__nav:hover:not(:disabled) {
	background: #f8fafc;
	border-color: #cbd5e1;
	color: #0f172a;
}

.cpbpwc-mv-gallery__nav:disabled {
	opacity: 0.3;
	cursor: not-allowed;
	box-shadow: none;
}

.cpbpwc-mv-gallery__frame {
	flex: 1;
	min-width: 0;
	max-height: min(48vh, 420px);
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 8px;
}

.cpbpwc-mv-gallery__main {
	max-width: 100%;
	max-height: min(48vh, 420px);
	width: auto;
	height: auto;
	object-fit: contain;
	border-radius: 12px;
	box-shadow: 0 12px 36px rgba(15, 23, 42, 0.12);
	background: #ffffff;
	border: 1px solid #eef2f7;
}

.cpbpwc-mv-gallery__placeholder {
	display: none;
	max-width: 100%;
	padding: 48px 24px;
	text-align: center;
	color: #94a3b8;
	font-size: 0.95rem;
	line-height: 1.5;
}

.cpbpwc-mv-gallery__caption {
	margin: 0;
	padding: 6px 20px 12px;
	text-align: center;
	font-size: 0.8rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: #64748b;
	flex-shrink: 0;
}

.cpbpwc-mv-gallery__strip-wrap {
	padding: 12px 16px 18px;
	border-top: 1px solid #eef2f7;
	background: #fafbfc;
	flex-shrink: 0;
}

.cpbpwc-mv-gallery__strip {
	display: flex;
	gap: 10px;
	overflow-x: auto;
	overflow-y: hidden;
	padding: 2px 2px 6px;
	scroll-snap-type: x mandatory;
	-webkit-overflow-scrolling: touch;
	justify-content: center;
}

.cpbpwc-mv-gallery__thumb {
	flex: 0 0 auto;
	width: 72px;
	height: 72px;
	padding: 0;
	border: 2px solid #e2e8f0;
	border-radius: 12px;
	overflow: hidden;
	cursor: pointer;
	background: #ffffff;
	scroll-snap-align: start;
	transition: border-color 0.15s, box-shadow 0.15s;
	box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

.cpbpwc-mv-gallery__thumb:hover {
	border-color: #cbd5e1;
}

.cpbpwc-mv-gallery__thumb.is-active {
	border-color: #0f172a;
	box-shadow: 0 0 0 2px rgba(15, 23, 42, 0.12);
}

.cpbpwc-mv-gallery__thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.cpbpwc-mv-gallery__thumb-ph {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
	font-size: 1.25rem;
	color: #94a3b8;
}

body.cpbpwc-mv-gallery-open {
	overflow: hidden;
}

/* jQuery fadeIn sets display:block — keep centered flex layout while open */
body.cpbpwc-mv-gallery-open .cpbpwc-mv-gallery {
	display: flex !important;
	align-items: center;
	justify-content: center;
}

/* Single-product preview: one main design + thumbnail strip (stacked file is cart-only). */
.cpbpwc-inline-mv {
	width: 100%;
	max-width: 100%;
}

.cpbpwc-inline-mv__main {
	width: 100%;
	height: auto;
	display: block;
	border-radius: 4px;
	background: #fff;
}

.cpbpwc-inline-mv__strip {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: 12px;
	justify-content: flex-start;
}

.cpbpwc-inline-mv__thumb {
	appearance: none;
	border: 2px solid #e2e8f0;
	border-radius: 6px;
	padding: 0;
	background: #fff;
	cursor: pointer;
	width: 64px;
	height: 64px;
	overflow: hidden;
	flex-shrink: 0;
	transition: border-color 0.15s, box-shadow 0.15s;
}

.cpbpwc-inline-mv__thumb:hover {
	border-color: #cbd5e1;
}

.cpbpwc-inline-mv__thumb.is-active {
	border-color: #0f172a;
	box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.15);
}

.cpbpwc-inline-mv__thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.cpbpwc-mv-gallery__addtocart .cpbpwc-loader {
	display: inline-block;
	vertical-align: middle;
	margin-right: 6px;
}

@media (max-width: 600px) {
	.cpbpwc-mv-gallery {
		padding: 12px 10px;
	}

	.cpbpwc-mv-gallery__panel {
		border-radius: 14px;
		max-height: 94vh;
	}

	.cpbpwc-mv-gallery__head {
		padding: 14px 14px 12px;
	}

	.cpbpwc-mv-gallery__stage {
		flex-wrap: wrap;
		padding: 14px 10px 6px;
	}

	.cpbpwc-mv-gallery__nav {
		order: 2;
	}

	.cpbpwc-mv-gallery__frame {
		order: 1;
		flex: 1 1 100%;
		max-height: 42vh;
	}

	.cpbpwc-mv-gallery__nav--prev {
		order: 3;
	}

	.cpbpwc-mv-gallery__nav--next {
		order: 4;
	}

	.cpbpwc-mv-gallery__strip {
		justify-content: flex-start;
	}
}

/* Rounded custom side-view dropdown (Simple + Advanced builders) */
.cpb-side-select-enhanced {
	position: relative;
	z-index: 55;
	overflow: visible;
}

.cpb-side-select-enhanced .cpb-side-select-native {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
	opacity: 0;
	pointer-events: none;
}

.cpb-side-select-ui {
	position: relative;
	min-width: 120px;
	overflow: visible;
	z-index: 56;
}

.cpb-side-select-trigger {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	width: 100%;
	min-width: 112px;
	height: 36px;
	padding: 0 12px;
	border: 1px solid #e2e8f0;
	border-radius: 8px;
	background: #ffffff;
	color: #0f172a;
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
	box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
	font-family: inherit;
}

.cpb-side-select-trigger:hover {
	border-color: #cbd5e1;
}

.cpb-side-select-trigger-icon {
	display: inline-flex;
	align-items: center;
	flex-shrink: 0;
	width: 18px;
	height: 18px;
	color: #64748b;
}

.cpb-side-select-trigger-icon svg {
	width: 18px;
	height: 18px;
	display: block;
}

.cpb-side-select-trigger-label {
	flex: 1;
	min-width: 0;
	text-align: left;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.cpb-side-select-menu {
	display: none;
	position: absolute;
	top: calc(100% + 6px);
	left: 0;
	right: 0;
	min-width: 100%;
	margin: 0;
	padding: 6px;
	list-style: none;
	background: #ffffff;
	border: 1px solid #e2e8f0;
	border-radius: 10px;
	box-shadow: 0 12px 32px rgba(15, 23, 42, 0.14);
	z-index: 80;
}

.cpb-side-select-menu.is-open {
	display: block;
}

.cpb-side-select-menu li[role='option'] {
	padding: 8px 12px;
	border-radius: 8px;
	font-size: 13px;
	font-weight: 500;
	color: #334155;
	cursor: pointer;
}

.cpb-side-select-menu li[role='option']:hover {
	background: #f1f5f9;
	color: #0f172a;
}

.cpb-side-select-menu li[role='option'].is-selected {
	background: #dbeafe;
	color: #1d4ed8;
	font-weight: 600;
}

.cpb-side-select-wrap {
	display: none;
}

.cpb-side-select-wrap.cpb-side-select-visible {
	display: inline-flex;
	align-items: center;
}

.cpb-side-select-segments {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	padding: 3px;
	background: #f1f5f9;
	border-radius: 10px;
}

.cpb-side-select-segment {
	appearance: none;
	border: 0;
	background: transparent;
	color: #64748b;
	font-size: 12px;
	font-weight: 600;
	padding: 7px 12px;
	border-radius: 8px;
	cursor: pointer;
	font-family: inherit;
}

.cpb-side-select-segment.is-active {
	background: #ffffff;
	color: #0f172a;
	box-shadow: 0 1px 3px rgba(15, 23, 42, 0.1);
}
