.bootstrap4-multi-input {
  margin: auto;
}

.form-group {
  display: flex;
}

.form-control:focus {
  box-shadow: 0 0 0 1px rgba(58, 165, 124, 0.25);
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

input[type="number"] {
  -moz-appearance: textfield;
}

.help-block {
  color: $gray;
}

form label.col-form-label {
  padding-top: 4px;
  text-align: right;
  font-weight: bold;

  .optional {
    font-weight: normal;
    color: $gray;
  }
}

form small.form-text.text-muted {
  color: $body-color-light;
  font-size: inherit;
  a {
    text-decoration: underline;
  }
}
form .form-check + small.form-text {
  margin-top: -8px;
  margin-left: 36px;
}

form .form-control:disabled,
.form-control[readonly] {
  background-color: $gray-lightest !important;
}

#auth-form {
  .auth-form-block {
    margin: 12px;
  }
}

.labelless-password-input-form {
  margin-left: auto;
  margin-right: auto;

  .form-group {
    flex-direction: column;
  }

  input.password_strength,
  input.password_confirmation {
    height: 100%;
    display: block;
    width: 100%;
    flex-grow: 1;
  }
}
input.password_strength {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  &:focus {
    border-bottom: 0;
    + .password-progress .password-progress-bar {
      border: #89d6b8 2px solid;
      border-top: 0;
    }
  }
}

#auth-form {
  flex-direction: row;
  .form-group {
    flex-direction: column;
  }
}

.password-input-form,
.labelless-password-input-form {
  p.text-muted {
    font-size: 80%;
    padding-top: 2px;
    padding: 0;
    margin-bottom: 0;
    color: $body-color-light;
  }

  .password-progress {
    margin-top: 0 !important;

    .password-progress-bar {
      height: 4px;
      margin-bottom: 0 !important;
      border-bottom-left-radius: 4px;
      border-bottom-right-radius: 4px;
      border-top-left-radius: 0px;
      border-top-right-radius: 0px;
    }
  }
}

.password_strength_info {
  margin-bottom: 0;
}

.password_strength_info.hidden {
  display: none;
  display: block;
  visibility: hidden;
}

.progress-bar-warning {
  background-color: $brand-warning;
}

.progress-bar-danger {
  background-color: $brand-danger;
}

.header {
  background-color: $brand-primary;
}

table .form-radio,
table .form-check,
table .radio .form-check {
  line-height: 1.4;
  margin-top: 2px;
  label:before, label:after {
    margin-left: -35px;
  }
}

.checkbox-multi-select {
  height: calc(2.25rem - 2px);
  margin-top: 0px !important;
  width: 300px;

  .multi-select-title {
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
  }

  .multi-select-options {
    display: none;
    position: absolute;
    margin-top: calc(2.25rem - 2px);
    padding: 16px;
    padding-bottom: 4px;
    background-color: $white;
    border: 1px solid #ced4da;
    border-bottom-left-radius: 0.25rem;
    border-bottom-right-radius: 0.25rem;
    color: #495057;
    width: 300px;
    z-index: 100;
    .form-group {
      margin-bottom: 0;
    }
  }
  &:hover {
    .multi-select-options {
      display: inherit;
    }
  }
}

.form-check {
  position: relative;
  padding: 4px 0 4px 36px;

  label {
    cursor: pointer;
    display: inherit !important;
    position: relative;

    &:before,
    &:after {
      content: "";
      position: absolute;
    }

    &:before {
      left: 0;
      width: 24px;
      height: 24px;
      background: $offwhite;
      box-shadow: 0 0 2px $gray-500;
      margin-left: -34px;
      border-radius: 4px;
    }

    &:after {
      top: 0;
      left: 4px;
      width: 16px;
      height: 16px;
      margin: 4px 0px 0;
      opacity: 0;
      background: $brand-success;
      margin-left: -34px;
      border-radius: 2px;
    }
  }

  input {
    position: absolute;
    left: 0px;
    opacity: 0;

    &:checked + label {
      &:before {
      }

      &:after {
        opacity: 1;
      }
    }
    &:focus + label:before {
      box-shadow: 0 0 0 2px rgba(58, 165, 124, 0.4);
    }
  }
}

.radio {
  input {
    + label:before,
    + label:after {
      border-radius: 50% !important;
    }
  }
}
.inline-group {
  .radio, .form-check, .checkbox {
    display: flex;
    padding: 0 16px;
    margin-right: 18px;
  }
}


table .form-check label,
table .checkbox label,
table .form-check .radio label {
  &:before,
  &:after {
    margin-left: 0;
  }
}

.submit-group {
  display: flex;
  justify-content: space-between;
  flex-grow: 1;
  flex-wrap: wrap;
  background-color: $gray-100;
  padding: 16px;
  margin-bottom: 16px;

  button {
    align-self: flex-end;

    i.fa {
      padding-right: 8px;
    }
  }
}
.wizard-row {
  display: flex;
  flex-direction: row-reverse;
}
table .action-column {
  display: flex;
  justify-content: flex-end;
  .btn {
    margin-left: 8px;
  }
}
/* fix input group prepend look */
.input-group-text.input-group-prepend, .input-group-text.input-group-append {
  font-size: inherit;
}

.markdown-wrapper {
  max-height: 160px;
  textarea {
    max-height: 160px;
    border-top: none;
    border-top-left-radius: 0;
    border-top-right-radius: 0;
  }
  .preview {
    border: 1px solid #ced4da;
    border-top: none;
    min-height: 160px;
    max-height: 160px;
    padding: 8px;
    overflow-y: auto;
    width: auto;
    background: $white;
  }
}
.markdown-column .form-group {
  flex-direction: column;
}
.markdown-table {
  .form-group {
    flex-direction: column;
  }
  .preview,
  nav {
    display: none;
  }
  textarea {
    border: 1px solid #ced4da;
  }
}
@include media-breakpoint-down(md) {
  .submit-group {
    flex-direction: column;
    button, .btn {
      width: 100%;
      margin-bottom: 8px;
    }
  }
}
