$custom-control-description-font-size: 13px;
$form-control-info-indicator-font-size: 10px;

.form {
  padding: 0 30px;
  background-color: $color-alabaster;
  overflow: hidden; // do not let margin get outside the dark background

  @include media-breakpoint-up(sm) {
    padding: 0 70px;
  }

  @include media-breakpoint-up(md) {
    padding: 0 80px;
  }

  @include media-breakpoint-up(lg) {
    padding: 0 95px;
  }

  &-title {
    @include typo-24-serif;
    border-bottom: 1px solid $color-silver;
    margin-top: 30px;
    margin-bottom: 12px;
    padding-bottom: 10px;

    @include media-breakpoint-up(sm) {
      @include typo-36-serif;
      margin-top: 45px;
      margin-bottom: 20px;
      padding-bottom: 20px;
    }

    @include media-breakpoint-up(md) {
      margin-top: 60px;
    }
  }

  fieldset {
    border-top: 1px solid $color-silver;
    margin-top: 15px;

    @include media-breakpoint-up(sm) {
      margin-top: 25px;

    }

    legend {
      @include typo-16;
      font-weight: $font-weight-medium;
      color: $color-scorpion;
      background-color: $color-alabaster;
      width: auto;
      margin-left: 15px;
      padding-left: 15px;
      padding-right: 15px;

      @include media-breakpoint-up(sm) {
        @include typo-20;
        margin-left: 30px;
        padding-left: 20px;
        padding-right: 20px;
        margin-bottom: 20px;
      }
    }
  }
}

// hack: more specifity than ".form-group label" to override typo-18 to typo-16
.form-group label.custom-checkbox {
  @include typo-16();
}

// TODO: disabled state
.custom-checkbox {
  display: block;
  margin-bottom: 7px;

  user-select: none;

  .custom-control-indicator {
    width: 16px;
    height: 16px;

    margin-right: 10px;

    background: $color-white;

    border: 1px solid $color-dusty-gray;
  }

  .custom-control-input:focus ~ .custom-control-indicator,
    // TODO: sticky state on iOS: shall we remove hover therefore?! see wtfforms.com
  &:hover .custom-control-input:not(:disabled) ~ .custom-control-indicator {
    border-color: $color-azure;
    box-shadow: none; // reset bootstrap
  }

  .custom-control-input:checked:not(:disabled) ~ .custom-control-indicator, // :not(:disabled) is used to give this more specifity than the :hover effect
  .custom-control-input:active:not(:disabled) ~ .custom-control-indicator {
    background: $color-azure;
    background-image: none; // reset bootstrap
    border-color: $color-azure;
  }
}

.custom-radio1-wrapper {
  display: flex;
}

.custom-radio.radio1 {
  padding: 0; // reset bootstrap

  margin-right: 1px;

  .custom-control-indicator {
    display: none;
  }

  .custom-control-description {
    display: block;

    padding: 4px 20px;

    // @include typo-18; // TODO: should be typo-12
    // @extend .typo-13; // TODO: use mixin instead of @extend. Should be typo-12 (doesn't exist tough in web guidelines)
    font-family: $font-family-sans-serif;
    font-size: $custom-control-description-font-size;
    font-weight: $font-small-semibold--weight;
    letter-spacing: 0.08em;

    color: $color-mineshaft;
    text-transform: uppercase;
    cursor: pointer;

    background: $color-mercury;
    border: 1px solid $color-dusty-gray;

    border-bottom-width: 2px;

    @include media-breakpoint-up(sm) {
      padding-top: 9px;
      padding-bottom: 8px;
    }
  }

  .custom-control-input:focus ~ .custom-control-description,
    // TODO: sticky state on iOS: shall we remove hover therefore?! see wtfforms.com
  &:hover .custom-control-input:not(:disabled) ~ .custom-control-description {
    color: $color-azure;

    border-color: $color-azure;
  }

  .custom-control-input:checked:not(:disabled) ~ .custom-control-description, // :not(:disabled) is used to give this more specifity than the :hover effect
  .custom-control-input:active:not(:disabled) ~ .custom-control-description {
    background: white;

    border-bottom-color: $color-azure;
  }
}

.custom-radio.radio2 {
  @include typo-18();
  display: inline-flex;

  padding: 0; // reset bootstrap

  margin: 0 40px 0 0;

  align-items: center;

  line-height: 1; // vertical positioning

  .custom-control-indicator {
    position: static; // reset bootstrap

    display: flex;

    width: 16px;
    height: 16px;

    margin-right: 20px;

    justify-content: center;

    align-items: center;

    background: white;

    border: 1px solid $color-silver;
    border-radius: 15px;

    &::after {
      display: block;

      width: 6px; // TODO: just a guess
      height: 6px;

      border: 1px solid $color-silver;
      border-radius: 50%;

      content: '';
    }
  }

  .custom-control-input:focus ~ .custom-control-indicator,
    // TODO: sticky state on iOS: shall we remove hover therefore?! see wtfforms.com
  &:hover .custom-control-input:not(:disabled) ~ .custom-control-indicator {
    border-color: $color-azure;
    box-shadow: none; // reset bootstrap

    &::after {
      background: $color-silver;

      border-color: $color-azure;
    }
  }

  .custom-control-input:checked:not(:disabled) ~ .custom-control-indicator, // :not(:disabled) is used to give this more specifity than the :hover effect
  .custom-control-input:active:not(:disabled) ~ .custom-control-indicator {
    background: none; // reset bootstrap

    &::after {
      background: $color-azure;

      border-color: $color-azure;
    }
  }
}

.custom-select {
  display: block;
  max-width: $axa-input-width;
  padding: 10px 60px 10px 20px;
  line-height: 1.5;
  color: #333333;
  cursor: pointer;
  background-color: #ffffff;
  height: 50px;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2210%22%20height%3D%227%22%3E%0D%0A%20%20%3Cpath%20fill-rule%3D%22evenodd%22%20fill%3D%22%23999%22%20d%3D%22M9.754%201.451L5.573%205.756c-.322.331-.844.331-1.166%200L.226%201.451c-.322-.332-.322-.87%200-1.202.321-.331.844-.331%201.166%200L4.99%203.954%208.588.249c.322-.331.844-.331%201.166%200%20.322.332.322.87%200%201.202z%22%2F%3E%0D%0A%3C%2Fsvg%3E");
  background-size: 12px 8px;
  border: 1px solid #cccccc;
  border-radius: 0;
  outline: 0;

  // TODO: sticky state on iOS: shall we remove hover therefore?! see wtfforms.com
  /* Hover */
  &:hover:not(:disabled),
    /* Focus */
  &:focus:not(:disabled),
    /* Active/open */
  &:active:not(:disabled) {
    border-color: $color-azure;
  }

  .form-group.has-danger &,
  &.custom-select-danger {
    color: $brand-danger;

    // TODO: sticky state on iOS: shall we remove hover therefore?! see wtfforms.com
    /* Hover */
    &:hover:not(:disabled),
      /* Focus */
    &:focus:not(:disabled),
      /* Active/open */
    &:active:not(:disabled) {
      color: $color-mineshaft;
      border-color: $brand-danger;
    }
  }
}

.custom-select-group {
  display: flex;
  flex-direction: column;
  align-items: stretch;

  .custom-select + .custom-select {
    margin-top: 5px;
  }

  @include media-breakpoint-up(sm) {
    flex-direction: row;

    .custom-select + .custom-select {
      margin-top: 0;
      margin-left: 10px;
    }
  }
}
