$borderColor: #c4c6cc;
$primaryColor: #3a84ff;
@mixin ellipsis {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
@mixin scrollbar ($width: 4px) {
    overflow: auto;
    &::-webkit-scrollbar {
        width: $width;
        height: $width;
        &-thumb {
            border-radius: 2px;
            background: #C4C6CC;
            box-shadow: inset 0 0 6px hsla(0,0%,80%,.3);
        }
    }
}

@mixin scrollbar-x ($width: 4px) {
    @include scrollbar;
    overflow-x: auto;
    overflow-y: hidden;
}

@mixin scrollbar-y ($width: 4px) {
    @include scrollbar($width);
    overflow-x: hidden;
    overflow-y: auto;
}
.user-selector * {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
.user-selector {
    display: inline-block;
    min-width: 120px;
    font-size: 14px;
    cursor: text;
    color: #63656E;
    &.user-selector-info {
        display: inline;
        min-width: initial;
        color: inherit;
    }
    .user-selector-layout {
        position: relative;
        height: 100%;
        .user-selector-container {
            position: relative;
            min-width: 100%;
            min-height: 100%;
            padding: 0 9px 0 3px;
            line-height: 1;
            border: 1px solid #c4c6cc;
            border-radius: 2px;
            background-color: #fff;
            font-size: 0;
            overflow: hidden;
            &.is-flex-height {
                min-height: 32px;
            }
            &.is-fast-clear {
                padding-right: 22px;
            }
            &.disabled {
                cursor: not-allowed;
                background-color: #fafbfd !important;
                border-color: #dcdee5 !important;
            }
            &.focus {
                @include scrollbar-y;
                white-space: normal;
                border-color: $primaryColor;
                z-index: 1;
            }
            &.placeholder:after {
                position: absolute;
                left: 0;
                top: 0;
                height: 100%;
                padding: 0 0 0 10px;
                line-height: 30px;
                content: attr(data-placeholder);
                font-size: 12px;
                color: #c3cdd7;
            }
            &.has-avatar {
                .user-selector-selected {
                    background: transparent;
                    padding: 0;
                    margin: 4px 5px;
                }
                .user-selector-overflow-tag {
                    border-radius: 10px;
                }
            }
            &.is-loading {
                &:before {
                    content: "";
                    position: absolute;
                    top: 0;
                    bottom: 0;
                    left: 0;
                    right: 0;
                    background-color: rgba(255, 255, 255, .7);
                    z-index: 2;
                }
                &:after {
                    content: "";
                    position: absolute;
                    top: 50%;
                    left: 50%;
                    width: 6px;
                    height: 6px;
                    margin-left: -24px;
                    border-radius: 50%;
                    box-shadow: 12px 0px 0px 0px #fd6154,
                            24px 0px 0px 0px #ffb726,
                            36px 0px 0px 0px #4cd084,
                            48px 0px 0px 0px #57a3f1;
                    animation: user-selector-loading 1s linear infinite;
                    z-index: 3;
                }
            }
        }
        .user-selector-overflow-count {
            min-width: 22px;
            height: 22px;
            line-height: 22px;
            text-align: center;
            padding: 0 4px;
            background-color: #F0F1F5;
            font-size: 12px;
            color: #63656E;
        }
        .user-selector-clear {
            position: absolute;
            top: 10px;
            right: 5px;
            font-size: 12px;
            color: #C4C6CC;
            cursor: pointer;
            z-index: 1;
            &:hover {
                color: #979BA5;
            }
        }
    }
    .user-selector-selected {
        display: inline-flex;
        max-width: 100%;
        align-items: center;
        vertical-align: top;
        margin: 4px 0 4px 6px;
        padding: 0 2px 0 4px;
        border-radius: 2px;
        background: #f0f1f5;
        line-height: 22px;
        outline: 0;
        font-size: 12px;
        cursor: pointer;
        &:hover {
            background: #dcdee5;
        }
        .user-selector-selected-value {
            flex: 1;
            font-size: 12px;
            color: #63656E;
            @include ellipsis;
        }
        .user-selector-selected-clear {
            flex: 18px 0 0;
            height: 18px;
            line-height: 18px;
            text-align: center;
            color: #979BA5;
            font-size: 18px;
            cursor: pointer;
            &:hover {
                color: #63656E;
            }
        }
    }
    .user-selector-input {
        display: inline-block;
        vertical-align: top;
        max-width: 100%;
        height: 22px;
        margin: 4px 0 0;
        padding: 0 0 0 6px;
        white-space: nowrap;
        line-height: 22px;
        font-size: 12px;
        outline: none;
        overflow: hidden;
    }
    .user-selector-overflow-tag {
        display: inline-flex;
        padding: 0 5px;
        margin: 4px 0 4px 6px;
        min-width: 22px;
        line-height: 22px;
        font-size: 12px;
        text-align: center;
        background: #f0f1f5;
        & ~ .user-selector-selected {
            visibility: hidden;
            pointer-events: none;
        }
    }
    .alternate-empty {
        height: 32px;
        padding: 0;
        margin: 0;
        text-align: center;
        line-height: 32px;
    }
}

@keyframes user-selector-loading {
   0%{
        box-shadow: 12px 0px 0px 0px #fd6154,
                    24px 0px 0px 0px #ffb726,
                    36px 0px 0px 0px #4cd084,
                    48px 0px 0px 0px #57a3f1;
      }
    14%{
        box-shadow: 12px 0px 0px 1px #fd6154,
                    24px 0px 0px 0px #ffb726,
                    36px 0px 0px 0px #4cd084,
                    48px 0px 0px 0px #57a3f1;
    }
    28% {
        box-shadow: 12px 0px 0px 2px #fd6154,
                    24px 0px 0px 1px #ffb726,
                    36px 0px 0px 0px #4cd084,
                    48px 0px 0px 0px #57a3f1;
    }
    42% {
        box-shadow: 12px 0px 0px 1px #fd6154,
                    24px 0px 0px 2px #ffb726,
                    36px 0px 0px 1px #4cd084,
                    48px 0px 0px 0px #57a3f1;
    }
    56%{
        box-shadow: 12px 0px 0px 0px #fd6154,
                    24px 0px 0px 1px #ffb726,
                    36px 0px 0px 2px #4cd084,
                    48px 0px 0px 1px #57a3f1;
    }
    70% {
        box-shadow: 12px 0px 0px 0px #fd6154,
                    24px 0px 0px 0px #ffb726,
                    36px 0px 0px 1px #4cd084,
                    48px 0px 0px 2px #57a3f1;
    }
    84% {
        box-shadow: 12px 0px 0px 0px #fd6154,
                    24px 0px 0px 0px #ffb726,
                    36px 0px 0px 0px #4cd084,
                    48px 0px 0px 1px #57a3f1;
    }
}


.user-selector-alternate-list-wrapper {
    width: 190px;
    color: #63656E;
    position: relative;
    background-color: #fff;
    &.has-folder {
        width: 300px;
    }
    &.is-loading {
        min-height: 32px;
        &:before {
            content: '';
            position: absolute;
            width: 100%;
            height: 100%;
            background-color: rgba(255, 255, 255, .7);
            z-index: 1;
        }
        &:after {
            content: '';
            position: absolute;
            top: 50%;
            left: 50%;
            width: 6px;
            height: 6px;
            margin-left: -30px;
            border-radius: 50%;
            // transform: translate3d(-50%, -50%, 0);
            background-color: transparent;
            box-shadow: 12px 0px 0px 0px #fd6154,
                        24px 0px 0px 0px #ffb726,
                        36px 0px 0px 0px #4cd084,
                        48px 0px 0px 0px #57a3f1;
            animation: user-selector-loading 1s linear infinite;
        }
    }
    .alternate-list{
        margin: 0;
        padding: 0;
        max-height: 162px;
        font-size: 12px;
        line-height: 32px;
        background: #fff;
        overflow-y: auto;
        &::-webkit-scrollbar {
            width: 4px;
            height: 4px;
            &-thumb {
                border-radius: 2px;
                background: #C4C6CC;
                box-shadow: inset 0 0 6px hsla(0,0%,80%,.3);
            }
        }
    }
    .alternate-item {
        padding: 0 10px;
        justify-content: space-between;
        cursor: pointer;
        &.highlight,
        &:hover{
            background-color: #f1f7ff;
        }
        &.disabled {
            opacity: .5;
            cursor: not-allowed;
        }
        .item-avatar {
            float: left;
            margin: 5px 8px 0 0;
        }
        .item-name {
            display: block;
            @include ellipsis;
            span {
                color: #3A84FF;
            }
        }
        .item-folder {
            float: right;
            max-width: 140px;
            outline: 0;
            @include ellipsis;
        }
    }
    .alternate-group {
        padding: 0 11px;
        color: #979BA5;
        @include ellipsis;
    }
    .alternate-empty {
        padding: 0;
        margin: 0;
        text-align: center;
        line-height: 44px;
        font-size: 12px;
    }
}
.user-selector-avatar {
    display: inline-block;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background-color: #EFF0F5;
    background-repeat: no-repeat;
    background-position: center center;
    background-size: 100% 100%;
    background-image: url('./icon-user.svg');
}
.tippy-box[data-theme~=light] {
    border: 1px solid #dcdee5;
    border-radius: 2px;
    box-shadow: 0px 2px 6px 0px rgba(0, 0, 0, 0.1);
    color: #63656E;
    font-size: 12px;
    line-height: 24px;
    &[data-theme~=user-selected-tips],
    &[data-theme~=list-item-tips] {
        padding: 0 9px;
    }
    &[data-theme~=small-arrow] > .tippy-arrow:before {
        transform: scale(0.75);
    }
}
.tippy-box[data-theme~=dark] {
    padding: 7px 12px;
    font-size: 12px;
}
.tippy-content {
    padding: 0;
}
