/**
 * ImageToolkit Pro Background Remover - styles.
 * Everything is scoped under .itpbr so it cannot clash with your theme.
 */

.itpbr {
	--itpbr-accent: #6366f1;
	--itpbr-accent-soft: #f8fbff;
	--itpbr-accent-edge: #c7d2fe;
	--itpbr-accent-focus: #a5b4fc;
	--itpbr-text: #111827;
	--itpbr-muted: #6b7280;
	--itpbr-line: #e5e7eb;
	--itpbr-bg: #f9fafb;
	--itpbr-green: #15803d;
	--itpbr-green-dark: #166534;
	--itpbr-radius: 14px;

	max-width: 1100px;
	margin: 20px auto;
	padding: 10 12px;
	color: var(--itpbr-text);
	font-size: 16px;
	line-height: 1.5;
	box-sizing: border-box;
}

/* Newer browsers: tints are made from the main color you pick in the settings. */
@supports (color: color-mix(in srgb, red 10%, white)) {
	.itpbr {
		--itpbr-accent-soft: color-mix(in srgb, var(--itpbr-accent) 12%, #fff);
		--itpbr-accent-edge: color-mix(in srgb, var(--itpbr-accent) 45%, #fff);
		--itpbr-accent-focus: color-mix(in srgb, var(--itpbr-accent) 55%, #fff);
	}
}

.itpbr *,
.itpbr *::before,
.itpbr *::after {
	box-sizing: border-box;
}

.itpbr [hidden] {
	display: none !important;
}

.itpbr-icon {
	flex: none;
	width: 1em;
	height: 1em;
}

/* ---------- heading and messages ---------- */

.itpbr-head {
	margin-bottom: 20px;
	text-align: center;
}

.itpbr-title {
	margin: 0 0 6px;
	font-size: clamp(1.6rem, 4vw, 2.2rem);
	line-height: 1.2;
	color: var(--itpbr-text);
}

.itpbr-subtitle {
	margin: 0;
	color: var(--itpbr-muted);
	font-size: 1.05rem;
}

.itpbr-notice {
	margin: 0 0 16px;
	padding: 12px 16px;
	border-radius: 12px;
	border: 1px solid #bfdbfe;
	background: #eff6ff;
	color: #1e3a8a;
}

.itpbr-notice.is-error {
	border-color: #fecaca;
	background: #fef2f2;
	color: #991b1b;
}

.itpbr-notice.is-success {
	border-color: #bbf7d0;
	background: #f0fdf4;
	color: #166534;
}

/* ---------- buttons ---------- */

.itpbr-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 10px 20px;
	font: inherit;
	font-weight: 600;
	line-height: 1.3;
	text-decoration: none;
	color: #fff;
	background: var(--itpbr-accent);
	border: 2px solid transparent;
	border-radius: 12px;
	cursor: pointer;
	transition: filter 0.15s, transform 0.15s, background-color 0.15s;
}

.itpbr-btn:hover {
	filter: brightness(0.93);
}

.itpbr-btn:active {
	transform: translateY(1px);
}

.itpbr-btn-lg {
	padding: 14px 28px;
	font-size: 1.05rem;
}

.itpbr-btn-success {
	background: var(--itpbr-green);
}

.itpbr-btn-ghost {
	color: var(--itpbr-text);
	background: #fff;
	border-color: var(--itpbr-line);
}

.itpbr-btn-ghost:hover {
	background: #f3f4f6;
	filter: none;
}

.itpbr-btn-block {
	display: flex;
	width: 100%;
}

.itpbr-btn:disabled {
	opacity: 0.45;
	cursor: not-allowed;
	filter: none;
}

.itpbr-link {
	padding: 0;
	font: inherit;
	color: var(--itpbr-accent);
	background: none;
	border: 0;
	text-decoration: underline;
	cursor: pointer;
}

/* ---------- step 1: choose a picture ---------- */


.itpbr-drop {
    padding: 30px 20px 30px;
    text-align: center;
    background: linear-gradient(180deg, #f8fbff, #f8fbff);
    border: 1px dashed #b8c8df;
    border-radius: 22px;
    margin-bottom: 16px;
    transition: border-color 0.2s, background-color 0.2s, transform 0.2s;
}

.itpbr.is-dragover .itpbr-drop {
	border-color: var(--itpbr-accent);
	background: var(--itpbr-accent-soft);
	transform: scale(1.01);
}

.itpbr-drop-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 68px;
	height: 68px;
	margin-bottom: 10px;
	color: var(--itpbr-accent);
	background: #fff;
	border-radius: 50%;
	box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
}

.itpbr-drop-icon .itpbr-icon {
	width: 32px;
	height: 32px;
}

.itpbr-drop-title {
	margin: 0;
	font-size: 1.5rem;
	line-height: 1.3;
	color: var(--itpbr-text);
}

.itpbr-drop-sub {
	margin: 4px 0 18px;
	color: var(--itpbr-muted);
}

.itpbr-hint {
	margin: 14px 0 0;
	font-size: 0.875rem;
	color: var(--itpbr-muted);
}

.itpbr-points {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 12px;
	margin: 18px 0 12px;
	padding: 12px;
	list-style: none;
}

.itpbr-points li {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 12px;
	font-weight: 600;
	font-size: 0.95rem;
	background: var(--itpbr-bg);
	border: 1px solid var(--itpbr-line);
	border-radius: 12px;
}

.itpbr-points .itpbr-icon {
	color: var(--itpbr-accent);
}

.itpbr-privacy {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	margin: 16px 0 0;
	font-size: 0.9rem;
	color: var(--itpbr-green);
}

/* ---------- step 2: editor ---------- */

.itpbr-topbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 12px;
}

.itpbr-filename {
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	font-weight: 600;
	color: var(--itpbr-muted);
}

.itpbr-layout {
	display: grid;
	grid-template-columns: minmax(0, 1fr) 330px;
	gap: 20px;
	align-items: start;
}

/* toolbar */

.itpbr-toolbar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px 14px;
	margin-bottom: 10px;
	padding: 8px 10px;
	background: #fff;
	border: 1px solid var(--itpbr-line);
	border-radius: var(--itpbr-radius);
}

.itpbr-group {
	display: inline-flex;
	align-items: center;
	gap: 4px;
}

.itpbr-right {
	margin-left: auto;
}

.itpbr-tool,
.itpbr-iconbtn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	min-height: 38px;
	padding: 0 12px;
	font: inherit;
	font-size: 0.9rem;
	font-weight: 600;
	color: var(--itpbr-text);
	background: transparent;
	border: 1px solid transparent;
	border-radius: 10px;
	cursor: pointer;
}

.itpbr-iconbtn {
	width: 38px;
	padding: 0;
}

.itpbr-tool:hover,
.itpbr-iconbtn:hover {
	background: #f3f4f6;
}

.itpbr-tool.is-active {
	color: #fff;
	background: var(--itpbr-accent);
}

.itpbr-iconbtn:disabled {
	opacity: 0.35;
	cursor: not-allowed;
	background: transparent;
}

.itpbr-zoom {
	min-width: 46px;
	text-align: center;
	font-size: 0.85rem;
	font-weight: 600;
	color: var(--itpbr-muted);
}

.itpbr-size {
	display: inline-flex;
	align-items: center;
	gap: 8px;
}

.itpbr-size-label {
	font-size: 0.85rem;
	font-weight: 600;
	color: var(--itpbr-muted);
}

.itpbr-size input[type="range"] {
	width: 110px;
}

/* picture area */

.itpbr-view {
	position: relative;
}

.itpbr-viewport {
	display: flex;
	height: min(68vh, 620px);
	min-height: 300px;
	padding: 12px;
	overflow: auto;
	background: #eef0f4;
	border: 1px solid var(--itpbr-line);
	border-radius: var(--itpbr-radius);
}

.itpbr-stage {
	position: relative;
	flex: none;
	margin: auto;
	line-height: 0;
	box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12);
}

.itpbr-canvas {
	display: block;
	width: 100%;
	height: auto;
	cursor: grab;
	touch-action: none; /* a finger paints or drags instead of scrolling the page */
}

.itpbr.is-erase .itpbr-canvas,
.itpbr.is-restore .itpbr-canvas {
	cursor: crosshair;
}

.itpbr.is-comparing .itpbr-canvas {
	cursor: ew-resize;
}

/* grey and white squares behind see-through pictures */
.itpbr-checker {
	background-color: #fff;
	background-image:
		linear-gradient(45deg, #d9dde3 25%, transparent 25%),
		linear-gradient(-45deg, #d9dde3 25%, transparent 25%),
		linear-gradient(45deg, transparent 75%, #d9dde3 75%),
		linear-gradient(-45deg, transparent 75%, #d9dde3 75%);
	background-size: 20px 20px;
	background-position: 0 0, 0 10px, 10px -10px, -10px 0;
}

.itpbr-original {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	pointer-events: none;
	clip-path: inset(0 calc(100% - var(--itpbr-split, 50%)) 0 0);
}

.itpbr-split {
	position: absolute;
	top: 0;
	bottom: 0;
	left: var(--itpbr-split, 50%);
	width: 3px;
	margin-left: -1.5px;
	background: #fff;
	box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35);
	pointer-events: none;
}

.itpbr-split-handle {
	position: absolute;
	top: 50%;
	left: 50%;
	width: 34px;
	height: 34px;
	margin: -17px 0 0 -17px;
	background: #fff;
	border-radius: 50%;
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}

.itpbr-split-handle::before,
.itpbr-split-handle::after {
	content: "";
	position: absolute;
	top: 50%;
	width: 0;
	height: 0;
	margin-top: -5px;
	border: 5px solid transparent;
}

.itpbr-split-handle::before {
	left: 5px;
	border-right-color: #6b7280;
}

.itpbr-split-handle::after {
	right: 5px;
	border-left-color: #6b7280;
}

.itpbr-ring {
	position: absolute;
	z-index: 3;
	pointer-events: none;
	border: 2px solid #fff;
	border-radius: 50%;
	box-shadow: 0 0 0 1px #000;
	transform: translate(-50%, -50%);
}

/* "working" cover */

.itpbr-busy {
	position: absolute;
	inset: 0;
	z-index: 5;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
	background: rgba(255, 255, 255, 0.86);
	border-radius: var(--itpbr-radius);
}

.itpbr-busy-card {
	width: min(100%, 340px);
	padding: 24px;
	text-align: center;
	background: #fff;
	border: 1px solid var(--itpbr-line);
	border-radius: 18px;
	box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
}

.itpbr-spinner {
	width: 40px;
	height: 40px;
	margin: 0 auto 12px;
	border: 4px solid var(--itpbr-accent-soft);
	border-top-color: var(--itpbr-accent);
	border-radius: 50%;
	animation: itpbr-spin 0.8s linear infinite;
}

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

.itpbr-busy-title {
	margin: 0 0 12px;
	font-weight: 600;
}

.itpbr-bar {
	height: 8px;
	overflow: hidden;
	background: var(--itpbr-line);
	border-radius: 99px;
}

.itpbr-bar-fill {
	display: block;
	width: 0;
	height: 100%;
	background: var(--itpbr-accent);
	border-radius: 99px;
	transition: width 0.2s;
}

.itpbr-busy.is-error .itpbr-spinner,
.itpbr-busy.is-error .itpbr-bar {
	display: none;
}

.itpbr-busy-error {
	display: flex;
	flex-direction: column;
	gap: 8px;
	margin-top: 12px;
}

.itpbr-tip {
	margin: 10px 2px 0;
	font-size: 0.875rem;
	color: var(--itpbr-muted);
}

/* ---------- side panel ---------- */

.itpbr-panel {
	display: grid;
	gap: 14px;
}

.itpbr-box {
	padding: 16px;
	background: #fff;
	border: 1px solid var(--itpbr-line);
	border-radius: var(--itpbr-radius);
}

.itpbr-box-title {
	margin: 0 0 12px;
	font-size: 1rem;
	line-height: 1.3;
	color: var(--itpbr-text);
}

.itpbr-swatches {
	display: grid;
	grid-template-columns: repeat(7, 1fr);
	gap: 8px;
}

.itpbr-swatch {
	width: 100%;
	aspect-ratio: 1;
	padding: 0;
	border: 2px solid #fff;
	border-radius: 50%;
	box-shadow: 0 0 0 1px var(--itpbr-line);
	cursor: pointer;
}

.itpbr-swatch.is-active {
	box-shadow: 0 0 0 3px var(--itpbr-accent);
}

.itpbr-swatch[data-bg="transparent"] {
	background-color: #fff;
	background-image:
		linear-gradient(45deg, #cbd0d8 25%, transparent 25%),
		linear-gradient(-45deg, #cbd0d8 25%, transparent 25%),
		linear-gradient(45deg, transparent 75%, #cbd0d8 75%),
		linear-gradient(-45deg, transparent 75%, #cbd0d8 75%);
	background-size: 10px 10px;
	background-position: 0 0, 0 5px, 5px -5px, -5px 0;
}

.itpbr-swatch[data-bg="#ffffff"] { background: #ffffff; }
.itpbr-swatch[data-bg="#000000"] { background: #000000; }
.itpbr-swatch[data-bg="#e5e7eb"] { background: #e5e7eb; }
.itpbr-swatch[data-bg="#ef4444"] { background: #ef4444; }
.itpbr-swatch[data-bg="#f59e0b"] { background: #f59e0b; }
.itpbr-swatch[data-bg="#22c55e"] { background: #22c55e; }
.itpbr-swatch[data-bg="#3b82f6"] { background: #3b82f6; }
.itpbr-swatch[data-bg="#8b5cf6"] { background: #8b5cf6; }
.itpbr-swatch[data-bg="#ec4899"] { background: #ec4899; }
.itpbr-swatch[data-bg="g1"] { background: linear-gradient(135deg, #f6d365, #fda085); }
.itpbr-swatch[data-bg="g2"] { background: linear-gradient(135deg, #4facfe, #00f2fe); }
.itpbr-swatch[data-bg="g3"] { background: linear-gradient(135deg, #43e97b, #38f9d7); }

.itpbr-bgrow {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: 12px;
}

.itpbr-chip {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	min-height: 36px;
	padding: 0 12px;
	font: inherit;
	font-size: 0.875rem;
	font-weight: 600;
	color: var(--itpbr-text);
	background: #fff;
	border: 1px solid var(--itpbr-line);
	border-radius: 99px;
	cursor: pointer;
}

.itpbr-chip:hover {
	background: #f3f4f6;
}

.itpbr-chip.is-active {
	color: var(--itpbr-accent);
	background: var(--itpbr-accent-soft);
	border-color: var(--itpbr-accent);
}

.itpbr-chip input[type="color"] {
	width: 22px;
	height: 22px;
	padding: 0;
	background: none;
	border: 0;
	border-radius: 50%;
	cursor: pointer;
}

.itpbr-slider,
.itpbr-field {
	display: block;
	margin-top: 12px;
}

.itpbr-slider:first-of-type {
	margin-top: 0;
}

.itpbr-slider-label {
	display: block;
	margin-bottom: 4px;
	font-size: 0.875rem;
	font-weight: 600;
}

.itpbr input[type="range"] {
	width: 100%;
	margin: 0;
	accent-color: var(--itpbr-accent);
}

.itpbr select {
	display: block;
	width: 100%;
	min-height: 44px;
	padding: 0 12px;
	font: inherit;
	color: var(--itpbr-text);
	background: #fff;
	border: 2px solid var(--itpbr-line);
	border-radius: 10px;
}

.itpbr-check {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	margin-top: 14px;
	font-size: 0.925rem;
	cursor: pointer;
}

.itpbr-check input {
	flex: none;
	width: 18px;
	height: 18px;
	margin: 3px 0 0;
	accent-color: var(--itpbr-accent);
}

.itpbr-out {
	min-height: 2.8em;
	margin: 10px 0 12px;
	font-size: 0.85rem;
	color: var(--itpbr-muted);
}

/* keyboard focus is always visible */
.itpbr button:focus-visible,
.itpbr input:focus-visible,
.itpbr select:focus-visible,
.itpbr canvas:focus-visible,
.itpbr label:focus-within > input[type="color"] {
	outline: 3px solid var(--itpbr-accent-focus);
	outline-offset: 2px;
}

/* ---------- small screens ---------- */

@media (max-width: 900px) {
	.itpbr-layout {
		grid-template-columns: minmax(0, 1fr);
	}

	/* a slim download bar that stays in reach while scrolling */
	.itpbr-download {
		position: sticky;
		bottom: 8px;
		z-index: 6;
		display: flex;
		flex-wrap: wrap;
		align-items: flex-end;
		gap: 8px 10px;
		padding: 10px;
		box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.14);
	}

	.itpbr-download .itpbr-box-title {
		display: none;
	}

	.itpbr-download .itpbr-field {
		flex: 0 0 112px;
		margin: 0;
	}

	/* the "Format" label stays available to screen readers */
	.itpbr-download .itpbr-field .itpbr-slider-label {
		position: absolute;
		width: 1px;
		height: 1px;
		margin: 0;
		overflow: hidden;
		clip: rect(0, 0, 0, 0);
		white-space: nowrap;
	}

	.itpbr-download .itpbr-btn {
		flex: 1;
		width: auto;
		margin: 0;
	}

	.itpbr-download .itpbr-out {
		flex: 1 1 100%;
		order: 3;
		min-height: 0;
		margin: 0;
		font-size: 0.75rem;
	}

	.itpbr-viewport {
		height: min(60vh, 520px);
	}
}

@media (max-width: 600px) {
	.itpbr-points {
		grid-template-columns: 1fr;
	}

	.itpbr-drop {
		padding: 34px 14px 26px;
	}

	.itpbr-tool span {
		display: none; /* icons only, to save space */
	}

	.itpbr-tool {
		width: 44px;
		padding: 0;
	}

	.itpbr-tool,
	.itpbr-iconbtn {
		min-height: 44px;
	}

	.itpbr-iconbtn {
		width: 44px;
	}

	.itpbr-right {
		margin-left: 0;
	}

	.itpbr-size {
		flex: 1 1 100%;
	}

	.itpbr-size input[type="range"] {
		flex: 1;
		width: auto;
	}

	.itpbr-swatches {
		grid-template-columns: repeat(6, 1fr);
	}
}

@media (prefers-reduced-motion: reduce) {
	.itpbr-spinner {
		animation-duration: 2.5s;
	}

	.itpbr-btn,
	.itpbr-drop,
	.itpbr-bar-fill {
		transition: none;
	}
}
