.MultiSelect {
  outline: none;
  position: relative;

  .Header {
    box-sizing: border-box;
    position: relative;
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    justify-content: space-between;
    background-color: $SM-backgroundColor;
    border: 1px solid $SM-borderColor;
    border-radius: $SM-borderRadius;
    color: $SM-textColor;
    overflow: hidden;
    max-width: 100%;
    padding: 0 15px;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    outline: none;

    &--selected {
      box-shadow: inset 0 0 4px $SM-headerSelectedColor;
    }

    &--disabled {
      border-color: $SM-dividerColor;
    }

    &--focusedActive {
      border-color: $SM-focusColor;
    }

    &--focusedDisabled {
      border-color: darken($SM-dividerColor, 10);
    }

    &--expanded {
      border-bottom-left-radius: 0;
      border-bottom-right-radius: 0;
      border-bottom-color: $SM-dividerColor;
    }

    &__value {
      box-sizing: border-box;
      display: flex;
      flex-grow: 1;
      height: $SM-fieldHeight - 2;
      line-height: $SM-fieldHeight - 1;
      color: $SM-valueColor;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;

      span {
        position: absolute;
        width: calc(100% - 45px);
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
      }
    }

    &__value--resetable {
      span {
        width: calc(100% - 65px);
      }
    }

    &__valuePlaceholder {
      color: $SM-valuePlaceholderColor;
    }

    &__valueCounter {
      color: $SM-counterColor;
      margin-left: 5px;
    }

    &__controls {
      box-sizing: border-box;
      display: flex;
      position: absolute;
      height: 100%;
      right: 0;
      padding: 0 12px;
      line-height: $SM-fieldHeight - 2;
      cursor: pointer;

      :not(:first-child) {
        margin-left: 10px;
      }
    }

    &__tags {
      box-sizing: border-box;
      display: flex;
      flex-direction: row;
      justify-content: flex-start;
      align-items: center;
      overflow-x: auto;
      padding-right: 20px;
      margin-right: 40px;
      margin-bottom: -50px;
      padding-bottom: 50px;

      &::-webkit-scrollbar {
        display: none;
      }
    }

    &__tag {
      box-sizing: border-box;
      display: flex;
      flex-direction: row;
      flex-wrap: nowrap;
      height: $SM-fieldHeight - 13px;
      line-height: $SM-fieldHeight - 13px;
      margin-right: 4px;

      &__label {
        box-sizing: border-box;
        color: $SM-tagColor;
        background-color: $SM-focusColor;
        padding: 0 11px 0 10px;
        border-radius: $SM-tagBorderRadius;
      }

      &__close {
        box-sizing: border-box;
        color: $SM-tagCloseColor;
        background-color: $SM-tagCloseBackgroundColor;
        padding: 0 5px;
        position: relative;
        left: -$SM-tagBorderRadius;
        border-top-right-radius: $SM-tagBorderRadius;
        border-bottom-right-radius: $SM-tagBorderRadius;
        cursor: pointer;

        &:hover {
          color: $SM-focusColor;
        }
      }
    }

    &__arrow {
      box-sizing: border-box;
      display: flex;
      flex-direction: column;
      justify-content: center;
      height: 100%;
      border-bottom-color: $SM-dropDownArrowColor;

      &:hover {
        border-bottom-color: $SM-dropDownActiveArrowColor;
      }

      .arrow {
        position: relative;
        border: 5.5px solid transparent;
        border-top-width: 0;
        border-bottom-color: inherit;
        height: 0;
        width: 0;
        transition: 0.4s;
      }

      &--up {
        @extend .arrow;
        transform: rotate(360deg);
        top: -1px;
      }

      &--down {
        @extend .arrow;
        transform: rotate(180deg);
        top: 1px;
      }

      &--active {
        border-bottom-color: $SM-dropDownActiveArrowColor !important;
      }

      &--disabled {
        border-bottom-color: $SM-dropDownArrowColor !important;
      }
    }

    &__loading {
      display: flex;
      flex-direction: column;
      justify-content: center;
      height: 100%;

      &__icon {
        @keyframes loading_spin {
          to {
            transform: rotate(1turn);
          }
        }
        box-sizing: border-box;
        animation: loading_spin 800ms infinite linear;
        width: 16px;
        height: 16px;
        border: 3px dotted $SM-dividerColor;
        border-radius: 50%;
        border-right-color: $SM-textColor;
        display: inline-block;
        position: relative;
        vertical-align: middle;
      }
    }

    &__reset {
      cursor: pointer;
      color: $SM-borderColor;

      &:hover {
        color: $SM-focusColor;
      }
    }
  }

  .DropDown {
    box-sizing: border-box;
    position: absolute;
    width: 100%;
    border-bottom-left-radius: $SM-borderRadius;
    border-bottom-right-radius: $SM-borderRadius;
    border: 1px solid $SM-focusColor;
    border-top: none;
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.06);
    max-height: $SM-dropDownHeight;
    z-index: $SM-dropDownZIndex;
    overflow: hidden;

    &--disabled {
      border-color: $SM-dividerColor;
    }

    &__searchField {
      box-sizing: border-box;
      display: block;
      border: none;
      border-bottom: 1px solid $SM-dividerColor;
      height: $SM-fieldHeight - 2;
      width: 100%;
      max-width: 100%;
      line-height: 1;
      padding: 10px 15px;
      color: $SM-searchTextColor;
      outline: none;
      font-family: inherit;

      &::placeholder {
        color: $SM-searchPlaceholderColor;
        opacity: 1;
      }

      &--selected {
        box-shadow: inset 0 0 3px $SM-searchSelectedColor;
        color: $SM-itemTextColor;
      }
    }

    &__selectAll {
      .Option__label {
        color: $SM-selectAllColor;
      }
    }
  }

  .OptionList {
    margin: 0;
    padding-left: 0;
    max-height: $SM-dropDownHeight - $SM-fieldHeight + 1;
    overflow-y: auto;
    scroll-behavior: smooth;

    &__item {
      list-style: none;
    }
  }

  .Option {
    box-sizing: border-box;
    display: block;
    padding: 0 15px;
    line-height: $SM-itemHeight;
    background-color: $SM-backgroundColor;
    color: $SM-itemTextColor;
    cursor: pointer;
    outline: none;

    &--focus {
      background-color: $SM-itemBackgroundFocusColor;
      outline: 0;
    }

    &--hover {
      background-color: $SM-itemBackgroundHoverColor;
      outline: 0;
    }

    &__label {
      display: inline-block;
      vertical-align: middle;
      border-bottom-right-radius: 2px;
      border-top-right-radius: 2px;
      cursor: default;
      padding: 2px 5px;
    }

    &__renderer {
      display: flex;
      justify-content: space-between;
      align-items: center;
    }
  }
}
