/**
* Copyright (c) 2022 - present TinyVue Authors.
* Copyright (c) 2022 - present Huawei Cloud Computing Technologies Co., Ltd.
*
* Use of this source code is governed by an MIT-style license.
*
* THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL,
* BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR
* A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS.
*
*/

@import '../custom.less';

@grid-toolbar-prefix-cls: ~'@{css-prefix}grid-toolbar';
@grid-tools-prefix-cls: ~'@{css-prefix}grid-tools';
@grid-fullscreen-prefix-cls: ~'@{css-prefix}grid-fullscreen';
@grid-refresh-prefix-cls: ~'@{css-prefix}grid-refresh';
@grid-custom-prefix-cls: ~'@{css-prefix}grid-custom';
@grid-checkbox-prefix-cls: ~'@{css-prefix}grid-checkbox';
@grid-select-toolbar-prefix-cls: ~'@{css-prefix}grid__select-toolbar';

// toolbar
.@{grid-toolbar-prefix-cls} {
  padding: 12px 0;

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

  svg {
    fill: var(--ti-grid-primary-color);
    font-size: var(--ti-common-font-size-1);
  }

  &.is__loading {
    position: relative;

    &:before {
      content: '';
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      z-index: 1;
      background-color: var(--ti-grid-loading-background-color);
    }
  }

  &.size__small,
  &.size__mini {
    padding: 8px 0;
  }

  &.size__medium {
    .@{grid-refresh-prefix-cls}__btn,
    .@{grid-custom-prefix-cls}__setting-btn {
      font-size: 17px;
    }
  }

  &.size__small {
    .@{grid-refresh-prefix-cls}__btn,
    .@{grid-custom-prefix-cls}__setting-btn {
      font-size: 15px;
    }
  }

  &.size__mini {
    .@{grid-refresh-prefix-cls}__btn,
    .@{grid-custom-prefix-cls}__setting-btn {
      font-size: var(--ti-common-font-size-1);
    }
  }

  .@{grid-tools-prefix-cls}__wrapper,
  .@{grid-fullscreen-prefix-cls}__wrapper,
  .@{grid-refresh-prefix-cls}__wrapper,
  .@{grid-custom-prefix-cls}__wrapper {
    float: right;
    width: var(--ti-grid-toolbar-btn-width);
    height: var(--ti-grid-toolbar-btn-height);
    line-height: var(--ti-grid-toolbar-btn-height);
    border: solid 1px var(--ti-grid-toolbar-btn-border-color);
    border-radius: var(--ti-grid-toolbar-btn-border-radius);
    text-align: center;
    margin: 0 4px;
    display: flex;
    align-items: center;
    justify-content: center;

    &:hover {
      border-color: var(--ti-grid-primary-color);
    }
  }

  .@{grid-custom-prefix-cls}__wrapper {
    position: relative;

    &.is__active {
      .@{grid-custom-prefix-cls}__setting-btn {
        border-color: var(--ti-grid-primary-color);
      }

      .@{grid-custom-prefix-cls}__option-wrapper {
        display: block;
      }
    }
  }

  .@{grid-refresh-prefix-cls}__btn,
  .@{grid-fullscreen-prefix-cls}__btn,
  .@{grid-custom-prefix-cls}__setting-btn {
    font-size: var(--ti-common-font-size-2);
    vertical-align: middle;
    width: 100%;
    cursor: pointer;
    user-select: none;

    & > i {
      display: block;
      color: var(--ti-grid-primary-color);
      line-height: 28px;
    }
  }

  .@{grid-custom-prefix-cls}__option-wrapper {
    display: none;
    position: absolute;
    right: 0;
    text-align: left;
    background-color: var(--ti-grid-light-color);
    z-index: 19;
    max-height: 210px;
    overflow: auto;
    box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.2);

    .@{grid-custom-prefix-cls}__option {
      padding: 5px 5px;
      border: 1px solid var(--ti-grid-border-color);
      border-radius: 2px;
      font-weight: 700;
      font-size: var(--ti-common-font-size-1);

      > .@{grid-checkbox-prefix-cls} {
        display: block;
        padding: 5px;
        margin: 0;
        max-width: 180px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
      }
    }
  }
}

.@{grid-select-toolbar-prefix-cls} {
  position: absolute;
  background-color: var(--ti-common-color-light);

  .@{grid-toolbar-prefix-cls} {
    padding: 2px 0px 2px 6px;
  }
}
