/**
 *
 * @ai-apps/angular v2.152.0 | _pagination.scss
 *
 * Copyright 2014, 2023 IBM
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0

 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */


//
// Copyright IBM Corp. 2016, 2018
//
// This source code is licensed under the Apache-2.0 license found in the
// LICENSE file in the root directory of this source tree.
//

$css--helpers: true;

@import '../../globals/scss/vars';
@import '../../globals/scss/helper-mixins';
@import '../../globals/scss/typography';
@import '../../globals/scss/layout';
@import '../../globals/scss/css--helpers';
@import '../../globals/scss/vendor/@carbon/layout/scss/generated/size';
@import '../../globals/scss/vendor/@carbon/elements/scss/import-once/import-once';
@import '../select/select';
@import '../text-input/text-input';
@import '../button/button';

/// Pagination styles
/// @access private
/// @group pagination
@mixin pagination {
  .#{$prefix}--data-table-container + .#{$prefix}--pagination {
    border-top: 0;
  }

  .#{$prefix}--pagination {
    @include reset;
    @include type-style('body-short-01');

    display: flex;
    width: calc(100% - 1px);
    min-height: $size-md;
    align-items: center;
    justify-content: space-between;
    border-top: 1px solid $ui-03;
    background-color: $ui-01;
    overflow-x: auto;

    @include carbon--breakpoint('md') {
      overflow: initial;

      .#{$prefix}--pagination__control-buttons {
        display: flex;
      }
    }

    // mobile friendly pagination
    @include carbon--breakpoint-down('md') {
      .#{$prefix}--pagination__left > *,
      .#{$prefix}--pagination__right > * {
        display: none;
      }

      .#{$prefix}--pagination__items-count {
        display: initial;
      }

      .#{$prefix}--pagination__control-buttons {
        display: flex;
      }
    }
  }

  .#{$prefix}--pagination--sm {
    min-height: $size-sm;
  }

  .#{$prefix}--pagination--lg {
    min-height: $size-lg;
  }

  .#{$prefix}--pagination .#{$prefix}--select {
    height: 100%;
    align-items: center;
  }

  .#{$prefix}--pagination .#{$prefix}--select-input--inline__wrapper {
    display: flex;
    height: 100%;
  }

  .#{$prefix}--pagination .#{$prefix}--select-input {
    @include type-style('body-short-01');

    width: auto;
    min-width: auto;
    height: 100%;
    padding: 0 2.25rem 0 $spacing-05;
    background-color: $ui-01;
    line-height: $size-md;
  }

  .#{$prefix}--pagination--sm .#{$prefix}--select-input {
    line-height: $size-sm;
  }

  .#{$prefix}--pagination--lg .#{$prefix}--select-input {
    line-height: $size-lg;
  }

  .#{$prefix}--pagination .#{$prefix}--select-input:hover {
    background: $hover-ui;
  }

  .#{$prefix}--pagination
    .#{$prefix}--select--inline
    .#{$prefix}--select-input:focus,
  .#{$prefix}--pagination
    .#{$prefix}--select--inline
    .#{$prefix}--select-input:focus
    option,
  .#{$prefix}--pagination
    .#{$prefix}--select--inline
    .#{$prefix}--select-input:focus
    optgroup {
    background-color: $layer;
  }

  .#{$prefix}--pagination .#{$prefix}--select__arrow {
    top: 50%;
    transform: translate(-0.5rem, -50%);
  }

  .#{$prefix}--pagination
    .#{$prefix}--select__item-count
    .#{$prefix}--select-input {
    border-right: $spacing-4xs solid $ui-03;
  }

  .#{$prefix}--pagination
    .#{$prefix}--select__page-number
    .#{$prefix}--select-input {
    border-left: 1px solid $ui-03;
  }

  .#{$prefix}--pagination__left,
  .#{$prefix}--pagination__right {
    display: flex;
    height: 100%;
    align-items: center;
  }

  .#{$prefix}--pagination__left > .#{$prefix}--form-item,
  .#{$prefix}--pagination__right > .#{$prefix}--form-item {
    height: 100%;
  }

  .#{$prefix}--pagination__left .#{$prefix}--pagination__text,
  .#{$prefix}--pagination__right .#{$prefix}--pagination__text {
    white-space: nowrap;
  }

  .#{$prefix}--pagination__left .#{$prefix}--pagination__text {
    margin-right: rem(1px);
  }

  .#{$prefix}--pagination__right .#{$prefix}--pagination__text {
    margin-right: 1rem;
    margin-left: rem(1px);
  }

  .#{$prefix}--pagination__left {
    padding: 0 $carbon--spacing-05 0 0;

    @include carbon--breakpoint('md') {
      padding: 0 $carbon--spacing-05;
    }
  }

  .#{$prefix}--pagination__text {
    @include carbon--breakpoint('md') {
      display: inline-block;
    }
  }

  span.#{$prefix}--pagination__text {
    margin-left: $carbon--spacing-05;
    color: $text-02;
  }

  .#{$prefix}--pagination__button,
  .#{$prefix}--btn--ghost.#{$prefix}--pagination__button {
    @include reset;

    display: flex;
    width: $size-md;
    height: $size-md;
    min-height: $size-sm;
    align-items: center;
    justify-content: center;
    border: none;
    border-left: 1px solid $ui-03;
    margin: 0;
    background: none;
    cursor: pointer;
    fill: $ui-05;
    transition: outline $duration--fast-02 motion(standard, productive),
      background-color $duration--fast-02 motion(standard, productive);
  }

  .#{$prefix}--pagination--sm .#{$prefix}--pagination__button,
  .#{$prefix}--pagination--sm
    .#{$prefix}--btn--ghost.#{$prefix}--pagination__button {
    width: $size-sm;
    height: $size-sm;
  }

  .#{$prefix}--pagination--lg .#{$prefix}--pagination__button,
  .#{$prefix}--pagination--lg
    .#{$prefix}--btn--ghost.#{$prefix}--pagination__button {
    width: $size-lg;
    height: $size-lg;
  }

  .#{$prefix}--pagination__button:focus,
  .#{$prefix}--btn--ghost:focus.#{$prefix}--pagination__button {
    @include focus-outline('outline');

    border-left: 0;
  }

  .#{$prefix}--pagination__button:hover,
  .#{$prefix}--btn--ghost:hover.#{$prefix}--pagination__button {
    background: $hover-ui;
  }

  .#{$prefix}--pagination__button--no-index,
  .#{$prefix}--btn--ghost.#{$prefix}--pagination__button--no-index {
    cursor: not-allowed;
    fill: $disabled-02;
  }

  .#{$prefix}--pagination__button:disabled:hover,
  .#{$prefix}--pagination__button--no-index:hover,
  .#{$prefix}--btn--ghost:disabled:hover.#{$prefix}--pagination__button,
  .#{$prefix}--btn--ghost:hover.#{$prefix}--pagination__button--no-index {
    border-color: $ui-03;
    background: $ui-01;
    cursor: not-allowed;
    fill: $disabled-02;
  }

  // Skeleton state
  .#{$prefix}--pagination.#{$prefix}--skeleton .#{$prefix}--skeleton__text {
    margin-right: 1rem;
    margin-bottom: 0;
  }

  // Windows HCM fix
  // stylelint-disable-next-line no-duplicate-selectors
  .#{$prefix}--pagination__button,
  .#{$prefix}--btn--ghost.#{$prefix}--pagination__button {
    @include high-contrast-mode('outline');
  }
}

@include exports('pagination') {
  @include pagination;
}
