.input-group {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  width: 100%;

  > {
    .form-control, .form-control-plaintext, .custom-select, .custom-file {
      position: relative;
      flex: 1 1 auto;
      width: 1%;
      margin-block-end: 0;
    }

    .form-control + {
      .form-control, .custom-select, .custom-file {
        margin-inline-start: -1px;
      }
    }

    .form-control-plaintext + {
      .form-control, .custom-select, .custom-file {
        margin-inline-start: -1px;
      }
    }

    .custom-select + {
      .form-control, .custom-select, .custom-file {
        margin-inline-start: -1px;
      }
    }

    .custom-file + {
      .form-control, .custom-select, .custom-file {
        margin-inline-start: -1px;
      }
    }

    .form-control:focus, .custom-select:focus {
      z-index: 3;
    }

    .custom-file .custom-file-input:focus {
      ~ .custom-file-label {
        z-index: 3;
      }

      z-index: 4;
    }

    .form-control:not(:last-child), .custom-select:not(:last-child) {
      border-start-end-radius: 0;
      border-end-end-radius: 0;
    }

    .form-control:not(:first-child), .custom-select:not(:first-child) {
      border-start-start-radius: 0;
      border-end-start-radius: 0;
    }

    .custom-file {
      display: flex;
      align-items: center;

      &:not(:last-child) .custom-file-label {
        border-start-end-radius: 0;
        border-end-end-radius: 0;

        &::after {
          border-start-end-radius: 0;
          border-end-end-radius: 0;
        }
      }

      &:not(:first-child) .custom-file-label {
        border-start-start-radius: 0;
        border-end-start-radius: 0;
      }
    }
  }
}

.input-group-prepend, .input-group-append {
  display: flex;
}

.input-group-prepend {
  .btn, .sp-container button {
    position: relative;
    z-index: 0;
  }
}

.sp-container .input-group-prepend button {
  position: relative;
  z-index: 2;
}

.input-group-append {
  .btn, .sp-container button {
    position: relative;
    z-index: 0;
  }
}

.sp-container .input-group-append button {
  position: relative;
  z-index: 2;
}

.input-group-prepend {
  .btn:focus, .sp-container button:focus {
    z-index: 3;
  }
}

.sp-container .input-group-prepend button:focus {
  z-index: 3;
}

.input-group-append {
  .btn:focus, .sp-container button:focus {
    z-index: 3;
  }
}

.sp-container .input-group-append button:focus {
  z-index: 3;
}

.input-group-prepend {
  .btn + .btn, .sp-container button + .btn {
    margin-inline-start: -1px;
  }
}

.sp-container .input-group-prepend button + .btn, .input-group-prepend .sp-container .btn + button, .sp-container .input-group-prepend .btn + button, .input-group-prepend .sp-container button + button, .sp-container .input-group-prepend button + button {
  margin-inline-start: -1px;
}

.input-group-prepend {
  .btn + .input-group-text, .sp-container button + .input-group-text {
    margin-inline-start: -1px;
  }
}

.sp-container .input-group-prepend button + .input-group-text {
  margin-inline-start: -1px;
}

.input-group-prepend {
  .input-group-text + {
    .input-group-text, .btn {
      margin-inline-start: -1px;
    }
  }

  .sp-container .input-group-text + button {
    margin-inline-start: -1px;
  }
}

.sp-container .input-group-prepend .input-group-text + button {
  margin-inline-start: -1px;
}

.input-group-append {
  .btn + .btn, .sp-container button + .btn {
    margin-inline-start: -1px;
  }
}

.sp-container .input-group-append button + .btn, .input-group-append .sp-container .btn + button, .sp-container .input-group-append .btn + button, .input-group-append .sp-container button + button, .sp-container .input-group-append button + button {
  margin-inline-start: -1px;
}

.input-group-append {
  .btn + .input-group-text, .sp-container button + .input-group-text {
    margin-inline-start: -1px;
  }
}

.sp-container .input-group-append button + .input-group-text {
  margin-inline-start: -1px;
}

.input-group-append {
  .input-group-text + {
    .input-group-text, .btn {
      margin-inline-start: -1px;
    }
  }

  .sp-container .input-group-text + button {
    margin-inline-start: -1px;
  }
}

.sp-container .input-group-append .input-group-text + button {
  margin-inline-start: -1px;
}

.input-group-prepend {
  margin-inline-end: -1px;
}

.input-group-append {
  margin-inline-start: -1px;
}

.input-group-text {
  display: flex;
  align-items: center;
  padding: 0.375rem 0.75rem;
  margin-block-end: 0;
  font-size: 0.875rem;
  font-weight: 400;
  line-height: 0;
  color: #{$gray-700};
  text-align: center;
  white-space: nowrap;
  background-color: #{$black-03};
  border: 1px solid #{$border};
  border-radius: 3px;

  input {
    &[type="radio"], &[type="checkbox"] {
      margin-block-start: 0;
    }
  }
}

.input-group-lg > {
  .form-control:not(textarea), .custom-select {
    height: calc(1.5em + 1rem + 2px);
  }

  .form-control, .custom-select, .input-group-prepend > .input-group-text, .input-group-append > .input-group-text, .input-group-prepend > .btn {
    padding: 0.5rem 1rem;
    font-size: 1.09375rem;
    line-height: 1.5;
    border-radius: 0.3rem;
  }
}

.sp-container .input-group-lg > .input-group-prepend > button, .input-group-lg > .input-group-append > .btn, .sp-container .input-group-lg > .input-group-append > button {
  padding: 0.5rem 1rem;
  font-size: 1.09375rem;
  line-height: 1.5;
  border-radius: 0.3rem;
}

.input-group-sm > {
  .form-control:not(textarea), .custom-select {
    height: calc(1.5em + 0.5rem + 2px);
  }

  .form-control, .custom-select, .input-group-prepend > .input-group-text, .input-group-append > .input-group-text, .input-group-prepend > .btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.76562rem;
    line-height: 1.5;
    border-radius: 0.2rem;
  }
}

.sp-container .input-group-sm > .input-group-prepend > button, .input-group-sm > .input-group-append > .btn, .sp-container .input-group-sm > .input-group-append > button {
  padding: 0.25rem 0.5rem;
  font-size: 0.76562rem;
  line-height: 1.5;
  border-radius: 0.2rem;
}

.input-group-lg > .custom-select, .input-group-sm > .custom-select {
  padding-inline-end: 1.75rem;
}

.input-group > .input-group-prepend > .btn, .sp-container .input-group > .input-group-prepend > button {
  border-start-end-radius: 0;
  border-end-end-radius: 0;
}

.input-group > {
  .input-group-prepend > .input-group-text, .input-group-append:not(:last-child) > .btn {
    border-start-end-radius: 0;
    border-end-end-radius: 0;
	 border-start-start-radius: 5px;
    border-end-start-radius: 5px;
  }
}

.input-group > {
  .input-group-append > .input-group-text, .input-group-prepend:not(:first-child) > .btn {
    border-start-start-radius: 0px;
    border-end-start-radius:0px;
  }
}
.sp-container .input-group > .input-group-append:not(:last-child) > button {
  border-start-end-radius: 0;
  border-end-end-radius: 0;
}

.input-group > .input-group-append {
  &:not(:last-child) > .input-group-text, &:last-child > .btn:not(:last-child):not(.dropdown-toggle) {
    border-start-end-radius: 0;
    border-end-end-radius: 0;
  }
}

.sp-container .input-group > .input-group-append:last-child > button:not(:last-child):not(.dropdown-toggle) {
  border-start-end-radius: 0;
  border-end-end-radius: 0;
}

.input-group > .input-group-append {
  &:last-child > .input-group-text:not(:last-child) {
    border-start-end-radius: 0;
    border-end-end-radius: 0;
  }

  > .btn {
    border-start-start-radius: 0;
    border-end-start-radius: 0;
  }
}

.sp-container .input-group > .input-group-append > button {
  border-start-start-radius: 0;
  border-end-start-radius: 0;
}


.sp-container .input-group > .input-group-prepend:not(:first-child) > button {
  border-start-start-radius: 0;
  border-end-start-radius: 0;
}

.input-group > .input-group-prepend {
  &:not(:first-child) > .input-group-text, &:first-child > .btn:not(:first-child) {
    border-start-start-radius: 0;
    border-end-start-radius: 0;
  }
}

.sp-container .input-group > .input-group-prepend:first-child > button:not(:first-child), .input-group > .input-group-prepend:first-child > .input-group-text:not(:first-child) {
  border-start-start-radius: 0;
  border-end-start-radius: 0;
}

/* ###### 3.8 Input Group ###### */

.input-group-prepend, .input-group-append {
  border-radius: 0;
}

.input-group-text {
  padding-block-start: 0;
  padding-block-end: 0;
  align-items: center;
  border-radius: 0;
  border-radius:5px;
}
.input-group > .input-group-append > .input-group-text, .input-group > .input-group-prepend:not(:first-child) > .btn{
    border-start-end-radius: 5px !important ;
    border-end-end-radius: 5px !important;
}
.input-group .btn {
  z-index: 0;
}