/* --------------------------------

File#: _3_select-autocomplete
Title: Select Autocomplete
Descr: Selection dropdown with autocomplete
Usage: codyhouse.co/license

-------------------------------- */
.select-auto.autocomplete {
    --autocomplete-dropdown-vertical-gap: 4px;
    /* gap between input and results list */
    --autocomplete-dropdown-max-height: 250px;
    --autocomplete-dropdown-scrollbar-width: 6px;
    /* custom scrollbar - webkit browsers */
}

/* input */
.select-auto__input-wrapper {
    --input-btn-icon-size: 12px;
    /* btn/icon size */
    --input-btn-icon-margin-right: 0.5rem;
    /* btn/icon size */
    --input-btn-text-gap: 0.375rem;
    /* gap between button/icon and text */
    position: relative;
}
@media (min-width: 64rem) {
    .select-auto__input-wrapper {
        --input-btn-icon-margin-right: 0.75rem;
        --input-btn-text-gap: 0.5625rem;
    }
}
.select-auto__input-wrapper .form-control {
    width: 100%;
    height: 100%;
    padding-right: calc(var(--input-btn-text-gap) + var(--input-btn-icon-size) + var(--input-btn-icon-margin-right));
}

.select-auto__input-icon-wrapper .icon,
.select-auto__input-btn .icon {
    display: block;
    margin: auto;
    width: var(--input-btn-icon-size, 16px);
    height: var(--input-btn-icon-size, 16px);
}

.select-auto__input-icon-wrapper {
    position: absolute;
    right: var(--input-btn-icon-margin-right);
    top: 50%;
    transform: translateY(-50%);
    display: inline-flex;
    pointer-events: none;
}

.select-auto__input-btn {
    /* search cancel button */
    display: none;
    justify-content: center;
    align-items: center;
    pointer-events: auto;
    cursor: pointer;
    @apply text-gray-500;
    /* icon color */
    transition: 0.3s;
}
.select-auto__input-btn:hover {
    @apply text-gray-700;
}
.select-auto__input-btn:active {
    transform: translateY(2px);
}

.select-auto--selection-done .select-auto__input-icon-wrapper > .icon {
    display: none;
}
.select-auto--selection-done .select-auto__input-btn {
    display: inline-flex;
}

/* dropdown */
.select-auto__results {
    @apply text-base;
}

/* single result item */
.select-auto__option {
    position: relative;
    cursor: pointer;
    transition: 0.2s;
}
.select-auto__option:hover {
    @apply bg-gray-900/5;
}
.select-auto__option:focus {
    outline: none;
    @apply bg-primary-700/[.12];
}
.select-auto__option.select-auto__option--selected {
    @apply bg-neutral-200/70;
    padding-right: calc(1em + 0.75rem);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
@media (min-width: 64rem) {
    .select-auto__option.select-auto__option--selected {
        padding-right: calc(1em + 1.125rem);
    }
}
.select-auto__option.select-auto__option--selected:focus {
    @apply bg-primary-800;
}
.select-auto__option.select-auto__option--selected::after {
    content: "";
    position: absolute;
    @apply right-3 lg:right-5;
    top: calc(50% - 0.5em);
    height: 1em;
    width: 1em;
    background-color: currentColor;
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpolyline stroke-width='2' stroke='%23ffffff' fill='none' stroke-linecap='round' stroke-linejoin='round' points='1,9 5,13 15,3 '/%3E%3C/svg%3E");mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpolyline stroke-width='2' stroke='%23ffffff' fill='none' stroke-linecap='round' stroke-linejoin='round' points='1,9 5,13 15,3 '/%3E%3C/svg%3E");
}

.select-auto__group-title, .select-auto__no-results-msg {
    outline: none;
}
