/* ── Crop Avatar modal body ──────────────────────────────────
   Chrome (backdrop, centring, header) comes from Modal.Root.
   This module styles the editor viewport, the zoom row, and
   the footer actions. */

.body {
	display: flex;
	flex-direction: column;
	gap: 16px;
	padding: 0;
}

.description {
	margin: 0;
	font-size: 0.875rem;
	line-height: 1.4;
	color: var(--text-secondary);
}

/* ── Editor viewport ─────────────────────────────────────────
   Fixed-size square container. The image is absolutely
   positioned inside and transformed via JS state (pan / zoom /
   rotate). The circular crop mask is a sibling element that
   casts a huge outer box-shadow to dim everything outside the
   ring. */

.editor {
	position: relative;
	align-self: center;
	background-color: #000;
	border-radius: 8px;
	overflow: hidden;
	cursor: grab;
	touch-action: none;
	user-select: none;
	-webkit-user-select: none;
}

.editor:active {
	cursor: grabbing;
}

.editorImage {
	position: absolute;
	left: 50%;
	top: 50%;
	transform-origin: center center;
	pointer-events: none;
	max-width: none;
	max-height: none;
	/* Prevent the browser from smoothing natural-size pixels
	   into a blur when the user zooms hard — on a 512px output
	   we'd rather have slightly crunchy pixels than mush. */
	image-rendering: auto;
}

.cropMask {
	position: absolute;
	top: 50%;
	left: 50%;
	width: 100%;
	height: 100%;
	transform: translate(-50%, -50%);
	border-radius: 50%;
	border: 2px solid rgba(255, 255, 255, 0.85);
	box-sizing: border-box;
	pointer-events: none;
	/* A massive outer box-shadow acts as the "outside the
	   circle is dark" overlay. 9999px is hand-wavy but it only
	   needs to exceed the max viewport dimension to look clean,
	   which it always will. */
	box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.6);
}

/* ── Zoom row ────────────────────────────────────────────── */

.zoomRow {
	display: flex;
	align-items: center;
	gap: 12px;
}

.zoomLabel {
	font-size: 0.75rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: var(--text-primary-muted, #a0a3a8);
	flex-shrink: 0;
}

.zoomSlider {
	flex: 1;
	height: 4px;
	-webkit-appearance: none;
	appearance: none;
	background-color: var(--background-modifier-accent);
	border-radius: 999px;
	cursor: pointer;
	outline: none;
}

.zoomSlider:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

.zoomSlider::-webkit-slider-thumb {
	-webkit-appearance: none;
	width: 14px;
	height: 14px;
	border-radius: 50%;
	background: var(--brand-primary);
	cursor: pointer;
	border: none;
}

.zoomSlider::-moz-range-thumb {
	width: 14px;
	height: 14px;
	border-radius: 50%;
	background: var(--brand-primary);
	cursor: pointer;
	border: none;
}

.iconButton {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 34px;
	padding: 0;
	background: transparent;
	border: none;
	border-radius: 6px;
	color: var(--text-primary-muted, #a0a3a8);
	cursor: pointer;
	transition: background-color 0.12s, color 0.12s;
}

.iconButton:hover:not(:disabled) {
	background-color: var(--background-modifier-hover);
	color: var(--text-primary);
}

.iconButton:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

/* ── Inline error row ────────────────────────────────────── */

.error {
	padding: 10px 14px;
	background-color: hsl(0, calc(60% * var(--saturation-factor, 1)), 22%);
	color: hsl(0, calc(80% * var(--saturation-factor, 1)), 85%);
	border-radius: 6px;
	font-size: 0.8125rem;
}

/* ── Footer action row ────────────────────────────────────
   Reset sits hard-left, a flex spacer pushes Cancel / Skip /
   Save to the right end. Matches the Fluxer reference image
   exactly. */

.actions {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-top: 4px;
}

.actionsSpacer {
	flex: 1;
}

.resetButton {
	height: 40px;
	padding: 0 18px;
	background: var(--background-secondary-alt);
	border: none;
	border-radius: 6px;
	color: var(--text-primary);
	font: inherit;
	font-size: 0.875rem;
	font-weight: 700;
	cursor: pointer;
	transition: background-color 0.12s;
}

.resetButton:hover:not(:disabled) {
	background-color: var(--background-modifier-hover);
}

.resetButton:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

.secondaryButton {
	height: 40px;
	padding: 0 18px;
	background: transparent;
	border: none;
	border-radius: 6px;
	color: var(--text-primary);
	font: inherit;
	font-size: 0.875rem;
	font-weight: 600;
	cursor: pointer;
	transition: background-color 0.12s;
}

.secondaryButton:hover:not(:disabled) {
	background-color: var(--background-modifier-hover);
}

.tertiaryButton {
	height: 40px;
	padding: 0 18px;
	background: var(--background-secondary-alt);
	border: none;
	border-radius: 6px;
	color: var(--text-primary);
	font: inherit;
	font-size: 0.875rem;
	font-weight: 700;
	cursor: pointer;
	transition: background-color 0.12s;
}

.tertiaryButton:hover:not(:disabled) {
	background-color: var(--background-modifier-hover);
}

.primaryButton {
	height: 40px;
	padding: 0 20px;
	background-color: var(--brand-primary);
	border: none;
	border-radius: 6px;
	color: var(--text-on-brand-primary, #fff);
	font: inherit;
	font-size: 0.875rem;
	font-weight: 700;
	cursor: pointer;
	transition: filter 0.12s;
}

.primaryButton:hover:not(:disabled) {
	filter: brightness(1.08);
}

.primaryButton:active:not(:disabled) {
	filter: brightness(0.92);
}

.primaryButton:disabled {
	opacity: 0.55;
	cursor: not-allowed;
}

.secondaryButton:disabled,
.tertiaryButton:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}
