@import '_checkbox-radio.scss';

input,
label,
select,
textarea {
  font-family: $primary-font;
  font-size: .875rem;
}

input,
textarea {
  border: 1px solid $grey;
  padding: 10px;
  width: 100%;
}

select {
  font-size: .875rem;
  border: 0;
  border-radius: 0;
  border-bottom: 1px solid $grey;
  background: none;
  padding: 5px 30px 5px 0;
  height: 30px;
  /* Removes the default <select> styling */
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  /* Positions background arrow image */
  background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAHCAYAAAAxrNxjAAAAAXNSR0IArs4c6QAAAJVJREFUGBlt0EEKwkAMBdAkXdRjeImCJyiCu9JTqNsBz9DpLFvwEqKIl1M6v4laGWqzS/6bvxhu264aIoKwHJ3bPyiZpulKEM6c8UkUeSKsI4aL9/1ucl90s4y0iPWwJY5XgHJFT+GsAvDSJkOrz01qtoY5Jn2ZIucO9zdcwHbSdqkN2fKDtiTNnCLL/kZ/oQih38yDET+eUFeYCxvjAAAAAElFTkSuQmCC');
  background-repeat: no-repeat;
  background-position: 99% 50%;
  width: 100%;
}
/* Internet Explorer 10–11 and Edge */
select::-ms-expand {
  display: none;
}

option {
  padding: 5px;
  color: $black;
}

label {
  color: $grey-dark;
  margin-bottom: 3px;
}

input[type][disabled] {
  background-color: $grey-light;
  color: $grey;
  border: 0;
  cursor: default;
}

input[type][disabled] + label {
  color: $grey-dark;
  cursor: default;
}

select[disabled] {
  background-color: $grey-light;
  color: $grey;
  border: 0;
  cursor: default;
  padding-left: 5px;
}

select[disabled] + label {
  color: $grey-dark;
  cursor: default;
}

*:focus {
  outline: none;
}

.form-field {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  margin: 0 0 20px;
  width: 100%;
  max-width: 400px;

  &--small {
    max-width: 100px;
  }

  &--full-width {
    max-width: 100%;
  }

  &--radio {
    flex-direction: row;
    align-items: center;
    max-width: 100%;

    & label {
      cursor: pointer;
      margin: 0;
    }
  }

  &--checkbox {
    flex-direction: row;
    align-items: center;
    max-width: 100%;

    & label {
      cursor: pointer;
      margin: 0;
    }
  }

  &--pagination {
    flex-direction: row;
    align-items: center;
    margin: 0;

    & label {
      margin-right: 10px;
    }
  }

  &--search {
    margin: 0;
    max-width: 100%;

    & input {
      border: 0;
    }
  }
}

.toggle {
  & input[type=checkbox] {
    height: 0;
    width: 0;
    visibility: hidden;
  }

  & label {
    cursor: pointer;
    text-indent: -9999px;
    width: 40px;
    height: 18px;
    background: $grey;
    display: block;
    border-radius: 20px;
    position: relative;
  }

  & label:after {
    content: '';
    position: absolute;
    top: 2px;
    left: 3px;
    width: 14px;
    height: 14px;
    background: $white;
    border-radius: 18px;
    transition: .3s;
  }

  & input:checked + label {
    background: $primary-button-color;
  }

  & input:checked + label:after {
    left: calc(100% - 3px);
    transform: translateX(-100%);
  }

  & label:active:after {
    width: 40px;
  }

  &__item {
    width: 100%;
    margin: 15px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  &__text {
    font-weight: 500;
    font-size: .875rem;
    letter-spacing: $x-small-space;
  }
}

.form-group {
  width: 100%;
  margin: 20px 0;

  &__heading {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    font-size: .875rem;
    color: $nearly-black;
    margin-bottom: 20px;
    font-weight: $font-semi-bold;
  }

  &--required {
    position: relative;

    &:before {
      content: '*';
      color: $secondary-color;
      font-size: 1.125rem;
      position: absolute;
      left: -12px;
      top: -2px;
    }
  }
}

.required {
  position: relative;

  &::before {
    content: '*';
    color: $red;
    font-size: 1.125rem;
    position: absolute;
    top: 0;
    left: -10px;
  }
}
.hidden {/*visible on screen readers only*/
  border: 0;
  clip: rect(0 0 0 0);
  clip-path: polygon(0px 0px, 0px 0px, 0px 0px);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  width: 1px;
  white-space: nowrap;
}
