@mixin preventSelect() {
	-moz-user-select: -moz-none;
	-khtml-user-select: none;
	-webkit-user-select: none;
}

@mixin placeholder {
	color: gray;
	@include defaultFont();
	font-size: 15px;
	line-height: 34px;
	vertical-align: middle;
	font-weight: normal;
}

@mixin defaultFont {
	font-family: 'Roboto', 'Helvetica', 'Arial', sans-serif;
}

@mixin selection() {
	@include defaultFont();
}

.lunatic-combo-box-container {
	position: relative;
	width: 100%;

	&.default-style {
		--color-combo-box-selected: Cornsilk;
		--color-primary-dark: DarkGreen;
		--color-primary-main: FloralWhite;
		--color-combo-box-background: snow;
		--color-disabled: Gainsboro;
		--color-primary-light: GreenYellow;

		margin-bottom: 10px;
		.lunatic-combo-box {
			min-height: 30px;
			min-width: 260px;
			width: 100%;
			.lunatic-combo-box-content {
				.lunatic-combo-box-selection {
					border-radius: 5px;
					border: 2px solid var(--color-primary-dark);
					background-color: var(--color-combo-box-background);
					&:hover {
						border-color: var(--color-primary-main);
					}
					.lunatic-combo-box-input {
						height: 34px;
						line-height: 34px;
						font-size: 15px;
						padding-left: 4px;
						@include selection();

						&::placeholder {
							@include placeholder();
						}
					}

					.lunatic-combo-box-selected {
						line-height: 34px;
						background-color: var(--color-combo-box-background);
						border-radius: 5px;
						padding-left: 4px;
						@include selection();
						outline: none;
						overflow-y: hidden;
						display: block;
						@include placeholder();

						.selection {
							display: inline-block;
							line-height: 1.3;
							font-size: 15px;
						}

						&.disabled {
							background-color: var(--color-disabled);
						}
					}
				}

				.lunatic-combo-box-panel {
					@include defaultFont();
					height: 0;
					opacity: 0;
					background-color: var(--color-combo-box-background);
					transition:
						opacity 267ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,
						transform 178ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;

					&.expanded {
						display: flex;
						flex-direction: column;
						gap: 0.2rem;
						border: solid 1px var(--color-primary-light);
						opacity: 1;
						min-height: 30px;
						height: max-content;
						box-shadow: 0 2px 2px grey;
						border-radius: 4px;
					}
					.lunatic-combo-box-option {
						overflow: hidden;
						margin-bottom: 0.1em;
						line-height: 1.3;
						display: block;

						&.selected {
							color: var(--color-primary-dark);
							background-color: var(--color-combo-box-selected);
						}
						&:hover {
							background-color: var(--color-primary-main);
							color: var(--color-combo-box-background);
						}
					}
				}
			}
		}
	}

	.lunatic-combo-box-fab {
		position: absolute;
		right: 4px;
		top: 8px;
		z-index: 0;
		&.focused {
			z-index: 1;
		}

		.lunatic-icon {
			svg {
				fill: white;
				width: 16px;
				height: 16px;
				margin: auto;
			}
		}
	}

	.lunatic-combo-box {
		position: relative;
		z-index: 0;

		&:focus {
			outline: none;
		}

		&.focused {
			z-index: 1;
		}

		.lunatic-combo-box-content {
			width: 100%;

			.lunatic-combo-box-selection {
				position: relative;
				.lunatic-combo-box-input {
					border: none;
					margin: 0;
					padding: 0;
					background-color: transparent;
					&:focus {
						outline: none;
					}

					width: 100%;
				}

				.lunatic-combo-box-selected {
					// position: absolute;
					top: 0;
					overflow-x: hidden;
					width: 100%;
					display: none;
					&.displayed {
						display: block;
					}
				}
			}

			ul,
			li,
			div,
			span {
				margin: 0;
				padding: 0;
				border: none;
				list-style: none;
			}

			.lunatic-combo-box-panel {
				&:focus {
					outline: none;
				}
				.lunatic-combo-box-option {
					@include preventSelect();
				}
			}
		}
	}
}
