/* Override --roomtryon-accent from the theme to match the store's colors. */
.roomtryon-open {
	margin-top: 1em;
}

.roomtryon-dialog {
	--roomtryon-accent: #2f3237;
	--roomtryon-line: #e2e2e2;
	--roomtryon-soft: #f4f3f1;
	box-sizing: border-box;
	width: min(1040px, calc(100% - 32px));
	max-height: calc(100dvh - 32px);
	padding: 28px;
	overflow: auto;
	color: var(--roomtryon-accent);
	background: #fff;
	border: 0;
	border-radius: 12px;
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
}

.roomtryon-dialog[open] {
	display: grid;
	grid-template-columns: minmax(0, 1fr) 300px;
	grid-template-areas: "title title" "stage panel";
	gap: 16px 28px;
	align-items: start;
}

.roomtryon-dialog [hidden] {
	display: none !important;
}

.roomtryon-dialog::backdrop {
	background: rgba(0, 0, 0, 0.6);
}

.roomtryon-dialog *,
.roomtryon-dialog *::before {
	box-sizing: border-box;
}

.roomtryon-dialog form {
	position: absolute;
	top: 10px;
	right: 10px;
	margin: 0;
}

.roomtryon-dialog .roomtryon-close,
.roomtryon-dialog .roomtryon-zoom button,
.roomtryon-dialog .roomtryon-compare button {
	margin: 0;
	padding: 0;
	color: inherit;
	font: inherit;
	letter-spacing: normal;
	text-transform: none;
	background: none;
	border: 0;
	border-radius: 0;
	box-shadow: none;
	cursor: pointer;
}

.roomtryon-dialog .roomtryon-close {
	width: 44px;
	height: 44px;
	font-size: 28px;
	line-height: 1;
	border-radius: 50%;
}

.roomtryon-dialog .roomtryon-close:hover {
	background: var(--roomtryon-soft);
}

.roomtryon-dialog h2 {
	grid-area: title;
	margin: 0;
	padding-right: 40px;
	font-size: 22px;
	line-height: 1.3;
	letter-spacing: normal;
	text-transform: none;
}

/* Stage: drop zone, then the photo or the preview. */
.roomtryon-stage {
	grid-area: stage;
	position: relative;
	height: min(68vh, 600px);
	overflow: hidden;
	background: var(--roomtryon-soft);
	border-radius: 10px;
}

.roomtryon-file {
	position: absolute;
	width: 1px;
	height: 1px;
	opacity: 0;
	overflow: hidden;
	clip-path: inset(50%);
}

.roomtryon-dialog .roomtryon-drop {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 8px;
	margin: 0;
	padding: 24px;
	text-align: center;
	border: 2px dashed #c9c6c1;
	border-radius: 10px;
	cursor: pointer;
	transition: border-color 0.15s, background-color 0.15s;
}

.roomtryon-drop strong {
	font-size: 17px;
}

.roomtryon-drop span {
	max-width: 30em;
	font-size: 14px;
	opacity: 0.7;
}

.roomtryon-hint-touch {
	display: none;
}

.roomtryon-tip {
	margin-top: 4px;
	padding: 6px 12px;
	font-size: 14px;
	font-style: normal;
	background: #fff;
	border-radius: 6px;
}

@media (hover: none) {
	.roomtryon-hint-pointer {
		display: none;
	}

	.roomtryon-hint-touch {
		display: inline;
	}
}

.roomtryon-dialog .roomtryon-close:focus:not(:focus-visible) {
	outline: none;
	box-shadow: none;
}

.roomtryon-drop:hover,
.roomtryon-stage.is-dragging .roomtryon-drop {
	background: #ecebe8;
	border-color: var(--roomtryon-accent);
}

/* Inside the stage, which clips anything drawn outside it. */
.roomtryon-file:focus-visible + .roomtryon-drop,
.roomtryon-viewer:focus-visible {
	outline: 3px solid var(--roomtryon-accent);
	outline-offset: -3px;
}

.roomtryon-dialog:has(.roomtryon-file:focus-visible) .roomtryon-change {
	outline: 2px solid var(--roomtryon-accent);
	outline-offset: 2px;
}

.roomtryon-viewer {
	position: absolute;
	inset: 0;
	overflow: hidden;
	cursor: zoom-in;
	touch-action: pan-y; /* Not zoomed: a swipe scrolls the dialog on phones. */
}

.roomtryon-viewer.is-zoomed {
	cursor: grab;
	touch-action: none;
}

.roomtryon-viewer.is-zoomed:active {
	cursor: grabbing;
}

.roomtryon-viewer img {
	display: block;
	width: 100%;
	max-width: none;
	height: 100%;
	object-fit: contain;
	transform-origin: 0 0;
	user-select: none;
	-webkit-user-drag: none;
}

.roomtryon-busy {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(255, 255, 255, 0.55);
	backdrop-filter: blur(3px);
}

.roomtryon-spinner {
	width: 48px;
	height: 48px;
	border: 4px solid rgba(0, 0, 0, 0.12);
	border-top-color: var(--roomtryon-accent);
	border-radius: 50%;
	animation: roomtryon-spin 0.9s linear infinite;
}

@keyframes roomtryon-spin {
	to {
		transform: rotate(360deg);
	}
}

@media (prefers-reduced-motion: reduce) {
	.roomtryon-spinner {
		animation-duration: 3s;
	}
}

.roomtryon-zoom {
	position: absolute;
	right: 12px;
	bottom: 12px;
	display: flex;
	padding: 2px;
	background: #fff;
	border-radius: 999px;
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
}

.roomtryon-dialog .roomtryon-zoom button {
	width: 40px;
	height: 40px;
	font-size: 20px;
	line-height: 40px;
	border-radius: 50%;
}

.roomtryon-dialog .roomtryon-zoom button:disabled {
	opacity: 0.3;
	cursor: default;
}

/* Panel */
.roomtryon-panel {
	grid-area: panel;
	display: flex;
	flex-direction: column;
	gap: 14px;
	font-size: 14px;
	line-height: 1.45;
}

.roomtryon-product {
	display: flex;
	align-items: center;
	gap: 12px;
	padding-bottom: 14px;
	border-bottom: 1px solid var(--roomtryon-line);
}

.roomtryon-product img {
	flex: none;
	width: 64px;
	height: 64px;
	object-fit: cover;
	border-radius: 8px;
}

.roomtryon-product strong {
	display: block;
	font-size: 15px;
	line-height: 1.3;
}

.roomtryon-dialog p {
	margin: 0;
}

.roomtryon-option {
	margin-top: 2px !important;
	opacity: 0.7;
}

.roomtryon-option:empty,
.roomtryon-status:empty {
	display: none;
}

.roomtryon-dialog .roomtryon-change {
	align-self: flex-start;
	margin: 0;
	padding: 8px 16px;
	border: 1px solid var(--roomtryon-line);
	border-radius: 6px;
	cursor: pointer;
}

.roomtryon-dialog .roomtryon-change:hover {
	border-color: var(--roomtryon-accent);
}

.roomtryon-note {
	font-size: 13px;
	opacity: 0.75;
}

.roomtryon-dialog .roomtryon-consent-label {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	margin: 0;
	cursor: pointer;
}

.roomtryon-consent {
	flex: none;
	width: 18px;
	height: 18px;
	margin: 1px 0 0;
	accent-color: var(--roomtryon-accent);
}

.roomtryon-dialog .roomtryon-generate,
.roomtryon-dialog .roomtryon-download {
	width: 100%;
	margin: 0;
	text-align: center;
}

.roomtryon-dialog .roomtryon-generate:disabled {
	opacity: 0.45;
	cursor: not-allowed;
}

.roomtryon-result {
	display: flex;
	flex-direction: column;
	gap: 10px;
	padding-top: 14px;
	border-top: 1px solid var(--roomtryon-line);
}

.roomtryon-compare {
	position: absolute;
	top: 12px;
	left: 12px;
	display: flex;
	padding: 3px;
	font-size: 14px;
	background: #fff;
	border-radius: 999px;
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
}

.roomtryon-dialog .roomtryon-compare button {
	padding: 7px 14px;
	border-radius: 999px;
}

.roomtryon-dialog .roomtryon-compare button[aria-pressed="true"] {
	color: #fff;
	background: var(--roomtryon-accent);
}

/* Phones: full screen, photo first. */
@media (max-width: 767px) {
	.roomtryon-dialog {
		width: 100%;
		max-width: none;
		height: 100dvh;
		max-height: none;
		margin: 0;
		padding: 16px;
		border-radius: 0;
	}

	.roomtryon-dialog[open] {
		grid-template-columns: minmax(0, 1fr);
		grid-template-areas: "title" "stage" "panel";
		align-content: start;
	}

	.roomtryon-stage {
		height: 55dvh;
	}
}
