@use '../../../styles/scss/variables' as V;

.jds-options {
  display: inline-block;
  position: relative;
  background-color: V.$white;
  // FIXME: UNDEFINED COLOR IN DESIGN SYSTEM
  border: 1px solid #BDBDBD;
  border-radius: 8px;
  box-shadow: 0 4px 10px 0 rgba(0,0,0,0.08);
  overflow-x: hidden;
  overflow-y: auto;

  &,
  & * {
    cursor: pointer;
  }

  *[tabindex="0"] {
    
    &,
    &:focus {
      outline: none;
    }
  }

  &__dropdown {
    position: relative;
  }

  &__header {
    display: none;
    padding: 8px;
    text-align: center;
    border-bottom: 1px solid V.$gray-300;
    font-size: 16px;
    line-height: 26px;
  }

  &__filter {
    z-index: 1;
    position: absolute;
    width: calc(100% - (16px * 2));
    height: 36px;
    padding: 8px 16px;
  }
  
  &__option-list {
    z-index: 0;
    list-style: none;
    padding: 16px 0;
    margin: 0;
  
    &--multiple {
      padding: 12px 0;
    }
  }
 
  &__option-list-item {
    position: relative;
    cursor: pointer;
    overflow: hidden;
    padding: 0 16px;
    height: 20px;
    // TODO: define font-size typography class
    font-size: 14px;
    line-height: 16px;
  
    & + & {
      margin-top: 12px;
    }
  
    &--selected {
      padding-left: 24px;
    }

    &:hover > &__text,
    &--selected > &__text {
      color: V.$green-700;
      font-weight: bolder;
    }
    
    &:hover,
    &:focus,
    &:focus-within {
      background-color: V.$gray-50;
      outline: none;
      border: none;
    }
  }
}

// STATE
.jds-options {
  &:not(&--filterable) & {
    &__filter {
      display: none;
    }
  }

  &--filterable {
    min-width: 150px;
  }

  &--filterable & {
    &__option-list {
      position: relative;
      // defaultPaddingTop + filterInputHeight + (filterInputMarginY * 2)
      padding-top: 16px + 36px + (8px * 2);
    }
  }

  &--has-header & {
    &__header {
      display: block;
    }
  }
}
