@import "~@cultureamp/kaizen-design-tokens/sass/color";
@import "~@cultureamp/kaizen-component-library/draft/Kaizen/Form/Primitives/Input/styles.scss";
@import "~@cultureamp/kaizen-component-library/styles/animation";
@import "~@cultureamp/kaizen-component-library/styles/border";
@import "~@cultureamp/kaizen-component-library/styles/type";

@mixin select-border($color: $color) {
  border-color: $color;
  box-shadow: 0 0 0 1px $color;
}

.basePlaceholder {
  @include ca-type-ideal-body;
  margin-left: 2px;
  margin-right: 2px;
  top: 50%;
  position: absolute;
  transform: translateY(-50%);
  box-sizing: border-box;
}
.container {
  position: relative;
  box-sizing: border-box;
}

.control {
  align-items: center;
  background-color: white;
  cursor: default;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  min-height: 48px;
  position: relative;
  box-sizing: border-box;
  border: solid 1px $ca-border-color;
  border-radius: $ca-border-radius;
  outline: 0 !important;

  &:hover {
    border-color: $ca-border-color-hover;
  }

  &.isFocused {
    @include select-border($color: $kz-color-cluny-500);
  }
}

.valueContainer {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  position: relative;
  box-sizing: border-box;
  flex: 1;
  padding: 2px 8px;
  overflow: hidden;
}

.singleValue {
  @extend .basePlaceholder;
  max-width: calc(100% - 8px);
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
}

.placeholder {
  @extend .basePlaceholder;
  opacity: $input-placeholder-opacity;
}

.faded {
  color: $kz-color-wisteria-300;
}

.bold {
  color: $kz-color-wisteria-800;
  font-weight: $ca-weight-book;
}

.fadedBold {
  color: $kz-color-wisteria-300;
  font-weight: $ca-weight-book;
}

.indicators {
  align-items: center;
  align-self: stretch;
  display: flex;
  flex-shrink: 0;
  box-sizing: border-box;
}

.indicatorContainer {
  display: flex;
  box-sizing: border-box;
  padding: 8px;
}

.iconButton {
  height: 20px;
  composes: interactiveIconWrapper from "~@cultureamp/kaizen-component-library/components/Icon/Icon.module.scss";
}

.menu {
  top: 100%;
  background-color: white;
  margin-bottom: 8px;
  position: absolute;
  width: 100%;
  box-sizing: border-box;
  border: 1px solid $ca-border-color;
  border-radius: $ca-border-radius;
  box-shadow: $ca-box-shadow;
  z-index: 1;
}

.menuList {
  max-height: 215px;
  overflow-y: auto;
  padding-bottom: 4px;
  padding-top: 4px;
  position: relative;
  box-sizing: border-box;
  position: relative;
}

.option {
  @include ca-type-ideal-body-bold;
  background-color: transparent;
  color: inherit;
  cursor: default;
  display: block;
  font-size: inherit;
  width: 100%;
  user-select: none;
  box-sizing: border-box;
  padding: 8px $ca-grid / 2;
  outline: none;

  &.isTarget:not(.isSelected) {
    background-color: $kz-color-stone;
  }

  &:focus:not(.isSelected) {
    background-color: $kz-color-ash;
  }

  &.isFocused:not(.isSelected) {
    background-color: $kz-color-ash;
  }
}

.isSelected {
  background-color: $kz-color-cluny-100;
}

.multiValue {
  margin: 2px;
  display: inline-block;
}

.cautionary {
  @include select-border($color: $kz-color-yuzu-300);

  &:hover {
    box-shadow: none;
  }
}

.error {
  @include select-border($color: $kz-color-coral-200);

  &:hover {
    box-shadow: none;
  }
}

.preventPointer {
  pointer-events: none;
}
