@import '../../../styles/base';

.outer {
  font-family: $font-stack;
  padding-bottom: 12px;
  position: relative;
  user-select: none;
  width: 280px;
  @include breakpoint(small) {
    width: 100%;
  }
}

.inline {
  @include inline-block;
}

.label {
  margin-bottom: 12px;
}

.input {
  display: none;
}

.select {
  background-color: $white;
  border: solid 1px $n_grey_2;
  border-radius: 4px;
  color: $navy_1;
  cursor: pointer;
  font-size: $input-size;
  font-weight: $regular;
  margin-bottom: 12px;
  position: relative;
  width: 100%;
  &:hover {
    border-color: $teal_2;
    color: $navy_2;
  }
  span {
    display: block;
    padding: 12px;
    padding-right: 42px;
    user-select: none;
  }
  @include transition(all 0.2s);
}

.expanded {
  .select {
    color: $navy_2;
    &:hover {
      border-color: $n_grey_2;
    }
    .caret {
      color: $teal_1;
      transform: rotate(180deg);
    }
  }
  .options {
    margin-left: 0;
    opacity: 1;
    pointer-events: auto;
    width: 100%;
    @include transition(opacity 0.2s, width 0.2s, margin-left, 0.2s);
  }
}

.caret {
  color: $navy_2;
  fill: currentColor;
  position: absolute;
  pointer-events: none;
  top: 5px;
  right: 8px;
  @include transition(all 0.2s);
}

.disabled {
  background-color: $n_grey_4;
  border-color: $n_grey_2;
  cursor: not-allowed;
  color: $navy_tint_1;
  &:hover {
    border-color: $n_grey_2;
    color: $navy_tint_1;
  }
  .caret {
    color: $navy_tint_2;
  }
}

.error, .error:active, .error:hover, .error:focus {
  background-color: $sp_light_red;
  border-color: $sp_red;
  color: $sp_red;
  .caret {
    color: $sp_red;
  }
  &.expanded {
    border-color: $sp_red;
    color: $sp_red;
  }
}

.errorMessage {
  margin-top: 12px;
  margin-bottom: 0;
}

.options {
  background-color: $white;
  border: solid 1px $n_grey_2;
  border-radius: 4px;
  box-shadow: 0 2px 12px $n_grey_1;
  cursor: pointer;
  font-size: $input-size;
  font-weight: $regular;
  list-style: none;
  margin: -4px 0 0 4%;
  max-height: 240px;
  opacity: 0;
  overflow-y: auto;
  padding: 0;
  position: absolute;
  pointer-events: none;
  width: 80%;
  z-index: 1;
  @include transition(margin-left 0.2s, opacity 0.2s, width 0.2s);
}

.option {
  color: $navy_1;
  padding: 12px;
  user-select: none;
  &:hover {
    background-color: $n_grey_4;
    color: $navy_2;
  }
  @include transition(all 0.2s);
}

.selected {
  background-color: $teal_tint_3;
}