
@import "~bootstrap/scss/custom-forms";
@import "~bootstrap/scss/forms";

.form-control-sm {
  font-size: $input-btn-font-size-sm;
}

.form-control-lg {
  font-size: $input-btn-font-size-lg;
}

//Hide number spin button
input[type=number] {
  &.form-control {
    -moz-appearance: textfield;
    &::-webkit-inner-spin-button,
    &::-webkit-outer-spin-button {
      -moz-appearance: textfield;
      -webkit-appearance: none;
      margin: 0;
    }
  }
}

%form-row,
.form-row {
  @extend %form-row;

   label{
     @extend %font-size-sm,
             %font-weight-bold;
     &:not(.custom-control) {
      @extend %d-flex,
              %align-items-center,
              %text-info,
              %text-capitalize,
              %mb-1;
     }
    .icon-container {
      @extend %icon-md,
              %ml-1;
    }
  }

  .form-row-header {
    @extend %d-flex,
            %align-items-center,
            %justify-content-between;

    .icon-container {
      @extend %icon-md,
              %mr-2,
              .is-clickable;
    }
  }
}
%form-control-textarea,
.form-control-textarea {
  @extend .h-auto,
          %overflow-auto;
  &.disabled {
    background-color: $input-disabled-bg;
  }
}


// Form row helper link
%help-link,
.help-link {
  @extend %ml-auto;
  font-size: $font-size-sm;

  a {
    @extend %text-info;
    text-decoration: none;
  }
}
%form-control-clickable,
.form-control-clickable {
  @extend %cursor-pointer;

  @include x-hover-focus-active {
    background-color: $input-focus-bg;
  };
}

%info-group-icon,
.info-group-icon {
  @extend %d-flex,
          %align-items-center;

  & > *:first-child {
    @extend %mr-1;
  }

  .icon {
    fill: theme-color("secondary");
  }

  .info-text {
    @extend %font-size-sm,
            %text-secondary;
  }
}

.details-info {
  strong {
    @extend %font-size-sm,
            %text-grey;
    &:after {
      content: ': ';
    }
  }
}

%form-wrapper,
.form-wrapper {
  @extend %pt-3,
          %pb-2,
          %px-4,
          %bg-light-transparent;

  position: relative;
}

%grid-wrapper,
.grid-wrapper {
  @extend %mx-4,
          %pt-3,
          %pb-2,
          %flex-column;

  &.row {
    flex-wrap: nowrap;
  }
}

%controls-slim,
.controls-slim {
  @extend %d-flex,
          %justify-content-center,
          %align-items-center,
          .w-100,
          %bg-light;

  & > * {
    @extend %d-flex,
            %justify-content-center,
            %align-items-center;
  }

  height: 1em;

  &:last-child {
    position: absolute;
    bottom: 0;
  }
}

%form-inline,
.form-inline {
  @extend %d-flex,
          %flex-wrap;
  white-space: nowrap;

  .custom-checkbox {
    @extend %mb-0;
  }
}



// Checkboxes
//
// Tweak just a few things for checkboxes.

.custom-checkbox {
  .custom-control-label::before {
    @include border-radius($custom-checkbox-indicator-border-radius);
  }

  .custom-control-input:checked ~ .custom-control-label {
    &::after {
      background-image: escape-svg($custom-checkbox-indicator-icon-checked);
    }
  }

  .custom-control-input:indeterminate ~ .custom-control-label {
    &::before {
      border-color: $custom-checkbox-indicator-indeterminate-border-color;
      @include gradient-bg($custom-checkbox-indicator-indeterminate-bg);
      @include box-shadow($custom-checkbox-indicator-indeterminate-box-shadow);
    }
    &::after {
      background-image: escape-svg($custom-checkbox-indicator-icon-indeterminate);
    }
  }

  .custom-control-input:disabled {
    &:checked ~ .custom-control-label::before {
      @include gradient-bg($custom-control-indicator-checked-disabled-bg);
    }
    &:indeterminate ~ .custom-control-label::before {
      @include gradient-bg($custom-control-indicator-checked-disabled-bg);
    }
  }
}

// Radios
//
// Tweak just a few things for radios.

.custom-radio {
  .custom-control-label::before {
    // stylelint-disable-next-line property-disallowed-list
    border-radius: $custom-radio-indicator-border-radius;
  }

  .custom-control-input:checked ~ .custom-control-label {
    &::after {
      background-image: escape-svg($custom-radio-indicator-icon-checked);
    }
  }

  .custom-control-input:disabled {
    &:checked ~ .custom-control-label::before {
      @include gradient-bg($custom-control-indicator-checked-disabled-bg);
    }
  }
}
