@import url('meta');
@import url('color');
@import url('transition');

.__dropdown_label_text {
    .truncate;
    display: inline-block;
    vertical-align: bottom;
    width: 96%;
}

.dropdown {
    position: relative;
    display: inline-block;
    min-width: @min_input_width;
    &._top ._list {
        bottom: @line_height * 2 + 4px;
    }
    &.small {
        min-width: @small_size;
        width: @small_size;
    }
    &.mini {
        min-width: @mini_size;
        width: @mini_size;
    }
    ._list {
        .bordered;
        .box_shadow;
        max-height: @min_input_width + @padding * 2;
        overflow-y: auto;
        margin-top: -1px;
        position: absolute;
        width: 100%;
        min-width: @min_input_width * 2/3;
        z-index: 100;
        background: @white;
        border: 1px solid @light_gray;
        &:empty {
            border: 0;
            height: 0;
        }

        ._overlay {
            position: absolute;
            left: 0;
            bottom: 0;
            right: 0;
            top: 0;
            height: 100%;
            width: 100%;
            height: 100%;
            text-align: center;
            z-index: 9;
            background: rgba(250, 250, 250, 0.5);
            .loader {
                position: absolute;
                left: 50%;
                top: 50%;
                -webkit-transform: translate3d(-50%, -50%, 0);
                -ms-transform: translate3d(-50%, -50%, 0);
                -o-transform: translate3d(-50%, -50%, 0);
                transform: translate3d(-50%, -50%, 0);
            }
        }
        
        >._item {
            .break-word;
            cursor: pointer;
            padding: 3px 16px;
            border-top: 1px solid transparent;
            border-bottom: 1px solid transparent;
            &._active {
                background: @tiny_gray;
                border-color: @light_gray;
            }
            &:hover {
                background: @mini_gray;
                border-color: @light_gray;
            }
        }
    }

    .__input() {
        margin: 0;
        box-shadow: none;
        -webkit-appearance: none;
        padding: 0 @normal_font_size / 2;
        border: 1px solid rgba(50,50,50,0.16);
        -webkit-transition: all .2s;
        -o-transition: all .2s;
        transition: all .2s;
        line-height: @line_height * 2 + 4px;
        height: @line_height * 2 + 6px;
        font-size: @line_height;
        border-radius: @radius;
        color: @most_gray;
        &:focus {
          color: @deep_gray;
        }
    }

    .__dropIcon(){
        .icon_font;
        color: @primaryColor;
        position: absolute;
        right: 5px;
        top: 1px;
        bottom: 1px;
        font-size: 22px;
        line-height: @line_height * 2 + 4px;
        z-index: 3;
    }

    ._label {
        .__input();
        cursor: pointer;
        position: relative;
        &>input._transparent {
            position: absolute;
            left: 0;
            top: 0;
            bottom: 0;
            right: 0;
            width: 100%;
            opacity: 0;
        }
        > i {
            .__dropIcon();
            &:before {
                content: 'arrow_drop_down';
            }
        }
        >._text {
            .__dropdown_label_text;
        }
    }
    
    ._placeHolder {
        color: @gray;
    }

    &._active {
        ._label, ._multi {
            > i {
                &:before {
                    content: 'arrow_drop_up';
                }
            }
        }
        ._search ._text {
            color: @light_gray;
        }
    }

    ._search {
        .__input();
        position: relative;
        ._text {
            .__dropdown_label_text;
            z-index: 2;
            cursor: text;
            position: relative;
            background: none;
            display: inline-block;
        }
        > i {
            .__dropIcon();
            &:before {
                content: 'search';
            }
        }
        ._input {
            background: none;
            padding: 0 @normal_font_size / 2;
            position: absolute;
            left: 0;
            top: 0;
            height: 100%;
            right: 0;
            bottom: 0;
            width: 100% !important;
            border: none;
            z-index: 3;
        }
    }

    ._multi {
        .__input();
        padding: 0 @normal_font_size / 2;
        white-space: pre-line;
        > i {
            &:before {
                content: 'arrow_drop_down';
                .__dropIcon();
            }
        }
        ._input {
            border: none;
            display: inline;
            max-width: 100%;
            padding: 0;
            -webkit-transition: none;
            -o-transition: none;
            transition: none;
            height: 31px;
            &[disabled] {
                background: transparent;
            }
        }
        ._placeHolder {
            margin-left: -6px;
        }
        ._tag {
            cursor: pointer;
            margin-right: 3px;
            background: @light_gray;
            color: @dark_gray;
            border-radius: @radius;
            font-size: 12px;
            padding: 3px;

            ._text {
                padding-right: 3px; 
            }

            ._delete {
                color: @black;
                &:before {
                    .icon_font;
                    font-size: 12px;
                    content: 'close';
                }
            }
        }
        &._disabled {
            ._delete {
                color: @gray;
                cursor: not-allowed;
            }
        }
    }
}

/*error style*/
.error {
    .dropdown {
        ._label, ._multi, ._search {
            border-color: @red;
        }
    }
}

.dropdown {
    .basic_transition;
}