/////////////////////////////////////////

// - Forms - //

/////////////////////////////////////////

input,
textarea,
select {
  -moz-appearance: none;
  -webkit-appearance: none;
  appearance: none;
  background-color: transparent;
  border: none;
  border: .1rem solid $light-grey;
  border-radius: 0;
  box-sizing: border-box;
  color: $darkest-grey;
  display: block;
  font-size: 1.7rem;
  height: 4.4rem;
  line-height: 1.3;
  max-width: 100%;
  outline: none;
  padding: 1rem .7em;
  width: 100%;
}

input:focus,
textarea:focus,
select:focus {
  box-shadow: 0 0 3px $medium-blue, 0 0 7px $medium-blue;
}

.input-error {
  margin-top: 3rem;
  padding-bottom: .8rem;
  padding-top: .8rem;
  position: relative;

  input {
    border: 3px solid $red;
    width: calc(100% +1.9rem);
  }

  textarea {
    border: 3px solid $red;
    width: calc(100% +1.9ream);
  }

  select {
    border: 3px solid $red;
    width: calc(100% +1.9rem);
  }

  label {
    margin-top: 0;
  }

  .input-inline {
    border: 1px solid $light-grey;
    width: inherit;
  }

  .input-inline-error {
    border: 3px solid $red;
  }
}

.input-error-label {
  display: block;
  font-size: 1.7rem;
  font-weight: $bold-weight;
}

.input-error-message {
  color: $red;
  display: block;
  font-size: 1.7rem;
  font-weight: $bold-weight;
  padding-bottom: 3px;
  padding-top: 3px;
}

label {
  color: $dark-blue;
  display: block;
  font-size: $small-font;
  font-weight: $normal-weight;
  margin-top: 2rem;
  max-width: 46rem;
}

textarea {
  height: 16rem;
}

select {
  -moz-appearance: none;
  -webkit-appearance: none;
  appearance: none;
  background-image: url('arrow-down.png');
  background-position: right 1.3rem center;
  background-repeat: no-repeat;
  background-size: 1.3rem;
}

legend {
  font-size: 3rem;
  font-weight: $bold-weight;
}

.fieldset-inputs label {
  margin-top: 0;
}

.form-hint {
  color: $light-grey;
  font-family: $font-family;
  margin-bottom: 0;
}

input[type='checkbox'],
input[type='radio'] {
  clip: rect(1px, 1px, 1px, 1px);
  margin-left: -2rem;
  position: absolute;
}

input[type='checkbox'] + label,
input[type='radio'] + label {
  cursor: pointer;
  font-weight: $normal-weight;
  margin-bottom: .5em;
}

input[type='checkbox'] + label::before,
input[type='radio'] + label::before {
  background: $white;
  border-radius: .3rem;
  box-shadow: 0 0 0 1px $light-grey;
  content: '\a0';
  display: inline-block;
  height: 1.8rem;
  line-height: 1.8rem;
  margin-right: .6em;
  text-indent: .15em;
  vertical-align: middle\0;
  width: 1.8rem;
}

input[type='radio'] + label::before {
  border-radius: 100%;
  box-shadow: 0 0 0 2px $white, 0 0 0 3px $light-grey;
  height: 1.6rem;
  line-height: 1.6rem;
  width: 1.6rem;
}

input[type='checkbox']:checked + label::before,
input[type='radio']:checked + label::before {
  background-color: $medium-blue;
  box-shadow: 0 0 0 1px $medium-blue;
}

input[type='radio']:checked + label::before {
  box-shadow: 0 0 0 2px $white, 0 0 0 4px $medium-blue;
}

input[type='radio']:focus + label::before {
  box-shadow: 0 0 0 2px $white, 0 0 0 4px $medium-blue, 0 0 3px 4px $medium-blue, 0 0 7px 4px $medium-blue;
}

input[type='checkbox']:checked + label::before {
  background-image: url('../images/correct8.png');
  background-image: url('../images/correct8.svg');
  background-position: 50%;
  background-repeat: no-repeat;
}

input[type='checkbox']:focus + label::before {
  box-shadow: 0 0 0 1px $white, 0 0 0 3px $medium-blue;
}

input[type='checkbox']:disabled + label {
  color: $light-grey;
}

input[type='checkbox']:disabled + label::before,
input[type='radio']:disabled + label::before {
  background: $light-grey;
  box-shadow: 0 0 0 1px $light-grey;
  cursor: not-allowed;
}

.unstyled-list {
  list-style-type: none;
  margin: 0;
  padding: 0;

  li {
    display: list-item;
    margin: 0;
  }

  li::before {
    display: none;
  }

  li::after {
    display: none;
  }
}

.required::after {
  @include fa-icon;
  color: $red;
  content: '\f069';
}

/////////////////////////////////////////

// - Autocompleter - //

/////////////////////////////////////////

.react-autosuggest__container {
  position: relative;
}

.react-autosuggest__input:focus {
  outline: none;
}

.react-autosuggest__suggestions-container {
  background-color: $white;
  border: 1px solid $light-grey;
  border-bottom-left-radius: 4px;
  border-bottom-right-radius: 4px;
  display: none;
  font-family: Helvetica, sans-serif;
  font-size: 16px;
  font-weight: 300;
  position: absolute;
  width: 100%;
  z-index: 2;

  &.force-open {
    display: block;
  }
}

.react-autosuggest__container--open {
  .react-autosuggest__input {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
  }

  .react-autosuggest__suggestions-container {
    display: block;
  }
}

.react-autosuggest__suggestions-list {
  list-style-type: none;
  margin: 0;
  padding: 0;

  em {
    background-color: $orange;
    font-style: normal;
    font-weight: bold;
  }
}

.react-autosuggest__suggestion {
  border-bottom: 2px solid $light-grey;
  cursor: pointer;
  padding: 10px 20px;
}

.react-autosuggest__suggestion--focused {
  background-color: $light-grey;
}
