@import '../style/mixins.less';

.kt-select-overlay {
  position: fixed;
  width: 100%;
  height: 100%;
  left: 0px;
  top: 0px;
  z-index: -1;
}

.kt-select-container {
  position: relative;
  user-select: none;
  min-width: 0px;

  .kt-select-search {
    -webkit-appearance: none;
    background: transparent;
    line-height: inherit;
    outline: none;
    border: none;
    width: 100%;
    padding: 0;
    font-size: 14px;
  }

  .kt-select-value {
    margin: 0px;
    max-width: 100%;
    border-radius: 2px;
    color: var(--kt-select-foreground);
    background-color: var(--kt-select-background);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0px 8px;
    flex: 1;
    border-style: solid;
    border-width: 1px;
    border-color: var(--kt-select-border);
    cursor: pointer;
    box-sizing: border-box;

    & > span {
      color: var(--kt-select-foreground);
      cursor: pointer;
    }

    .kt-select-option {
      text-overflow: ellipsis;
      overflow: hidden;
      white-space: nowrap;
      flex: 1;
      min-width: 0px;
      cursor: pointer;
      display: inline-block;
      width: 100%;
    }

    .kt-select-value-active,
    &:hover {
      box-sizing: border-box;
      border-color: var(--kt-selectOption-activeBorder);
    }

    &.kt-select-disabled {
      pointer-events: none;
      cursor: not-allowed;
      background-color: var(--kt-select-disableBackground);
      color: var(--kt-select-disableForeground);
      .kt-select-option,
      .kt-icon {
        color: inherit;
      }
    }
    &.kt-select-warning {
      border-color: var(--kt-select-warningForeground);
    }
  }

  .kt-select-warning-text {
    background-color: var(--kt-select-warningForeground);
    padding: 4px 8px;
    color: @white;
  }

  .kt-select-value-active {
    box-sizing: border-box;
    border-color: var(--kt-selectOption-activeBorder);
  }

  .kt-select-value-large,
  .kt-select-value-large > span {
    height: 30px;
    font-size: 14px;
    line-height: 30px;
  }

  .kt-select-value-default,
  .kt-select-value-default > span {
    height: 28px;
    font-size: 12px;
    line-height: 28px;
  }

  .kt-select-value-default-icon {
    margin-left: 5px;
  }

  .kt-select-value-small,
  .kt-select-value-small > span {
    height: 22px;
    font-size: 12px;
    line-height: 22px;
  }
}

.kt-select-option-icon {
  margin-right: 5px;
}

.kt-select-options {
  display: none;
  position: fixed;
  margin-top: 4px;
  max-width: 100%;
  color: var(--kt-selectDropdown-foreground);
  background-color: var(--kt-selectDropdown-background);
  z-index: 20;
  border-radius: 2px;
  overflow-y: auto !important;
  .overlay-shadow();

  .kt-select-option-default {
    display: flex;
    align-items: center;
    .kt-select-option-icon {
      margin-right: 5px;
    }
    position: relative;
  }

  .kt-select-option-select {
    span {
      display: inline-block;
      margin: 0 2px;
      width: calc(100% - 4px);
      box-sizing: border-box;
      outline: 1px solid var(--list-focusOutline);
      outline-offset: -1px;
      color: var(--kt-selectDropdown-selectionForeground);
      background-color: var(--kt-selectDropdown-selectionBackground);
      &:hover {
        background-color: var(--kt-selectDropdown-selectionBackground);
      }
    }
  }

  .kt-select-description {
    line-height: 1;
    margin-bottom: -3px;
  }

  span {
    color: var(--kt-selectDropdown-foreground);
    background-color: var(--kt-selectDropdown-background);
    cursor: pointer;
    height: 26px;
    padding: 0px 16px;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
    line-height: 26px;
    display: inline-block;
    margin: 0 2px;
    width: calc(100% - 4px);
    box-sizing: border-box;
    &:hover {
      box-sizing: border-box;
      outline: 1px solid var(--list-focusOutline);
      outline-offset: -1px;
      background-color: var(--kt-selectDropdown-hoverBackground);
    }
  }

  .kt-option-divider {
    height: 1px;
    background-color: var(--kt-select-border);
    width: 100%;
    margin: 0 auto;
  }

  .kt-option-description {
    min-height: 26px;
    max-height: 52px;
    font-size: 12px;
    line-height: 26px;
    padding: 0 16px;
    text-overflow: ellipsis;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }

  .kt-option-disabled {
    pointer-events: none;
    background-color: var(--kt-select-disableBackground);
    color: var(--kt-select-disableForeground);
  }

  &.kt-select-options-visible {
    display: block;
  }

  &.kt-select-options-large {
    padding: 4px 0px;

    & > span,
    & > div > span {
      height: 30px;
      font-size: 14px;
      line-height: 30px;
    }
    .kt-select-group-header {
      font-size: 14px;
      line-height: 30px;
    }
  }

  &.kt-select-options-default {
    padding: 3px 0px;

    & > span,
    & > div > span {
      height: 26px;
      font-size: 12px;
      line-height: 26px;
    }
    .kt-select-group-header {
      font-size: 12px;
      line-height: 26px;
    }
  }

  &.kt-select-options-small {
    padding: 3px 0px;

    & > span,
    & > div > span {
      height: 26px;
      font-size: 12px;
      line-height: 26px;
    }
    .kt-select-group-header {
      font-size: 12px;
      line-height: 26px;
    }
  }

  .kt-option-with-check {
    padding-left: 20px;
  }

  .kt-select-group-header {
    padding-left: 5px;
    color: var(--kt-selectDropdown-teamForeground);
    display: flex;
  }

  .kt-option-check {
    position: absolute;
    left: 0;
    height: 100%;
    display: flex;
    align-items: center;
    .kt-icon {
      width: 20px;
      padding: 0 4px;
      background-color: transparent;
    }
  }
}
