@import '../../style/themes/default';
@import '../../style/mixins/index';
@import '../../input/style/mixin';

@pagination-prefix-cls: ~'@{dt-prefix}-pagination';

.@{pagination-prefix-cls} {
  .reset-component;
  font-size: 12px;

  ul,
  ol {
    margin: 0;
    padding: 0;
    list-style: none;
  }

  &:after {
    content: ' ';
    display: block;
    height: 0;
    clear: both;
    overflow: hidden;
    visibility: hidden;
  }

  &-total-text {
    display: inline-block;
    vertical-align: middle;
    height: @pagination-item-size;
    line-height: @pagination-item-size - 2px;
    margin-right: 8px;
  }

  &-item {
    position: relative;
    cursor: pointer;
    user-select: none;
    min-width: @pagination-item-size;
    height: @pagination-item-size;
    line-height: @pagination-item-size - 2px;
    text-align: center;
    list-style: none;
    display: inline-block;
    vertical-align: middle;
    border: @border-width-base @border-style-base @border-color-base;
    background-color: @component-background;
    // margin-right: 8px;
    margin-left: -1px;
    font-family: @pagination-font-family;
    outline: 0;
    z-index: 1;

    a {
      text-decoration: none;
      color: @text-color;
      transition: none;
      margin: 0 6px;
    }

    &:focus,
    &:hover {
      z-index: 2;
      transition: all 0.3s;
      border-color: @primary-color;
      a {
        color: @primary-color;
      }
    }

    &-active {
      border-color: @primary-color;
      background-color: @primary-color;
      font-weight: 500;
      z-index: 2;

      a {
        // color: @primary-color;
        color: #fff;
      }

      &:focus,
      &:hover {
        // border-color: @primary-5;
      }

      &:focus a,
      &:hover a {
        // color: @primary-5;
        color: #fff;
      }
    }
  }

  &-jump-prev,
  &-jump-next {
    outline: 0;

    &:after {
      content: '•••';
      display: block;
      letter-spacing: 2px;
      color: @disabled-color;
      text-align: center;
    }

    &:focus,
    &:hover {
      &:after {
        color: @primary-color;
        .iconfont-size-under-12px(8px);
        letter-spacing: -1px;
        font-family: 'icon';
      }
    }
  }

  &-jump-prev {
    &:focus,
    &:hover {
      &:after {
        content: '\e633\e633';
      }
    }
    border: @border-width-base @border-style-base @border-color-base;
    margin-left: -1px;
  }

  &-jump-next {
    &:focus,
    &:hover {
      &:after {
        content: '\e63a\e63a';
      }
    }
    border: @border-width-base @border-style-base @border-color-base;
    margin-left: -1px;
  }

  &-prev,
  &-next, {
    border-radius: @border-radius-base;
  }

  &-prev,
  &-next,
  &-jump-prev,
  &-jump-next {
    font-family: @pagination-font-family;
    cursor: pointer;
    color: @text-color;
    list-style: none;
    min-width: @pagination-item-size;
    height: @pagination-item-size;
    line-height: @pagination-item-size;
    text-align: center;
    transition: all 0.3s;
    display: inline-block;
    vertical-align: middle;
  }

  &-prev,
  &-next {
    outline: 0;

    a {
      color: @text-color;
      user-select: none;
    }

    &:hover {
      z-index: 2;
    }

    &:hover a {
      border-color: @primary-5;
    }

    .@{pagination-prefix-cls}-item-link {
      border: @border-width-base @border-style-base @border-color-base;
      background-color: @component-background;
      border-radius: @border-radius-base;
      outline: none;
      display: block;
      transition: all 0.3s;
      text-decoration: none;

      &:after {
        font-size: 12px;
        display: block;
        height: @pagination-item-size - 2px;
        font-family: 'icon';
        text-align: center;
        font-weight: 500;
      }
    }

    &:focus .@{pagination-prefix-cls}-item-link,
    &:hover .@{pagination-prefix-cls}-item-link {
      border-color: @primary-color;
      color: @primary-color;
    }
  }

  &-prev {
    .@{pagination-prefix-cls}-item-link {
      border-radius: @border-radius-sm 0 0 @border-radius-sm;
    }
    .@{pagination-prefix-cls}-item-link:after {
      content: @icon-left;
      display: block;
    }
    position: relative;
    z-index: 1;
  }

  &-next {
    .@{pagination-prefix-cls}-item-link {
      border-radius: 0 @border-radius-sm @border-radius-sm 0;
    }
    .@{pagination-prefix-cls}-item-link:after {
      content: @icon-right;
      display: block;
    }
    position: relative;
    z-index: 1;
    margin-left: -1px;
  }

  &-disabled {
    &,
    &:hover,
    &:focus {
      z-index: 1;
      cursor: not-allowed;
      a,
      .@{pagination-prefix-cls}-item-link {
        border-color: #dcdcdc;
        color: #ccc;
        cursor: not-allowed;
      }
    }
  }

  &-slash {
    margin: 0 10px 0 5px;
  }

  &-options {
    display: inline-block;
    vertical-align: middle;
    .@{dt-prefix}-select-dropdown,
    .@{dt-prefix}-select-dropdown-menu {
      border-radius: @border-radius-sm;
    }

    &-size-changer.@{dt-prefix}-select {
      display: inline-block;
      margin-right: 10px;
      width: 70px;
      .@{dt-prefix}-select-selection--single {
        border-radius: @border-radius-sm;
      }
    }

    &-quick-jumper {
      display: inline-block;
      vertical-align: top;
      height: @input-height-base;
      line-height: @input-height-base;

      input {
        .input;
        margin: 0 8px;
        padding: 1px;
        width: 30px;
        text-align: center;
        border-radius: @border-radius-sm;
      }
    }
  }

  &-simple &-prev,
  &-simple &-next {
    height: @pagination-item-size-sm;
    line-height: @pagination-item-size-sm;
    vertical-align: top;
    .@{pagination-prefix-cls}-item-link {
      border: 0;
      height: @pagination-item-size-sm;
      &:after {
        height: @pagination-item-size-sm;
        line-height: @pagination-item-size-sm;
      }
    }
  }

  &-simple &-simple-pager {
    display: inline-block;
    margin-right: 8px;
    height: @pagination-item-size-sm;

    input {
      margin-right: 8px;
      box-sizing: border-box;
      background-color: @component-background;
      border-radius: @border-radius-sm;
      border: @border-width-base @border-style-base @border-color-base;
      outline: none;
      padding: 0 6px;
      height: 100%;
      text-align: center;
      transition: border-color 0.3s;

      &:hover {
        border-color: @primary-color;
      }
    }
  }

  &.mini &-total-text,
  &.mini &-simple-pager {
    height: @pagination-item-size-sm;
    line-height: @pagination-item-size-sm;
  }

  &.mini &-item {
    margin: 0;
    border: 1px solid #00b4ed;
    margin-left: -1px;
    min-width: @pagination-item-size-sm;
    height: @pagination-item-size-sm;
    line-height: @pagination-item-size-sm - 2px;
  }

  &.mini &-item:not(&-item-active) {
    position: relative;
    z-index: 1;
    background: transparent;
    border: 1px solid #d9d9d9;
    &:hover {
      z-index: 2;
      border-color: #00b4ed;
    }
  }

  &.mini &-prev,
  &.mini &-next {
    margin: 0;
    min-width: @pagination-item-size-sm;
    height: @pagination-item-size-sm;
    line-height: @pagination-item-size-sm;
  }

  &.mini &-prev &-item-link,
  &.mini &-next &-item-link {
    border-color: transparent;
    background: transparent;
    &:after {
      height: 22px;
      line-height: 22px;
    }
    border: 1px solid #dcdcdc;
    margin-left: -1px;
    &:hover {
      border-color: @primary-5;
    }
  }

  &.mini &-jump-prev,
  &.mini &-jump-next {
    height: @pagination-item-size-sm;
    line-height: @pagination-item-size-sm;
    margin-right: 0;
  }

  &.mini &-options {
    margin-left: 2px;
    &-quick-jumper {
      height: @pagination-item-size-sm;
      line-height: @pagination-item-size-sm;

      input {
        .input-sm;
        padding: 1px;
        width: 24px;
        text-align: center;
      }
    }
  }
}

@media only screen and (max-width: @screen-lg) {
  .@{pagination-prefix-cls}-item {
    &-after-jump-prev,
    &-before-jump-next {
      display: none;
    }
  }
}

@media only screen and (max-width: @screen-sm) {
  .@{pagination-prefix-cls}-options {
    display: none;
  }
}
