// Accordion Mixins
//================================================== //

// Stylelint is disabled here because no matter
// how the mixins are structured they don't pass
/* stylelint-disable */
@mixin reset-padding-start-rule($size, $reset-padding: 'false', $reset-size: 0) {
  @if $reset-padding == 'true' { padding-inline-start: $reset-size; }
  @else { padding-inline-start: $size; }
}

@mixin reset-padding-end-rule($size, $reset-padding: 'false', $reset-size: 0) {
  @if $reset-padding == 'true' { padding-inline-end: $reset-size; }
  @else { padding-inline-end: $size; }
}
/* stylelint-enable */

// Left-to-Right
//================================================== //

@mixin left-align-cascade-styles-header($a-padding, $icon-margin, $width, $li-padding, $reset-padding: 'true', $reset-size: 0) {
  > a {
    padding-inline-start: $a-padding;
  }

  > .icon,
  > [class^='btn'] {
    margin-inline-start: $icon-margin;

    + a {
      @include reset-padding-start-rule($li-padding, $reset-padding, $reset-size);

      width: calc(100% - #{$width});
    }
  }

  &.list-item {
    &::before {
      @include reset-padding-start-rule($li-padding);
    }

    a {
      @include reset-padding-start-rule($li-padding, $reset-padding, $reset-size);

      width: calc(100% - #{$width});
    }
  }
}

@mixin left-align-cascade-styles-pane($leftPadding, $iconLinkPadding, $iconContentPadding) {
  .accordion-content {
    padding-inline-start: $leftPadding;
  }

  &.has-icons {
    .accordion-header.no-icon > a {
      padding-inline-start: $iconLinkPadding;
    }

    .accordion-content {
      padding-inline-start: $iconContentPadding;
    }
  }
}

// Right-To-Left
//================================================== //

@mixin right-align-cascade-styles-header($a-padding, $icon-margin, $width, $li-padding, $reset-padding: 'true', $reset-size: 0) {
  > .icon,
  > [class^='btn'] {
    margin-inline-start: auto;

    + a {
      @include reset-padding-start-rule($li-padding, $reset-padding, $reset-size);

      width: calc(100% - #{$width});
    }
  }

  &.list-item {
    &::before {
      padding-inline-start: 0;

      @include reset-padding-start-rule($li-padding);
    }

    a {
      @include reset-padding-start-rule($li-padding, $reset-padding, $reset-size);

      width: calc(100% - #{$width});
    }
  }
}

@mixin right-align-cascade-styles-pane($rightPadding, $iconLinkPadding, $iconContentPadding,$leftPadding: 0) {
  .accordion-content {
    padding-inline-start: $rightPadding;
    padding-inline-end: 0;
  }

  &.has-icons {
    .accordion-header.no-icon > a {
      padding-inline-start: $iconLinkPadding;
      padding-inline-end: $leftPadding;
    }

    .accordion-content {
      padding-inline-start: $iconContentPadding;
      padding-inline-end: 0;
    }
  }
}
