@import "mixins/mixins";
@import "mixins/utils";
@import "common/var";
@import "select";

@include b(pagination) {
  white-space: nowrap;
  // padding: 2px 5px;
  color: $--pagination-font-color;
  // font-weight: bold;
  @include utils-clearfix;

  span:not([class*=suffix]),
  button {
    display: inline-block;
    font-size: $--pagination-font-size;
    // min-width: $--pagination-button-width;
    height: $--pagination-button-height;
    line-height: $--pagination-button-height;
    vertical-align: top;
    box-sizing: border-box;
  }

  span:not([class*=suffix]) {
    font-size: 12px;
  }

  .y-input__inner {
    text-align: center;
    -moz-appearance: textfield;
    line-height: normal;
  }

  // pagesize 的下拉 icon
  .y-input__suffix {
    // right: 0;
    transform: scale(.8);
  }

  .y-select .y-input {
    width: 93px;
    margin: 0 4px;

    .y-input__inner {
      padding-right: 25px;
      border-radius: $--pagination-border-radius;
    }
  }

  button {
    width: 24px;
    border: none;
    padding: 0;
    background: transparent;

    &:focus {
      outline: none;
    }

    &:hover {
      background-color: $--color-primary-light-9;
      border: 1px solid $--color-primary;
      border-radius: 100px;
      color: $--pagination-hover-color;
    }

    &:active {
      outline: none;
      color: $--color-primary-dark;
      border: 1px solid $--color-primary-dark;
      border-radius: 100px;
      background-color: $--color-primary-light-8;
    }

    &:disabled {
      // color: $--pagination-button-disabled-color;
      opacity: .5;
      color: #768893;
      border: none;
      border-radius: 0;
      background-color: $--pagination-button-disabled-background-color;
      cursor: not-allowed;
    }
  }

  .btn-prev,
  .btn-next {
    background: center center no-repeat;
    background-size: 16px;
    background-color: $--pagination-background-color;
    cursor: pointer;
    margin: 0;
    color: $--pagination-button-color;

    .y-icon {
      display: block;
      font-size: 12px;
      // font-weight: bold;
    }
  }

  .btn-prev {
    // padding-right: 12px;
  }

  .btn-next {
    // padding-left: 12px;    
  }

  .y-pager li.disabled {
    color: $--color-text-placeholder;
    cursor: not-allowed;
  }

  // @include m(small) {
  //   .btn-prev,
  //   .btn-next,
  //   .y-pager li,
  //   .y-pager li.btn-quicknext,
  //   .y-pager li.btn-quickprev,
  //   .y-pager li:last-child {
  //     border-color: transparent;
  //     font-size: 12px;
  //     line-height: 22px;
  //     height: 22px;
  //     min-width: 22px;
  //   }

  //   .arrow.disabled {
  //     visibility: hidden;
  //   }

  //   .more::before,
  //   li.more::before {
  //     line-height: 24px;
  //   }

  //   span:not([class*=suffix]),
  //   button {
  //     height: 22px;
  //     line-height: 22px;
  //   }

  //   @include e(editor) {
  //     height: 22px;
  //     &.y-input .y-input__inner {
  //       height: 22px;
  //     }
  //   }
  // }

  @include e(sizes) {
    margin: 0 12px 0 0;
    font-weight: normal;
    color: $--color-text-regular;

    .y-input .y-input__inner {
      font-size: $--pagination-font-size;
      padding-left: 8px;

      &:hover {
        border-color: $--pagination-hover-color;
      }
    }
  }

  @include e(total) {
    margin-right: 16px;
    font-weight: normal;
    color: $--nc5;
  }

  @include e(jump) {
    margin-left: 20px;
    font-weight: normal;
    color: $--color-text-regular;

    .y-input__inner {
      padding: 0 3px;
    }
  }

  @include e(rightwrapper) {
    float: right;
  }

  @include e(editor) {
    line-height: 32px;
    // padding: 0 2px;
    height: 32px;
    text-align: center;
    margin: 0 8px;
    box-sizing: border-box;
    // border-radius: $--pagination-border-radius;

    &.y-input {
      width: 46px;
    }

    // &.y-input .y-input__inner {
    //   height: $--pagination-button-height;
    // }

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

  @include when(border) {
    span:not([class*=suffix]),
    button {
      display: inline-block;
      font-size: 13px;
      height: 32px;
      line-height: 32px;
    }
    .btn-prev,
    .btn-next,
    .y-pager li {
      margin: 0 4px;
      padding: 0;
      // background-color: $--color-info-lighter;
      font-size: $--font-size-small;
      color: $--color-text-regular;
      // min-width: 30px;
      box-sizing: border-box;
      width: 32px;
      height: 32px;
      // line-height: 32px;
      text-align: center;
      border-radius: 4px;
      border: 1px solid $--nc8;
      display: inline-flex;
      justify-content: center;
      align-items: center;

      &.disabled {
        // color: $--color-text-placeholder;
        opacity: .5;
      }
    }

    .btn-prev, .btn-next {
      color: $--pagination-button-color;
      // padding: 0;

      // &:disabled {
      //   color: $--color-text-placeholder;
      // }
      &:hover {
        color: $--color-primary;
        border-color: $--color-primary;
        background-color: $--color-primary-light-9;
      }

      &:active {
        background-color: $--color-primary-light-8;
        color: $--color-primary-dark;
        border-color: $--color-primary-dark;
      }

      &:disabled {
        color: $--color-text-regular;
        border-color: $--nc8;
        background-color: transparent;
      }
    }

    .y-pager li:not(.disabled) {
      &:hover {
        color: $--color-primary;
      }

      &.active { // 选中状态
        color: $--color-primary;
        border-color: $--color-primary;
        background-color: $--color-primary-light-9;
      }

      // &:active { // 点击状态
      //   background-color: $--color-primary-light-8;
      //   color: $--color-primary-dark;
      //   border-color: $--color-primary-dark;
      // }

      // &.btn-quicknext,
      // &.btn-quickprev {
      //   color: $--nc1;
      // }
    }

    // &.y-pagination--small {
    //   .btn-prev,
    //   .btn-next,
    //   .y-pager li {
    //     margin: 0 3px;
    //     min-width: 22px;
    //   }
    // }
  }
}

@include b(pager) {
  user-select: none;
  list-style: none;
  display: inline-block;
  vertical-align: top;
  font-size: 0;
  padding: 0;
  margin: 0;

  .more::before {
    line-height: 24px;
    vertical-align: middle;
  }

  li {
    padding: 0 12px;
    background: $--pagination-background-color;
    vertical-align: top;
    display: inline-block;
    font-size: 14px;
    // min-width: $--pagination-button-width;
    // width: 24px;
    height: $--pagination-button-height;
    line-height: $--pagination-button-height;
    cursor: pointer;
    box-sizing: border-box;
    text-align: center;
    margin: 0;

    &.btn-quicknext,
    &.btn-quickprev {
      line-height: 24px;
      color: $--nc1;
      // cursor: default;

      &.disabled {
        color: $--color-text-placeholder;
      }
    }

    &.btn-quickprev:hover {
      // color: $--nc1;
      // cursor: pointer;
    }

    &.btn-quicknext:hover {
      // color: $--nc1;
      // cursor: pointer;
    }

    &.active + li {
      border-left: 0;
    }

    &:hover {
      color: $--pagination-hover-color;
    }

    &.active {
      color: $--pagination-hover-color;
      cursor: default;
    }
  }

  &-mini {
    // min-width: $--pagination-button-width;
    font-size: 14px !important;
    padding: 0 8px;
    text-align: center;
  }
}
