@if $RTL-template == true {

  //
  // Base styles
  //

  .input-group {

    > .form-control,
    > .form-control-plaintext,
    > .custom-select,
    > .custom-file {
      + .form-control,
      + .custom-select,
      + .custom-file {
        margin-right: -$input-border-width;
        margin-left: 0;
      }
    }

    > .form-control,
    > .custom-select {
      &:not(:last-child) { @include border-left-radius(0); }
      &:not(:first-child) { @include border-right-radius(0); }
    }

    // Custom file inputs have more complex markup, thus requiring different
    // border-radius overrides.
    > .custom-file {
      &:not(:last-child) .custom-file-label,
      &:not(:last-child) .custom-file-label::after { @include border-left-radius(0); }
      &:not(:first-child) .custom-file-label { @include border-right-radius(0); }
    }
  }


  // Prepend and append
  //
  // While it requires one extra layer of HTML for each, dedicated prepend and
  // append elements allow us to 1) be less clever, 2) simplify our selectors, and
  // 3) support HTML5 form validation.

  .input-group-prepend,
  .input-group-append {
    .btn + .btn,
    .btn + .input-group-text,
    .input-group-text + .input-group-text,
    .input-group-text + .btn {
      margin-right: -$input-border-width;
      margin-left: 0;
    }
  }

  .input-group-prepend { margin-left: -$input-border-width; margin-right: 0; }
  .input-group-append { margin-right: -$input-border-width; margin-left: 0; }



  // Sizing
  //
  // Remix the default form control sizing classes into new ones for easier
  // manipulation.

  .input-group-lg > .custom-select,
  .input-group-sm > .custom-select {
    padding-left: $custom-select-padding-x + $custom-select-indicator-padding;
    padding-right: 0;
  }


  // Prepend and append rounded corners
  //
  // These rulesets must come after the sizing ones to properly override sm and lg
  // border-radius values when extending. They're more specific than we'd like
  // with the `.input-group >` part, but without it, we cannot override the sizing.


  .input-group > .input-group-prepend > .btn,
  .input-group > .input-group-prepend > .input-group-text,
  .input-group > .input-group-append:not(:last-child) > .btn,
  .input-group > .input-group-append:not(:last-child) > .input-group-text,
  .input-group > .input-group-append:last-child > .btn:not(:last-child):not(.dropdown-toggle),
  .input-group > .input-group-append:last-child > .input-group-text:not(:last-child) {
    @include border-left-radius(0);
  }

  .input-group > .input-group-append > .btn,
  .input-group > .input-group-append > .input-group-text,
  .input-group > .input-group-prepend:not(:first-child) > .btn,
  .input-group > .input-group-prepend:not(:first-child) > .input-group-text,
  .input-group > .input-group-prepend:first-child > .btn:not(:first-child),
  .input-group > .input-group-prepend:first-child > .input-group-text:not(:first-child) {
    @include border-right-radius(0);
  }
}