@import '../../assets/styles/colors';
@import '../../assets/styles/rsfonts';

.storybook-autocomplete-container {
  position: relative;
  .storybook-autocomplete {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 4px;
    outline: none;
    position: relative;
    z-index: 1;
    &--disabled {
      opacity: 0.5;
    }
    &--border {
      padding: 8px;
      border: 1px solid $grey_2;
      &:hover {
        border: 1px solid $primary;
      }
      &.storybook-autocomplete--error {
        border-color: $error;
      }
      &.storybook-autocomplete--focused {
        border-color: $primary;
      }
    }
    &--no-border {
      border: 1px solid transparent;
    }
    &--no-borderOnHover {
      border: none;
      &:hover {
        border: 1px solid $grey_2;
      }
    }
    &:active:focus:focus-within {
      outline: none;
    }
    .storybook-autocomplete-input-container {
      flex: 1;
      border-top-left-radius: 4px;
      border-bottom-left-radius: 4px;
      display: flex;
      justify-content: space-between;
      align-items: center;
      .storybook-autocomplete-inputField {
        @extend .fontPoppinsRegularSm;
        outline: none;
        border: none;
        padding: 0px;
        width: calc(100% - 10px);
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        border-top-left-radius: 5px;
        border-bottom-left-radius: 5px;
        background-color: transparent;
        &--placeholder {
          opacity: 0.5;
        }
      }
      .storybook-autocomplete-close {
        padding-right: 10px;
        cursor: pointer;
      }
    }
  }
  .storybook-autocomplete--error-text {
    color: $error;
    font-size: 8px;
  }
}

.storybook-autocomplete-options-container {
  outline: none;
  background: $white_1 0% 0% no-repeat padding-box;
  box-shadow: 0px 0px 6px $shadow;
  border-radius: 5px;
  opacity: 1;
  margin-top: 5px;
  padding: 16px 0;
  position: absolute;
  z-index: 999;
  width: 100%;
  &:active:focus:focus-within {
    outline: none;
  }

  .storybook-autocomplete-options-wrapper {
    overflow: auto;
    min-height: 20px;
    max-height: 175px;
    opacity: 1;
    &::-webkit-scrollbar {
      border-radius: 10px;
      background-color: $grey_3;
      width: 4px;
      margin-left: 5px;
    }
    &::-webkit-scrollbar-thumb {
      border-radius: 10px;
      background-color: $grey_5;
      width: 7px;
    }
    .storybook-autocomplete-option-list {
      list-style-type: none;
      padding: 0;
      margin: 0;
      .storybook-autocomplete-option-box {
        padding-left: 16px;
        padding-right: 8px;
        cursor: pointer;
        color: $text_color;
        line-height: 35px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        @extend .fontPoppinsRegularSm;
        &:hover,
        &.focused,
        &.selected {
          background-color: $primary;
          color: $white;
        }
      }
    }
    .storybook-autocomplete-empty-options {
      color: $text_color;
      line-height: 35px;
      margin: 0;
      padding-left: 16px;
      padding-right: 8px;
      @extend .fontPoppinsRegularSm;
    }
  }
}

.storybook-stories-autocomplete-container {
  display: flex;
  .storybook-stories-autocomplete-variants-container {
    width: 200px;
    padding: 0 16px;
  }
}

.storybook-autocomplete-overlay {
  height: 100%;
  width: 100%;
  background-color: transparent;
  z-index: 998;
  position: fixed;
  top: 0;
  left: 0;
  overflow: hidden;
}
