/* ============================================================
   Immersive Designer — Public Configurator Styles
   Design: glassmorphic floating panels over full-screen canvas
   ============================================================ */

/* ── App container ─────────────────────────────────────────── */
.idg-app {
	position: relative;
	width: 100%;
	height: calc(100dvh - 80px);
	min-height: 600px;
	overflow: visible;
	background: #EDECEA;
	font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", sans-serif;
}

/* ── 3D Canvas ─────────────────────────────────────────────── */
#idg-root-preview {
	position: absolute;
	inset: 0;
}

#idgApp {
	width: 100% !important;
	height: 100% !important;
	display: block;
}

/* ── Right floating panel ──────────────────────────────────── */
#idg-root-options {
	position: absolute;
	right: 24px;
	top: 50%;
	transform: translateY(-50%);
	z-index: 20;
	display: flex;
	flex-direction: column;
	gap: 10px;
	width: 256px;
}

/* ── Glassmorphic card ─────────────────────────────────────── */
.idg-panel-card {
	background: rgba(255, 255, 255, 0.95);
	backdrop-filter: blur(12px);
	-webkit-backdrop-filter: blur(12px);
	border-radius: 24px;
	box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(255,255,255,0.6);
	overflow: hidden;
}

/* ── Scrollable area ───────────────────────────────────────── */
.idg-panel-scroll {
	max-height: 420px;
	overflow-y: auto;
	scrollbar-width: thin;
	scrollbar-color: #e5e5e5 transparent;
}

.idg-panel-scroll::-webkit-scrollbar { width: 4px; }
.idg-panel-scroll::-webkit-scrollbar-track { background: transparent; }
.idg-panel-scroll::-webkit-scrollbar-thumb { background: #e5e5e5; border-radius: 2px; }

/* ── Option section ────────────────────────────────────────── */
.idg-opt-section {
	padding: 16px 20px 20px;
}

.idg-opt-section + .idg-opt-section {
	border-top: 1px solid #F3F4F6;
}

.idg-opt-section-hd {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 2px;
}

.idg-opt-label {
	font-size: 10px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.15em;
	color: #9CA3AF;
	margin: 0;
}

.idg-opt-sublabel {
	font-size: 13px;
	font-weight: 500;
	color: #374151;
	margin: 0 0 14px;
}

/* ── Current colour indicator ──────────────────────────────── */
.idg-current-swatch {
	width: 20px;
	height: 20px;
	border-radius: 50%;
	background: #2D9475;
	box-shadow: 0 0 0 2px white, 0 0 0 3px rgba(0,0,0,0.12);
	flex-shrink: 0;
	transition: background 0.2s;
}

/* ── Swatch grid ───────────────────────────────────────────── */
.idg-swatch-grid {
	display: grid;
	grid-template-columns: repeat(5, 1fr);
	gap: 8px;
}

/* ── Individual swatch button ──────────────────────────────── */
.idg-option-thumb {
	width: 100%;
	aspect-ratio: 1 / 1;
	border-radius: 50%;
	border: none;
	cursor: pointer;
	padding: 0;
	box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08);
	transition: transform 0.15s ease, box-shadow 0.15s ease;
	outline: none;
}

.idg-option-thumb:hover {
	transform: scale(1.12);
	box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.12);
}

.idg-option-thumb:active {
	transform: scale(0.95);
}

/* Selected state */
[class*="-selected-opt"].idg-option-thumb {
	box-shadow: 0 0 0 2px #fff, 0 0 0 4px #1A1A1A;
	transform: scale(1.12);
}

/* ── Footer card ───────────────────────────────────────────── */
.idg-footer-card {
	background: rgba(255, 255, 255, 0.95);
	backdrop-filter: blur(12px);
	-webkit-backdrop-filter: blur(12px);
	border-radius: 18px;
	box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.1), 0 0 0 1px rgba(255,255,255,0.6);
	padding: 12px 14px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
}

/* ── Price display ─────────────────────────────────────────── */
.idg-price-display {
	display: flex;
	align-items: baseline;
	gap: 3px;
	flex-shrink: 0;
}

.idg-currency {
	font-size: 11px;
	font-weight: 500;
	color: #6B7280;
}

#idg-conf-price {
	font-size: 18px;
	font-weight: 700;
	color: #1A1A1A;
	letter-spacing: -0.02em;
}

/* ── Add to Cart button ────────────────────────────────────── */
.idg-buy-btn {
	background: #1A1A1A;
	color: #fff;
	border: none;
	border-radius: 12px;
	padding: 9px 16px;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	cursor: pointer;
	transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
	white-space: nowrap;
}

.idg-buy-btn:hover {
	background: #374151;
	box-shadow: 0 6px 18px rgba(0, 0, 0, 0.28);
}

.idg-buy-btn:active {
	transform: scale(0.97);
}

.idg-buy-btn:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

.idg-buy-btn.loading {
	opacity: 0.7;
	cursor: wait;
}

/* ── Toast notification ────────────────────────────────────── */
.idg-toast {
	position: absolute;
	top: 20px;
	left: 50%;
	transform: translateX(-50%);
	z-index: 30;
	background: rgba(255, 255, 255, 0.96);
	backdrop-filter: blur(12px);
	-webkit-backdrop-filter: blur(12px);
	border-radius: 50px;
	padding: 10px 20px;
	box-shadow: 0 8px 30px rgba(0, 0, 0, 0.14), 0 0 0 1px rgba(0,0,0,0.06);
	font-size: 13px;
	font-weight: 500;
	color: #1A1A1A;
	white-space: nowrap;
	display: flex;
	align-items: center;
	gap: 10px;
}

.idg-toast a {
	color: #3B82F6;
	text-decoration: none;
	font-weight: 600;
}

.idg-toast a:hover {
	text-decoration: underline;
}

/* ── View preset pill bar ──────────────────────────────────── */
.idg-view-presets {
	position: absolute;
	bottom: 24px;
	left: 50%;
	transform: translateX(-50%);
	z-index: 20;
	display: flex;
	gap: 2px;
	background: rgba(255, 255, 255, 0.7);
	backdrop-filter: blur(12px);
	-webkit-backdrop-filter: blur(12px);
	border-radius: 50px;
	padding: 4px;
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1), 0 0 0 1px rgba(255, 255, 255, 0.6);
}

.idg-view-btn {
	padding: 6px 20px;
	border-radius: 50px;
	border: none;
	background: transparent;
	font-size: 12px;
	font-weight: 600;
	color: #6B7280;
	cursor: pointer;
	transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
	white-space: nowrap;
	line-height: 1;
}

.idg-view-btn:hover {
	background: white;
	color: #1A1A1A;
}

.idg-view-btn.active {
	background: #1A1A1A;
	color: white;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* ── Texture swatches ──────────────────────────────────────── */
.idg-option-thumb.idg-opt-type-texture {
	border-radius: 10px;
	background-size: cover !important;
	background-position: center !important;
}

/* ── Model loading overlay ─────────────────────────────────── */
.idg-pub-loading {
	position: absolute;
	inset: 0;
	z-index: 10;
	display: flex;
	align-items: center;
	justify-content: center;
	background: inherit;
}

.idg-pub-spinner {
	width: 36px;
	height: 36px;
	border: 3px solid rgba(255,255,255,0.3);
	border-top-color: rgba(255,255,255,0.9);
	border-radius: 50%;
	animation: idg-pub-spin 0.75s linear infinite;
}

@keyframes idg-pub-spin {
	to { transform: rotate(360deg); }
}

/* ── Model error overlay ───────────────────────────────────── */
.idg-pub-error {
	position: absolute;
	inset: 0;
	z-index: 10;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 8px;
	background: rgba(0,0,0,0.35);
	backdrop-filter: blur(6px);
	-webkit-backdrop-filter: blur(6px);
	color: #fff;
	text-align: center;
	padding: 24px;
}

.idg-pub-error-icon {
	font-size: 32px;
	opacity: 0.8;
}

.idg-pub-error p {
	margin: 0;
	font-size: 14px;
	font-weight: 500;
	opacity: 0.9;
}

/* ── Responsive — mobile ───────────────────────────────────── */
@media (max-width: 640px) {

	/* Stack canvas above options, full-page scroll */
	.idg-app {
		display: flex;
		flex-direction: column;
		height: auto;
	}

	/* Canvas section — takes top portion, contains its own presets via position:relative */
	#idg-root-preview {
		position: relative;
		inset: auto;
		width: 100%;
		height: 52dvh;
		min-height: 260px;
		flex-shrink: 0;
	}

	/* Options panel — flows below canvas, full width */
	#idg-root-options {
		position: relative;
		right: auto;
		top: auto;
		transform: none;
		width: 100%;
		padding: 12px 12px 16px;
		box-sizing: border-box;
	}

	.idg-panel-card {
		border-radius: 16px;
		width: 100%;
	}

	/* Let all sections show — page scrolls, no internal overflow */
	.idg-panel-scroll {
		max-height: none;
		overflow-y: visible;
	}

	.idg-footer-card {
		margin-top: 8px;
	}

	/* View presets sit at bottom of canvas section — anchored correctly since they're inside #idg-root-preview */
	.idg-view-presets {
		bottom: 12px;
	}

	.idg-view-btn {
		padding: 5px 12px;
		font-size: 11px;
	}

	/* Toast stays at top of app (over canvas) */
	.idg-toast {
		top: 12px;
		font-size: 12px;
		padding: 8px 14px;
	}
}

/* model-viewer fixes */
model-viewer#idgApp {
    width: 100% !important;
    height: 100% !important;
    display: block;
    pointer-events: auto;
}
/* Ensure model-viewer doesn't block sidebar interactions */
#idg-root-preview {
    pointer-events: auto;
}
#idg-root-options,
.idg-panel-card,
.idg-panel-scroll,
.idg-option-thumb,
.idg-buy-btn {
    pointer-events: auto !important;
}
/* replace the old loading spinner since model-viewer has its own */
#idg-model-loading { display: none !important; }
#idg-model-error { display: none !important; }

