// Adds to ../govuk_elements/_forms.scss

.form-control {
  width: 100%;
  padding: 0.5em;
}

select.form-control {
  border-radius: 0;
  color: $text-colour;
  background-color: $white;
  height: 40px;
  padding: 0 0.5em;
  position: relative;

  min-width: 11.5em;
  max-width: 100%;

  @include media(tablet) {
    height: 48px;
  }
}

.form-control.small {
  width: 50%;
}

.form-control-1-4 {
  width: 25%;
}

.form-control-1-2 {
  width: 50%;
}

.form-control-auto {
  width: auto;
}

.form-group {
  margin-bottom: $gutter;
  clear: both;

  input[type=file] {
    line-height: 1ex;
  }

  .suffix {
    display: inline-block;
    margin-left: $gutter-one-quarter;
  }
}

.button-group {
  $horizontal-gap: spacing(3);
  $vertical-gap: spacing(3);

  $button-padding: spacing(2);
  $button-shadow-size: 2px;

  @include responsive-margin(6, "bottom", $adjustment: $vertical-gap * -1);

  display: flex;
  flex-direction: column;
  align-items: center;

  .button {
    margin-bottom: $vertical-gap + $button-shadow-size;
  }

  @include media(tablet) {
    margin-right: ($horizontal-gap * -1);

    flex-direction: row;
    flex-wrap: wrap;
    align-items: baseline;

    .button {
      margin-right: $horizontal-gap;
    }
  }
}

.form-group.error {
  @extend %outdent-to-full-width;

  @include media(tablet) {
    margin-left: -$gutter;
    margin-right: -$gutter;
    padding-left: $gutter - 5px;
    padding-right: $gutter;
  }
}

// Replication .form-label-bold without the font
.error .form-label {
  @extend .form-label-bold;
}

.character-count {
  color: $secondary-text-colour;
  float: right;
  padding-left: $gutter;
  @include media(tablet) {
    padding-left: $gutter *2;
  }
}
.character-count.too-many-characters {
  color: $error-colour;
}
.form-control--error {
  border-color: $error-colour;

  &:focus {
    box-shadow: inset 0 0 0 2px $error-colour;
  }
}

.form-label {
  margin-bottom: 10px;

  .optional {
    color: $secondary-text-colour;
    margin-left: 0.5em;
  }
}

.block-label {
  box-sizing: border-box;
  border: 1px solid $border-colour;
  padding: ($gutter-one-third $gutter $gutter-one-third $text-indent);

  input {
    top: 12px;
    left: $gutter-one-third;
  }
}

.form-group-help {
  margin: 5px 0 0;
}

.form-hint {
  margin-top: 10px;
}
