/* Background gradient sidebar panel */

.fi-bg-panel {
	display: flex;
	flex-direction: column;
	min-height: 0;
	height: 100%;
	padding: 0 0 12px;
}

.fi-bg-panel__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	padding: 0 14px 10px;
	border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.fi-bg-panel__tabs {
	display: inline-flex;
	gap: 2px;
	padding: 3px;
	border-radius: 8px;
	background: rgba(255, 255, 255, 0.04);
}

.fi-bg-panel__tab {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	padding: 5px 10px;
	border: 0;
	border-radius: 6px;
	background: transparent;
	color: rgba(244, 244, 245, 0.55);
	font: inherit;
	font-size: 0.72rem;
	font-weight: 500;
	cursor: pointer;
	transition: background 0.15s ease, color 0.15s ease;
}

.fi-bg-panel__tab.is-active {
	background: rgba(255, 255, 255, 0.08);
	color: #f4f4f5;
}

.fi-bg-panel__save {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	padding: 5px 10px;
	border: 0;
	border-radius: 8px;
	background: var(--xfp-accent, #2f6fed);
	color: #fff;
	font: inherit;
	font-size: 0.72rem;
	font-weight: 600;
	cursor: pointer;
	transition: background 0.15s ease, opacity 0.15s ease;
}

.fi-bg-panel__save:hover {
	background: var(--xfp-accent-hover, #3b82f6);
}

.fi-bg-panel__save:disabled {
	opacity: 0.45;
	cursor: default;
}

.fi-bg-panel__body {
	flex: 1 1 auto;
	min-height: 0;
	overflow-y: auto;
	padding: 12px 14px 0;
}

.fi-bg-panel__tabpanel[hidden] {
	display: none !important;
}

.fi-bg-panel__hint {
	margin: 0;
	font-size: 0.78rem;
	line-height: 1.45;
	color: var(--it-muted, rgba(244, 244, 245, 0.5));
}

.fi-bg-field {
	display: flex;
	flex-direction: column;
	gap: 6px;
	margin-bottom: 14px;
}

.fi-bg-field__label {
	font-size: 0.68rem;
	font-weight: 600;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: rgba(244, 244, 245, 0.45);
}

.fi-bg-field__select {
	width: 100%;
	padding: 8px 10px;
	border: 1px solid rgba(255, 255, 255, 0.1);
	border-radius: 8px;
	background: rgba(0, 0, 0, 0.22);
	color: #f4f4f5;
	font: inherit;
	font-size: 0.82rem;
}

.fi-bg-solid {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-bottom: 14px;
}

.fi-bg-solid__pick {
	width: 36px;
	height: 36px;
	padding: 0;
	border: 1px solid rgba(255, 255, 255, 0.14);
	border-radius: 8px;
	background: transparent;
	cursor: pointer;
}

.fi-bg-solid__hex {
	flex: 1 1 auto;
	min-width: 0;
	padding: 8px 10px;
	border: 1px solid rgba(255, 255, 255, 0.1);
	border-radius: 8px;
	background: rgba(0, 0, 0, 0.22);
	color: #f4f4f5;
	font-family: "JetBrains Mono", ui-monospace, monospace;
	font-size: 0.78rem;
	text-transform: uppercase;
}

.fi-bg-gradient[hidden],
.fi-bg-solid[hidden] {
	display: none !important;
}

.fi-bg-gradient__hint {
	margin: 0 0 14px;
	font-size: 0.68rem;
	line-height: 1.4;
	color: rgba(244, 244, 245, 0.38);
}

/* —— Gradient stop bar + color popover (reference layout) —— */

.fi-bg-stops-row {
	position: relative;
	margin-bottom: 14px;
	overflow: visible;
}

.fi-bg-stops-wrap {
	width: 100%;
	min-width: 0;
	overflow: visible;
	padding: 14px 0 6px;
}

.fi-bg-stops {
	position: relative;
	height: 34px;
	cursor: crosshair;
	touch-action: none;
	overflow: visible;
}

.fi-bg-stops__inner {
	position: relative;
	height: 34px;
	margin: 0 11px;
	overflow: visible;
}

.fi-bg-stops__track {
	position: absolute;
	left: 0;
	right: 0;
	top: 0;
	height: 34px;
	border-radius: 999px;
	border: 1px solid rgba(255, 255, 255, 0.14);
	box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.28);
	pointer-events: none;
}

.fi-bg-stops__handle {
	position: absolute;
	top: 50%;
	width: 22px;
	height: 22px;
	margin: -11px 0 0 -11px;
	border: 2px solid rgba(255, 255, 255, 0.92);
	border-radius: 50%;
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
	cursor: grab;
	touch-action: none;
	z-index: 2;
	transition: box-shadow 0.12s ease, transform 0.12s ease;
}

.fi-bg-stops__handle.is-selected {
	border-color: #fff;
	box-shadow:
		0 0 0 2px var(--xfp-accent, #2f6fed),
		0 2px 8px rgba(0, 0, 0, 0.5);
	transform: scale(1.08);
	z-index: 3;
}

.fi-bg-stops__handle:active {
	cursor: grabbing;
}

.fi-bg-stops__trash {
	position: absolute;
	top: -30px;
	width: 24px;
	height: 24px;
	margin-left: -12px;
	padding: 0;
	border: 0;
	border-radius: 6px;
	background: rgba(20, 22, 28, 0.92);
	color: rgba(244, 244, 245, 0.82);
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
	cursor: pointer;
	z-index: 4;
	display: inline-flex;
	align-items: center;
	justify-content: center;
}

.fi-bg-stops__trash:hover {
	background: rgba(229, 72, 77, 0.18);
	color: #fca5a5;
}

.fi-bg-stops__trash svg {
	width: 13px;
	height: 13px;
}

/* —— Inline color picker popover (reference) —— */

.fi-bg-picker {
	margin-bottom: 0;
}

.fi-bg-picker--popover {
	position: absolute;
	top: calc(100% + 2px);
	left: 0;
	width: 176px;
	margin-top: 0;
	z-index: 30;
}

.fi-bg-picker[hidden] {
	display: none !important;
}

.fi-bg-picker__card {
	display: flex;
	flex-direction: column;
	gap: 8px;
	padding: 8px;
	border: 1px solid rgba(255, 255, 255, 0.1);
	border-radius: 12px;
	background: rgba(16, 18, 24, 0.98);
	box-shadow:
		0 8px 24px rgba(0, 0, 0, 0.42),
		0 0 0 1px rgba(0, 0, 0, 0.18);
}

.fi-bg-picker .fi-color-studio__sb {
	aspect-ratio: 1;
	border-radius: 8px;
}

.fi-bg-picker__hue {
	height: 12px;
	margin-top: 0;
	background: linear-gradient(to right, #f00 0%, #ff0 17%, #0f0 33%, #0ff 50%, #00f 67%, #f0f 83%, #f00 100%);
}

.fi-bg-picker__footer {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 6px;
}

.fi-bg-picker__hex-wrap {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 4px;
	flex: 1 1 auto;
	min-width: 0;
}

.fi-bg-picker__hex-label {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	font-size: 0.58rem;
	font-weight: 600;
	letter-spacing: 0.08em;
	color: rgba(244, 244, 245, 0.42);
	flex-shrink: 0;
}

.fi-bg-picker__hex-swap {
	width: 10px;
	height: 10px;
	opacity: 0.55;
}

.fi-bg-picker__hex {
	width: 100%;
	min-width: 0;
	padding: 5px 7px;
	font-size: 0.68rem;
	text-transform: uppercase;
}

.fi-bg-picker__eyedropper {
	flex-shrink: 0;
	width: 28px;
	height: 28px;
	border-radius: 7px;
}

.fi-bg-picker__eyedropper svg {
	width: 14px;
	height: 14px;
}

/* —— Direction + Type row —— */

.fi-bg-controls-row {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
	gap: 12px;
	align-items: start;
	margin-bottom: 14px;
}

.fi-bg-control-block {
	display: flex;
	flex-direction: column;
	gap: 8px;
	min-width: 0;
}

.fi-bg-control-block__label {
	font-size: 0.62rem;
	font-weight: 600;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: rgba(244, 244, 245, 0.42);
}

.fi-bg-dial {
	position: relative;
	width: 88px;
	height: 88px;
	flex-shrink: 0;
	border-radius: 50%;
	cursor: pointer;
	touch-action: none;
	user-select: none;
}

.fi-bg-dial__ring {
	position: absolute;
	inset: 0;
	border-radius: 50%;
	background: conic-gradient(
		from 0deg,
		var(--xfp-accent, #2f6fed) calc(var(--fi-bg-angle, 90) * 1deg),
		rgba(255, 255, 255, 0.08) calc(var(--fi-bg-angle, 90) * 1deg)
	);
	-webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 9px), #000 calc(100% - 8px));
	mask: radial-gradient(farthest-side, transparent calc(100% - 9px), #000 calc(100% - 8px));
	pointer-events: none;
	transition: background 0.05s linear;
}

.fi-bg-dial__face {
	position: absolute;
	inset: 12px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	background: rgba(0, 0, 0, 0.32);
	border: 1px solid rgba(255, 255, 255, 0.06);
	pointer-events: none;
}

.fi-bg-dial__value {
	font-family: "JetBrains Mono", ui-monospace, monospace;
	font-size: 0.86rem;
	font-weight: 600;
	letter-spacing: -0.02em;
	color: #f4f4f5;
	white-space: nowrap;
	pointer-events: none;
}

.fi-bg-dial__knob {
	position: absolute;
	top: 50%;
	left: 50%;
	width: 14px;
	height: 14px;
	border-radius: 50%;
	background: #fff;
	border: 3px solid var(--xfp-accent, #2f6fed);
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
	transform: translate(-50%, -50%);
	pointer-events: none;
}

.fi-bg-dial-presets {
	display: inline-flex;
	gap: 4px;
	margin-top: 10px;
}

.fi-bg-dial-presets__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 24px;
	height: 24px;
	padding: 0;
	border: 1px solid rgba(255, 255, 255, 0.1);
	border-radius: 7px;
	background: rgba(0, 0, 0, 0.24);
	color: rgba(244, 244, 245, 0.65);
	cursor: pointer;
	transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}

.fi-bg-dial-presets__btn:hover {
	background: rgba(255, 255, 255, 0.08);
	color: #fff;
	border-color: rgba(255, 255, 255, 0.2);
}

.fi-bg-dial-presets__btn.is-active {
	background: var(--xfp-accent, #2f6fed);
	border-color: var(--xfp-accent, #2f6fed);
	color: #fff;
}

.fi-bg-dial-presets__btn svg {
	width: 11px;
	height: 11px;
}

.fi-bg-control-block--type {
	align-items: stretch;
}

.fi-bg-type-toggle {
	display: inline-flex;
	width: 100%;
	padding: 4px;
	border: 1px solid rgba(255, 255, 255, 0.1);
	border-radius: 12px;
	background: rgba(0, 0, 0, 0.28);
}

.fi-bg-type-toggle__btn {
	flex: 1;
	padding: 10px 8px;
	border: 0;
	border-radius: 9px;
	background: transparent;
	color: rgba(244, 244, 245, 0.48);
	font: inherit;
	font-size: 0.82rem;
	font-weight: 500;
	cursor: pointer;
	transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.fi-bg-type-toggle__btn.is-active {
	background: rgba(255, 255, 255, 0.1);
	color: #f4f4f5;
	box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.fi-bg-gallery {
	margin-top: 4px;
	padding-top: 12px;
	border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.fi-bg-gallery__title {
	margin: 0 0 10px;
	font-size: 0.66rem;
	font-weight: 700;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: rgba(196, 181, 253, 0.8);
}

.fi-bg-gallery__grid {
	display: grid;
	grid-template-columns: repeat(8, minmax(0, 1fr));
	gap: 5px;
	max-height: 420px;
	overflow-y: auto;
	padding-right: 2px;
}

.fi-bg-gallery__grid::-webkit-scrollbar {
	width: 8px;
}

.fi-bg-gallery__grid::-webkit-scrollbar-thumb {
	background: rgba(255, 255, 255, 0.12);
	border-radius: 4px;
}

.fi-bg-gallery__grid.is-collapsed {
	display: none;
}

.fi-bg-gallery__swatch {
	position: relative;
	aspect-ratio: 1;
	padding: 0;
	border: 1px solid rgba(255, 255, 255, 0.06);
	border-radius: 9px;
	cursor: pointer;
	overflow: hidden;
	transition: border-color 0.15s ease, transform 0.12s ease, box-shadow 0.15s ease;
}

.fi-bg-gallery__swatch:hover {
	border-color: rgba(255, 255, 255, 0.28);
	transform: translateY(-1px);
	box-shadow: 0 3px 10px rgba(0, 0, 0, 0.4);
}

.fi-bg-gallery__swatch.is-active {
	border-color: var(--xfp-accent, #2f6fed);
	box-shadow: 0 0 0 2px rgba(47, 111, 237, 0.55);
}

.fi-bg-gallery__toggle {
	display: block;
	width: 100%;
	margin-top: 8px;
	padding: 6px 0;
	border: 0;
	background: transparent;
	color: rgba(244, 244, 245, 0.45);
	font: inherit;
	font-size: 0.74rem;
	cursor: pointer;
	text-align: center;
}

.fi-bg-saved {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.fi-bg-saved__item {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 8px;
	border: 1px solid rgba(255, 255, 255, 0.08);
	border-radius: 10px;
	background: rgba(255, 255, 255, 0.02);
	cursor: pointer;
	transition: border-color 0.15s ease, background 0.15s ease;
}

.fi-bg-saved__item:hover {
	border-color: rgba(255, 255, 255, 0.16);
	background: rgba(255, 255, 255, 0.04);
}

.fi-bg-saved__preview {
	width: 36px;
	height: 36px;
	flex-shrink: 0;
	border-radius: 8px;
	border: 1px solid rgba(255, 255, 255, 0.1);
}

.fi-bg-saved__meta {
	flex: 1 1 auto;
	min-width: 0;
	font-size: 0.78rem;
	color: rgba(244, 244, 245, 0.75);
}

.fi-bg-saved__delete {
	padding: 4px 8px;
	border: 0;
	border-radius: 6px;
	background: rgba(229, 72, 77, 0.12);
	color: #fca5a5;
	font: inherit;
	font-size: 0.68rem;
	cursor: pointer;
}

.fi-bg-saved__empty {
	margin: 0;
	font-size: 0.78rem;
	color: rgba(244, 244, 245, 0.45);
}
