@use "../../00-base/colors/colors";
@use "../../00-base/mixin/lists.mixin";
@use "../../00-base/mixin/core.mixin";
@use "../../00-base/mixin/elevation.mixin";
@use "input";

.hidden-visually {
	position: absolute;

	overflow: hidden;
	clip: rect(0, 0, 0, 0);

	width: 1px;
	height: 1px;
	padding: 0;

	white-space: nowrap;

	border: 0;

	clip-path: inset(50%);
}

.hoo-select {
	position: relative;

	display: flex;

	box-sizing: border-box;

	border: 1px colors.$neutral-500 solid;
	border-radius: 2px;
	outline: 1px rgba(255, 255, 255, 0) solid;

	align-items: center;

	.hidden-visually {
		position: absolute;

		overflow: hidden;
		clip: rect(0, 0, 0, 0);

		width: 1px;
		height: 1px;
		padding: 0;

		white-space: nowrap;

		border: 0;

		clip-path: inset(50%);
	}

	&-text {
		@include input.base-input;

		width: calc(100% - #{core.px2rem(32px)});

		border: none;
	}

	&-dropdown {
		@extend %listReset;
		@include elevation.elevation(4);

		display: flex;
		flex-direction: column;

		box-sizing: border-box;
		width: 100%;
		margin-top: 1px;

		border-radius: 2px;
		border-top-left-radius: 0;
		border-top-right-radius: 0;
		background-color: colors.$neutral-000;

		max-height: 50vh;
        overflow: hidden;

		&.hidden-all {
			display: none;
		}

	}

	// for drop down user outside of a select box
	&>.hoo-select-dropdown {
		position: absolute;
		z-index: 100;
		top: 100%;
		// display: none;
	}
}

.hoo-optgroup-items {
	// @extend .hoo-select-dropdown;
    padding-left: 0.5rem;

	border-bottom: 1px colors.$neutral-450 solid;
	border-radius: 0;
	box-shadow: none;
}

.hoo-select-dropdown{
    overflow: hidden;
    overflow-y: auto;
    position: relative;
	// &:has(:not(.hoo-optgroup-items)) {
	// 	display: none;
	// }
}

.hoo-option {
	font-size: 14px;

	display: flex;
	flex-wrap: nowrap;
	text-overflow: ellipsis;

	height: core.px2rem(36px);
	padding: 0 core.px2rem(8px);

	color: colors.$neutral-700;

	align-items: center;
	flex-shrink: 0;

	&.is-disabled {
		pointer-events: none;

		color: colors.$neutral-400;
	}

	&:hover {
		cursor: pointer;

		background-color: colors.$neutral-100;
	}
}

.hoo-optgroup-name {
	font-weight: bold;

	display: flex;

	height: core.px2rem(36px);
	padding: 0 core.px2rem(8px);

	color: colors.$theme-600;
    background-color: colors.$neutral-000;

	align-items: center;
    position: sticky;
    top: 0;
    padding-bottom: 0.25rem;
}