@use 'sass:map';

@use 'mixins/mixins' as *;
@use 'mixins/utils' as *;
@use 'mixins/var' as *;
@use 'common/var' as *;

@mixin remove-margin {
  & + button.btn-prev[type='button'] {
    margin-left: 0;
  }

  & + .#{$namespace}-pager {
    .number {
      &:first-child {
        margin-left: 0;
      }
      &:last-child {
        margin-right: 0;
      }
    }
  }
}

@mixin pagination-button {
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 12px;
  line-height: 16px;
}

@include b(pagination) {
  // @include set-component-css-var('pagination', $pagination);

  white-space: nowrap;
  display: flex;
  align-items: center;

  // span:not([class*='suffix']),
  button {
    @include pagination-button;
  }

  .#{$namespace}-select .#{$namespace}-input {
    width: 68px;
  }

  @include e(sizes) {
    color: getCssVar('color', 'neutral-9');
    @include remove-margin();
  }

  @include e(total) {
    margin-left: 4px;
    margin-right: 16px;
    font-weight: 600;
    font-size: 12px;
    line-height: 16px;
    color: getCssVar('color', 'neutral-9');
    @include remove-margin();

    &[disabled='true'] {
      color: getCssVar('color', 'neutral-5');
    }
  }

  @include e(jump) {
    margin-left: 16px;
    display: inline-flex;
    align-items: center;

    > span {
      font-weight: 600;
      font-size: 12px;
      color: getCssVar('color', 'neutral-9');
    }

    &[disabled='true'] {
      color: getCssVar('color', 'neutral-5');
    }

    .#{$namespace}-input__inner {
      text-align: center;
    }
  }

  @include e(rightwrapper) {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: flex-end;
  }

  @include e(editor) {
    line-height: 18px;
    margin: 0 0 0 4px;
    min-width: 56px;

    text-align: center;
    box-sizing: border-box;
    border-radius: getCssVar('border-radius-sm');

    .#{$namespace}-input__inner::-webkit-inner-spin-button,
    .#{$namespace}-input__inner::-webkit-outer-spin-button {
      -webkit-appearance: none;
      margin: 0;
    }
  }

  // @include when(background) {
  //   .btn-prev,
  //   .btn-next,
  //   .#{$namespace}-pager li {
  //     margin: 0 4px;
  //     background-color: getCssVar('pagination-button-bg-color');
  //     color: getCssVar('text-color', 'main');
  //     min-width: 32px;
  //     border-radius: 2px;

  //     &.is-disabled {
  //       color: getCssVar('text-color', 'placeholder');
  //       background-color: getCssVar('disabled-bg-color');
  //     }
  //     @include when(first) {
  //       margin-left: 0;
  //     }
  //     @include when(last) {
  //       margin-right: 0;
  //     }
  //   }

  //   .btn-prev,
  //   .btn-next {
  //     padding: 0;

  //     &:disabled {
  //       color: getCssVar('text-color', 'placeholder');
  //       background-color: getCssVar('disabled-bg-color');
  //     }
  //     &:hover:not([disabled]) {
  //       color: getCssVar('pagination-hover-color');
  //     }
  //   }

  //   .#{$namespace}-pager li:not(.is-disabled) {
  //     &:hover {
  //       color: getCssVar('pagination-hover-color');
  //     }

  //     &.is-active {
  //       background-color: getCssVar('color-primary');
  //       color: getCssVar('color-white');
  //       font-weight: bold;
  //     }
  //   }

  //   &.#{$namespace}-pagination--small {
  //     .btn-prev,
  //     .btn-next,
  //     .#{$namespace}-pager li {
  //       min-width: 24px;
  //     }
  //   }

  //   @include e(sizes) {
  //     @include when(last) {
  //       margin-left: 16px;
  //     }
  //   }
  // }
}

@include b(pager) {
  display: flex;

  .#{$namespace}-button {
    margin: 0 1px;
    min-width: 32px;
  }
}
