.components-form-token-field__input-container {
	@include input-control();
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	width: 100%;
	margin: 0 0 $grid-unit-10 0;
	padding: $grid-unit-05*0.5 $grid-unit-05;
	cursor: text;


	&.is-disabled {
		background: $gray-300;
		border-color: $gray-300;
	}

	&.is-active {
		@include input-style__focus();
	}

	// Token input
	input[type="text"].components-form-token-field__input {
		display: inline-block;
		flex: 1;
		font-size: 16px;
		width: 100%;
		max-width: 100%;
		margin-left: 4px;
		padding: 0;
		min-height: 24px;
		min-width: 50px;
		background: inherit;
		border: 0;
		color: $gray-900;
		box-shadow: none;

		// Resolves Zooming on iOS devices
		// https://github.com/GeChiUI/gutenberg/issues/27405
		@include break-small() {
			font-size: 13px;
		}

		&:focus,
		.components-form-token-field.is-active & {
			outline: none;
			box-shadow: none;
		}
	}
	.components-form-token-field__token + input[type="text"].components-form-token-field__input {
		width: auto;
	}
}

.components-form-token-field__label {
	display: inline-block;
	margin-bottom: $grid-unit-05;
}

.components-form-token-field__help {
	font-size: $helptext-font-size;
	font-style: normal;
	color: $gray-700;
}

// Tokens
.components-form-token-field__token {
	font-size: $default-font-size;
	display: flex;
	margin: 2px 4px 2px 0;
	color: $gray-900;
	max-width: 100%;

	&.is-success {
		.components-form-token-field__token-text,
		.components-form-token-field__remove-token {
			background: $alert-green;
		}
	}

	&.is-error {
		.components-form-token-field__token-text,
		.components-form-token-field__remove-token {
			background: $alert-red;
		}
	}

	&.is-validating {
		.components-form-token-field__token-text,
		.components-form-token-field__remove-token {
			color: $gray-700;
		}
	}

	&.is-borderless {
		position: relative;
		padding: 0 16px 0 0;

		.components-form-token-field__token-text {
			background: transparent;
			color: var(--gc-admin-theme-color);
		}

		.components-form-token-field__remove-token {
			background: transparent;
			color: $gray-700;
			position: absolute;
			top: 1px;
			right: 0;
		}

		&.is-success {
			.components-form-token-field__token-text {
				color: $alert-green;
			}
		}

		&.is-error {
			.components-form-token-field__token-text {
				color: $alert-red;
				border-radius: 4px 0 0 4px;
				padding: 0 4px 0 6px;
			}
		}

		&.is-validating {
			.components-form-token-field__token-text {
				color: $gray-900;
			}
		}
	}

	&.is-disabled {
		.components-form-token-field__remove-token {
			cursor: default;
		}
	}
}

.components-form-token-field__token-text,
.components-form-token-field__remove-token.components-button {
	display: inline-block;
	line-height: 24px;
	height: auto;
	background: $gray-300;
	min-width: unset;
	transition: all 0.2s cubic-bezier(0.4, 1, 0.4, 1);
	@include reduce-motion;
}

.components-form-token-field__token-text {
	border-radius: 2px 0 0 2px;
	padding: 0 0 0 8px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.components-form-token-field__remove-token.components-button {
	cursor: pointer;
	border-radius: 0 2px 2px 0;
	padding: 0 2px;
	color: $gray-900;
	line-height: 10px;
	overflow: initial;

	&:hover {
		color: $gray-900;
	}
}

// Suggestion list
.components-form-token-field__suggestions-list {
	flex: 1 0 100%;
	min-width: 100%;
	max-height: 9em;
	overflow-y: auto;
	transition: all 0.15s ease-in-out;
	@include reduce-motion("transition");
	list-style: none;
	border-top: $border-width solid $gray-700;
	margin: $grid-unit-05 (-$grid-unit-05) (-$grid-unit-05);
	padding: 0;
}

.components-form-token-field__suggestion {
	color: $gray-700;
	display: block;
	font-size: $default-font-size;
	padding: 4px 8px;
	margin: 0;
	cursor: pointer;

	&.is-selected {
		background: var(--gc-admin-theme-color);
		color: $white;
	}
}

.components-form-token-field__suggestion-match {
	text-decoration: underline;
}
