/**Variable**/
@import './base/checked.scss';

/*toolbar*/
.s-toolbar {
  display: flex;
  flex-direction: row;
  align-items: center;
  color: $s-font-color;
  font-family: $s-font-family;
  &:after {
    content: "";
    display: block;
    clear: both;
    height: 0;
    overflow: hidden;
    visibility: hidden;
  }
  &.is--perfect {
    border: 1px solid $s-table-border-color;
    border-bottom-width: 0;
    background-color: $s-table-header-background-color;
  }
  &.is--loading {
    position: relative;
    &:before {
      content: "";
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      z-index: $s-loading-z-index;
      user-select: none;
      background-color: $s-loading-background-color;
    }
  }
  .s-button--wrapper {
    flex-grow: 1;
    text-align: left;
    & > .s-button+.s-button--item,
    & > .s-button--item+.s-button,
    & > .s-button--item+.s-button--item {
      margin-left: 0.8em;
    }
    & > .s-button--item {
      display: inline-block;
    }
  }
  .s-tools--wrapper {
    & > .s-button {
      display: flex;
      align-items: center;
    }
  }
  .s-tools--wrapper,
  .s-tools--operate {
    display: flex;
    flex-shrink: 0;
    align-items: center;
  }
  .s-custom--wrapper {
    position: relative;
    &.is--active {
      .s-tools--operate-custom-btn {
        background-color: #D9DADB;
        border-radius: 50%;
      }
      .s-custom--option-wrapper {
        display: block;
      }
    }
  }
  .s-tools--operate-btn {
    padding: 8px;
    text-align: center;
    user-select: none;
    cursor: pointer;
    &:hover {
      background-color: #F0F0F0;
      border-radius: 50%;
      .s-icon--zoomin {
        background-color: #F0F0F0;
      }
    }
    & > i {
      display: block;
    }
  }
  .s-custom--option-wrapper {
    display: none;
    position: absolute;
    right: 2px;
    text-align: left;
    background-color: #fff;
    z-index: 19;
    border: 1px solid $s-table-border-color;
    border-radius: 2px;
    box-shadow: 0 1px 6px rgba(0,0,0,.2);
    .s-custom--header {
      font-weight: 700;
      border-bottom: 1px solid $s-table-popup-border-color;
    }
    .s-custom--body {
      .s-custom--option {
        &:hover {
          background-color: $s-table-row-hover-background-color;
        }
      }
    }
    .s-custom--header,
    .s-custom--body {
      padding: 0.2em 0;
      max-height: 17.6em;
      & > li {
        max-width: 12.85em;
        min-width: 10em;
        padding: 0.2em 1em 0.2em 2.3em;
      }
    }
    .s-custom--footer {
      border-top: 1px solid $s-table-popup-border-color;
      padding: 0.45em 0.4em;
      text-align: right;
      button {
        background-color: transparent;
        width: 50%;
        border: 0;
        color: $s-font-color;
        text-align: center;
        cursor: pointer;
        &:focus {
          outline: none;
        }
        &:hover {
          color: $s-primary-color;
        }
      }
    }
  }
}

.s-custom--option-wrapper .s-custom--header,
.s-custom--option-wrapper .s-custom--body {
  list-style-type: none;
  overflow: auto;
  margin: 0;
  padding: 0;
  user-select: none;
  & > li {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
  }
}

.s-custom--option {
  @extend %XECheckbox;
  .s-checkbox--icon {
    left: 0.6em;
    top: 0.38em;
  }
}

.s-toolbar {
  font-size: $s-font-size;
  min-height: $s-toolbar-height-default;
  .s-tools--operate-btn {
    font-size: $s-font-size + 4px;
  }
  .s-custom--option {
    & > .s-checkbox--icon {
      font-size: $s-checkbox-font-size-default;
    }
  }
  &.size--medium {
    font-size: $s-font-size-medium;
    min-height: $s-toolbar-height-medium;
    .s-tools--operate-btn {
      font-size: $s-font-size-medium + 4px;
    }
    .s-custom--option {
      & > .s-checkbox--icon {
        font-size: $s-checkbox-font-size-medium;
      }
    }
  }
  &.size--small {
    font-size: $s-font-size-small;
    min-height: $s-toolbar-height-small;
    .s-tools--operate-btn {
      font-size: $s-font-size-small + 4px;
    }
    .s-custom--option {
      & > .s-checkbox--icon {
        font-size: $s-checkbox-font-size-small;
      }
    }
  }
  &.size--mini {
    font-size: $s-font-size-mini;
    min-height: $s-toolbar-height-mini;
    .s-tools--operate-btn {
      font-size: $s-font-size-mini + 4px;
    }
    .s-custom--option {
      & > .s-checkbox--icon {
        font-size: $s-checkbox-font-size-mini;
      }
    }
  }
}
