/* ============================================================================
   06-COMPONENTS -> #TAG-SELECT
   ========================================================================= */

/**
 * A form input used to select a value from a list of predefined options.
 */


//
// SCSS imports
//

@use '../01-settings' as *;
@use '../02-tools' as *;


/**
 * Tag select
 */

.tag-select {
    position: relative;
    width: 100%;
}


/**
 * Tag select datalist
 */

.tag-select__datalist {
    // display: none;
}


/**
 * Tag select input
 */

.tag-select__input {
    @include form-input-focus;
    @include transition(('border-color', 'box-shadow'), var(--duration-sm));
    appearance: none;
    align-items: center;
    background-color: var(--input-bg);
    border: var(--form-input-border-width) solid var(--form-input-border-color);
    border-radius: var(--form-input-border-radius);
    box-shadow: var(--shadow-xs);
    color: var(--input-color);
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: flex-start;
    min-height: var(--form-input-height);
    padding-left: var(--space-3);
    padding-right: var(--space-3);
    width: 100%;

    &:disabled {
        background-color: var(--input-bg-disabled);
        color: var(--input-color-disabled);
        cursor: not-allowed;
    }

    & > .tag {
        //margin-bottom: var(--space-1);
        margin-left: var(--space-2);

        &:first-child {
            margin-left: 0;
        }
    }
}


/**
 * Tag select input search
 */

.tag-select__input-search {
    appearance: none;
    background: inherit;
    border: 0;
    box-shadow: none;
    display: inline-block;
    flex: 1;
    margin-left:var(--space-1);
    max-width: 100%;
    min-height: var(--space-8);
    min-width: var(--space-12);
    padding: 0;
    width: 100%;

    &:focus {
        outline: 0;
    }
}


/**
 * Tag select list
 */

.tag-select__options {
    @include transition(('opacity', 'visibility'), var(--duration-md));
    opacity: 0;
    position: absolute;
    top: 100%;
    visibility: hidden;
    width: 100%;
    z-index: var(--z-index-10);
}


/**
 * Tag select list item
 */

.tag-select__list-item {
}

.tag-select[data-show-results=true] {
    .tag-select__options {
        opacity: 1;
        visibility: visible;
    }
}