@import "mixins";

.lea-input-select {
  position: relative;
  float: left;
  width: 100%;
  z-index: 1;
  input {
    width: 100%;
    border-radius: $border-radius;
    box-shadow: none;
    border: $border-input;
    background-color: $background-input;
    font-family: $title;
    font-size: 1rem;
    padding: 1.2rem 1rem 0.5rem;
    margin: 1.1rem 0;
    color: $black;
    box-sizing: border-box;
    transition: $short-transition;
    cursor: pointer;
    &:focus {
      outline: none;
      transition: $short-transition;
      border: $border-focus;
    }
    &.input-error {
      transition: $short-transition;
      border: $border-error;
      color: $red;
    }
    &:disabled {
      background-color: $bg-grey;
      border: $border-disabled;
      color: $dark-grey;
      cursor: not-allowed;
      & ~ .select-arrow {
        z-index: 2;
        cursor: not-allowed;
        path {
          fill: $light-grey;
        }
      }
      & ~ .clear-button{
        display: none;
      }
    }
    display: block;
    line-height: 1.3;
    -moz-appearance: none;
    -webkit-appearance: none;
    appearance: none;
    background-color: $background-input;
    ::-ms-expand {
      display: none;
    }
  }
  .select-arrow {
    position: absolute;
    right: 1rem;
    top: 1.95rem;
    z-index: -1;
    transform: scale(0.8);
    path {
      fill: $accent;
    }
  }
  .clear-button {
    position: absolute;
    right: 0.75rem;
    top: 1.6rem;
    z-index: -1;
    transform: scale(0.8);
    z-index: 3;
  }
  label {
    position: absolute;
    transform-origin: left;
    top: 2.05rem;
    left: 1rem;
    font-size: 1rem;
    color: $dark-grey;
    &.label-focus {
      color: $accent;
      transition: color 0.5s;
    }
    // &.label-float {
    //   transform: scale(0.7) translate(-1.5rem, -1rem);
    //   transition: transform 0.5s;
    // }
    &.label-float {
      transform: scale(0.7) translate(0rem, -1rem);
      // transform-origin: left;
      transition: $short-transition;
  }
  &.label-not-float {
    transform: scale(1) translate(0);
    transition: $short-transition;
}
    &.label-error {
      color: $red;
      transition: color 0.5s;
    }
    &.label-disabled {
      color: $dark-grey;
    }
  }
  .select-dropdown {
    @include select-dropdown;
  }
  .error {
    position: absolute;
    bottom: 0;
    font-size: 0.7rem;
    height: 0.7rem;
    overflow: hidden;
    left: 0;
    span {
      position: relative;
      float: left;
      color: $red;
      animation: 0.2s error ease-in-out;
    }
  }

  @keyframes error {
    from {
      margin-top: -1rem;
    }
    to {
      margin-top: 0;
    }
  }
}
.spinner {
  width: 20px;
  height: 20px;
  position: relative;
  float: right;
  margin-right: 0.5rem;
}
.lea-input-loading {
  position: absolute;
  right: 0.5rem;
  top: 2.15rem;
  z-index: -1;
  z-index: 3;
}

.dark-mode {
  .lea-input-select {
    label {
      color: $light-grey;
    }
    input {
      color: $white;
      &:disabled {
          background-color: $dark-grey;
          border: $border-disabled;
          color: $grey;
      }
    }
    .select-dropdown {
      @include dark-select-dropdown
    }
  }
}
