/**
 * @license
 * Copyright Akveo. All Rights Reserved.
 * Licensed under the MIT License. See License.txt in the project root for license information.
 */

@mixin btn-group-separator($color) {
  background-color: shade($color, 20%);
}

@mixin btn-group-primary-separator() {
  @include btn-group-separator(nga-theme(color-primary));
}

@mixin btn-group-success-separator() {
  @include btn-group-separator(nga-theme(color-success));
}

@mixin btn-group-warning-separator() {
  @include btn-group-separator(nga-theme(color-warning));
}

@mixin btn-group-info-separator() {
  @include btn-group-separator(nga-theme(color-info));
}

@mixin btn-group-danger-separator() {
  @include btn-group-separator(nga-theme(color-danger));
}

@mixin btn-group-secondary-separator() {
  @include btn-group-separator(nga-theme(color-primary));
}

@mixin nga-b-button-group-theme() {

  .btn-toggle-group > .btn {
    position: relative;
  }

  .btn-group-icon {
    font-size: 1.5rem;
    padding: 0 1rem;
  }

  .btn-group-pagination > .btn {
    padding-left: 1.125rem;
    padding-right: 1.125rem;
  }

  .btn-toggle-group {
    .btn:first-child {
      border-right: none;
    }

    .btn:last-child {
      border-left: none;
    }

    .btn:not(:first-child):not(:last-child) {
      border-left: none;
      border-right: none;
    }

    .btn + .btn {
      margin-left: 0;
    }

    .btn:not(:first-child):not(:last-child) {
      &::before,
      &::after {
        content: '';
        position: absolute;
        width: 1px;
        height: 100%;
        top: 0;
      }

      &::before {
        left: 0;
      }

      &::after {
        right: 0;
      }

      &.btn-primary {
        &::before,
        &::after {
          @include btn-group-primary-separator();
        }
      }

      &.btn-success {
        &::before,
        &::after {
          @include btn-group-success-separator();
        }
      }

      &.btn-warning {
        &::before,
        &::after {
          @include btn-group-warning-separator();
        }
      }

      &.btn-info {
        &::before,
        &::after {
          @include btn-group-info-separator();
        }
      }

      &.btn-danger {
        &::before,
        &::after {
          @include btn-group-danger-separator();
        }
      }

      &.btn-secondary {
        &::before,
        &::after {
          @include btn-group-secondary-separator();
        }
      }
    }
  }

  .btn-outline-toggle-group {
  }

  .btn-divided-group {
    .btn:not(:first-child) {
      margin-left: 0.5rem;
      border-radius: nga-theme(btn-border-radius);
    }

    .btn:not(:first-child):not(:last-child):not(.dropdown-toggle) {
      border-radius: nga-theme(btn-border-radius);
    }

    .btn:not(:last-child):not(.dropdown-toggle) {
      border-radius: nga-theme(btn-border-radius);
    }
  }
}
