/* Text / Annotation sidebar panel */

.fi-text-panel {
	display: flex;
	flex-direction: column;
	min-height: 0;
	height: 100%;
	padding: 0 0 12px;
}

.fi-text-panel__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	padding: 0 14px 12px;
	border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.fi-text-panel__title-wrap {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	min-width: 0;
}

.fi-text-panel__title-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 22px;
	height: 22px;
	color: rgba(244, 244, 245, 0.72);
}

.fi-text-panel__title-icon svg {
	width: 16px;
	height: 16px;
}

.fi-text-panel__title {
	margin: 0;
	font-size: 0.72rem;
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: rgba(244, 244, 245, 0.88);
}

.fi-text-panel__add {
	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;
}

.fi-text-panel__add:hover {
	background: var(--xfp-accent-hover, #3b82f6);
}

.fi-text-panel__body {
	flex: 1 1 auto;
	min-height: 0;
	overflow-y: auto;
	padding: 12px 14px 0;
}

.fi-text-panel__section {
	margin-bottom: 16px;
}

.fi-text-panel__section-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	margin-bottom: 8px;
}

.fi-text-panel__section-title {
	margin: 0;
	font-size: 0.62rem;
	font-weight: 600;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: rgba(244, 244, 245, 0.42);
}

.fi-text-panel__layers {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.fi-text-panel__layer {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	align-items: center;
	gap: 8px;
	padding: 8px 10px;
	border: 1px solid rgba(255, 255, 255, 0.08);
	border-radius: 10px;
	background: rgba(255, 255, 255, 0.03);
	cursor: pointer;
	text-align: left;
	color: inherit;
	font: inherit;
}

.fi-text-panel__layer.is-selected {
	border-color: rgba(47, 111, 237, 0.65);
	box-shadow: inset 0 0 0 1px rgba(47, 111, 237, 0.35);
	background: rgba(47, 111, 237, 0.08);
}

.fi-text-panel__layer-name {
	font-size: 0.78rem;
	font-weight: 500;
	color: #f4f4f5;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.fi-text-panel__layer-actions {
	display: inline-flex;
	align-items: center;
	gap: 4px;
}

.fi-text-panel__layer-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 24px;
	height: 24px;
	padding: 0;
	border: 0;
	border-radius: 6px;
	background: transparent;
	color: rgba(244, 244, 245, 0.55);
	cursor: pointer;
}

.fi-text-panel__layer-btn:hover {
	background: rgba(255, 255, 255, 0.08);
	color: #fff;
}

.fi-text-panel__layer-btn.is-active {
	color: #93c5fd;
}

.fi-text-panel__layer-btn svg {
	width: 13px;
	height: 13px;
}

.fi-text-panel__align {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
}

.fi-text-panel__empty {
	margin: 0;
	font-size: 0.74rem;
	line-height: 1.45;
	color: rgba(244, 244, 245, 0.42);
}

.fi-text-panel__soon {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 72px;
	padding: 14px;
	border: 1px dashed rgba(255, 255, 255, 0.12);
	border-radius: 12px;
	background: rgba(0, 0, 0, 0.18);
}

.fi-text-panel__soon-label {
	font-size: 0.72rem;
	font-weight: 600;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: rgba(244, 244, 245, 0.38);
}

.fi-text-panel__field {
	display: grid;
	grid-template-columns: minmax(0, 1fr) 56px;
	gap: 10px;
	align-items: center;
	margin-bottom: 10px;
}

.fi-text-panel__field-label {
	font-size: 0.68rem;
	font-weight: 500;
	color: rgba(244, 244, 245, 0.55);
}

.fi-text-panel__field-input {
	width: 100%;
	padding: 6px 8px;
	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.74rem;
	text-align: right;
}

.fi-text-panel__field-input:focus {
	outline: none;
	border-color: rgba(47, 111, 237, 0.55);
}

.fi-text-panel__field-range {
	grid-column: 1 / -1;
	width: 100%;
	height: 4px;
	margin: 0;
	accent-color: var(--xfp-accent, #2f6fed);
}

.fi-text-panel__toggle-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	padding: 8px 0;
}

.fi-text-panel__toggle-label {
	font-size: 0.72rem;
	font-weight: 500;
	color: rgba(244, 244, 245, 0.72);
}

.fi-text-panel__toggle {
	position: relative;
	width: 38px;
	height: 22px;
	padding: 0;
	border: 0;
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.14);
	cursor: pointer;
	transition: background 0.15s ease;
}

.fi-text-panel__toggle::after {
	content: "";
	position: absolute;
	top: 3px;
	left: 3px;
	width: 16px;
	height: 16px;
	border-radius: 50%;
	background: #fff;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
	transition: transform 0.15s ease;
}

.fi-text-panel__toggle.is-on {
	background: var(--xfp-accent, #2f6fed);
}

.fi-text-panel__toggle.is-on::after {
	transform: translateX(16px);
}

.fi-text-panel__footer {
	padding: 12px 14px 0;
	border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.fi-text-panel__delete {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	width: 100%;
	padding: 9px 12px;
	border: 1px solid rgba(239, 68, 68, 0.35);
	border-radius: 10px;
	background: rgba(239, 68, 68, 0.08);
	color: #fca5a5;
	font: inherit;
	font-size: 0.76rem;
	font-weight: 600;
	cursor: pointer;
}

.fi-text-panel__delete:hover:not(:disabled) {
	background: rgba(239, 68, 68, 0.16);
}

.fi-text-panel__delete:disabled {
	opacity: 0.45;
	cursor: default;
}

.fi-text-panel__delete svg {
	width: 14px;
	height: 14px;
}

.fi-text-panel.is-disabled .fi-text-panel__align,
.fi-text-panel.is-disabled .fi-text-panel__toggle {
	opacity: 0.45;
	pointer-events: none;
}
