@import '../base-styles/style.scss';

.codeamp-components-multi-select-control {
	&__input-container {
		font-size: 13px;
		line-height: normal;
	}
}

.codeamp-components-multi-select-control__input-container {
	@include input-control();
	width: 100%;
	margin: 0 0 $grid-unit-10 0;
	padding: 0;
	cursor: text;
	
	

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

	&.is-active {
		@include input-style__focus();
	}
	// Token input
	input[type="text"].codeamp-components-multi-select-control__input {
		display: inline-block;
		flex: 1;
		font-family: inherit;
		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;
		line-height: 30px;

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

		&:focus,
		.codeamp-components-multi-select-control.is-active & {
			outline: none;
			box-shadow: none;
		}
	}
	.codeamp-components-multi-select-control__token + input[type="text"].codeamp-components-multi-select-control__input {
		width: auto;
	}
}

.codeamp-components-multi-select-control__help {
	font-size: $helptext-font-size;
	font-style: normal;
	color: $gray-700;
}


// Tokens
.codeamp-components-multi-select-control__tokens-container {
    min-height: 38px;
    padding: 4px;
	width: 100%;
}

.codeamp-components-multi-select-control__token {
	font-size: $default-font-size;
	display: flex;
	color: $gray-900;
	max-width: 100%;
	padding: 0;
	
	&.is-borderless {
		position: relative;
		padding: 0 24px 0 0;

		.codeamp-components-multi-select-control__token-text {
			background: transparent;
			color: var(--wp-admin-theme-color);
		}

		.codeamp-components-multi-select-control__remove-token {
			background: transparent;
			color: $gray-700;
			position: absolute;
			top: 1px;
			right: 0;
			padding: 0;
		}

		&.is-success {
			.codeamp-components-multi-select-control__token-text {
				color: $alert-green;
			}
		}

		&.is-error {
			.codeamp-components-multi-select-control__token-text {
				color: $alert-red;
				border-radius: 4px 0 0 4px;
				padding: 0 4px 0 6px;
			}
		}

		&.is-validating {
			.codeamp-components-multi-select-control__token-text {
				color: $gray-900;
			}
		}
	}

	&.is-disabled {
		.codeamp-components-multi-select-control__remove-token {
			cursor: default;
		}
	}
}

.codeamp-components-multi-select-control__token-text,
.codeamp-components-multi-select-control__remove-token.components-button {
	display: inline-block;
	line-height: 30px;
	height: auto;
	background: $gray-300;
	min-width: unset;
	transition: all 0.2s cubic-bezier(0.4, 1, 0.4, 1);
	@include reduce-motion;
}

.codeamp-components-multi-select-control__token-text {
	border-radius: 2px 0 0 2px;
	padding: 0 0 0 12px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.codeamp-components-multi-select-control__remove-token.components-button {
	cursor: pointer;
	border-radius: 0 2px 2px 0;
	padding: 0 4px;
	color: $gray-900;
	line-height: 10px;
	overflow: initial;

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

// Suggestion list
.codeamp-components-multi-select-control__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: 0;
	padding: 0;
}

.codeamp-components-multi-select-control__no-suggestions {
	color: $gray-700;
	font-size: $default-font-size;
	margin: 0;
	display: block;
	padding: 4px 8px;
}
.codeamp-components-multi-select-control__suggestion {
	color: $gray-700;
	display: block;
	font-size: $default-font-size;
	padding: 4px 8px;
	margin: 0;
	cursor: pointer;

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

.codeamp-components-multi-select-control__suggestion-match {
	text-decoration: underline;
}