// Forms

.usajobs-form,
.usajobs-content-well .usajobs-form {
  max-width: inherit;

  @include media($L) {
    max-width: inherit;
  }

  @media screen and (-webkit-min-device-pixel-ratio: 0) {
    select,
    textarea,
    input {
      font-size: 17px;
    }
  }

  select,
  textarea,
  input {
    -webkit-appearance: none;
  }

  // Defeat Chrome's number spinner
  input[type="number"]::-webkit-inner-spin-button,
  input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    appearance: none;
    margin: 0;
  }

  legend {
    width: 100%;
    font-size: $h3-font-size;
  }

  &__legend {
    display: block;
    font-style: italic;
    font-size: $base-font-size;
    font-weight: normal;
    color: $color-base;
    line-height: $base-line-height;
    margin-bottom: $size-S;
    margin-top: $size-S;

    @include media($M) {
      display: inline-block;
      float: right;
    }
  }

  &__label-header {
    margin-top: $size-M;

    .usa-input-label-helper {
      font-weight: normal;
    }
  }

  &__divider {
    border-top: 1px solid $color-gray-lighter;
  }

  .usajobs-fieldset {
    width: 100%;
    margin-bottom: $size-L;

    &.first {
      margin-top: $size-L;
    }

    legend {
      @include h3();
      margin: $size-M 0 $size-default;
      color: $color-primary-darker;

      & + label,
      & + p {
        margin-top: 0;
      }
    }
  }

  .usajobs-fieldset--horizontal {
    label {
      @include media($L) {
        margin-top: 0;
      }
    }

    .usa-input-error {
      padding-top: 0;
      padding-left: $size-S;

      @include media($L) {
        margin-top: 0;
        padding-left: $size-default;
      }
    }

    &__col-in-group {
      clear: none;
      display: block;
      float: left;
      margin-right: $size-default;
      width: 9rem;
    }

    &__col,
    &__col-right {
      @include media($ML) {
        @include span-columns(3, 6);
      }

      @include media($L) {
        @include span-columns(6, 12);
      }
    }

    &__col-right {
      @include media($ML) {
        @include omega();
      }

      @include media($L) {
        @include omega();
      }
    }

    &__row {
      margin-top: $size-M;
      max-width: $input-max-width;

      @include media($ML) {
        @include row();
        margin-top: 0;
        max-width: inherit;
        text-align: right;
      }

      @include media($L) {
        @include span-columns(12, 12);
        text-align: right;
      }
    }
  }

  &__container {
    clear: both;
  }

  &__help-brief {
    margin-top: $size-base;
    font-size: $small-font-size;
    max-width: $input-max-width;
  }

  &__help-brief + &__sub-title {
    margin-top: $size-M;
  }

  &__help-extended {
    margin: $size-S 0;
    padding: $size-default;
    background-color: $color-primary-alt-lightest;
    max-width: $input-max-width;

    h3,
    h4,
    h5 {
      margin-top: 0;
    }
  }

  &__help-detailed {
    margin-top: $size-default;
    max-width: $input-max-width;

    .usajobs-form__help-detailed-trigger {
      background-color: $color-primary-alt-lightest;

      &:hover {
        background-color: $color-primary-alt-light;
      }
    }

    .usajobs-form__help-detailed-content {
      border-color: $color-primary-alt-lightest;
    }
  }

  &__help-details {
    max-width: $input-max-width;
    font-size: $small-font-size;
  }

  .help-icon {
    padding-left: $size-base;
    color: $color-primary-darker;
  }

  &__sub-section {
    margin-top: $size-L;
  }

  &__field-group {
    margin-bottom: $size-XL;
  }
}

.usajobs-form-reveal-fields,
.usajobs-form-reveal-field {
  &[aria-hidden="true"] {
    display: none;
  }
}

.usajobs-form-grid {
  @include outer-container();

  &__col,
  &__col--right {
    @include media($L) {
      @include span-columns(6);
    }
  }

  &__col--right {
    @include media($L) {
      @include omega();
    }
  }

  &__full-col {
    @include span-columns(12);
  }
}

.usajobs-form--narrow,
.usajobs-content-well .usajobs-form--narrow {
  max-width: $input-max-width;

  .usajobs-form__legend {
    margin-bottom: $size-L;
  }
}

// Inputs
input[disabled],
input[readonly],
select[disabled] {
  color: $color-gray;
  border-color: $color-gray-lighter;
  cursor: not-allowed;
}

.usajobs-input-large {
  max-width: 100%;
}

.usajobs-date-group {
  @include clearfix();

  &__title {
    margin-bottom: 0;
  }

  label {
    margin-top: 0;
  }
}

.usa-input-error label {
  font-weight: 700;
}

.usa-input-error .usa-datefield input {
  width: 100%;
}

// this will come from the Standards once we catch up
.usa-input-label-helper {
  color: #757575;
  font-weight: normal;
}

.usajobs-form-autocomplete--single {
  &__list {
    @include unstyledList();
  }

  &__list > &__selected {
    // Mimics a text input
    height: 4.4rem;
    margin: 0.2em 0;
    padding: $size-S 0.7em;
    border: 0.1rem solid $color-gray;
    max-width: $input-max-width;
  }

  &__remove-selection {
    padding: $size-S $size-XS;
    color: $color-secondary;
    font-size: $h4-font-size;
    vertical-align: middle;
    line-height: 1;

    &:visited {
      color: $color-secondary;
    }

    &:hover {
      color: $color-secondary-darkest;
    }
  }
}
