.textbus-toolbar {
  font-size: 14px;
  color: $color-default;
  font-family: Helvetica Neue, Helvetica, Arial, sans-serif;
  user-select: none;
  position: relative;
  z-index: 2;
  border-radius: inherit;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .1);

  button {
    font-family: inherit;
  }
}

.textbus-toolbar-wrapper {
  background-color: $color-lighter;
  border: 1px solid $color-gray-light;
  padding: 8px 10px 3px;
  min-height: 24px;
  border-radius: inherit;
  position: relative;
  z-index: 1;
  @include clearfix;
}

.textbus-toolbar-group {
  display: inline-block;
  margin-left: 4px;
  margin-right: 4px;
  margin-bottom: 5px;
  border-radius: 5px;

  &:last-child {
    margin-left: 0;
  }
}

.textbus-toolbar-item {
  position: relative;
  display: inline-block;
  border-radius: 4px;
  font-size: 0;
}

.textbus-toolbar-button {
  display: inline-flex;
  flex: 1;
  font-size: 14px;
  background: none;
  border: none;
  cursor: pointer;
  line-height: 1;
  padding: 0 5px;
  height: 28px;
  align-items: center;
  border-radius: inherit;
  line-height: 1;

  &:hover {
    background-color: rgba(0, 0, 0, .05);
  }

  &:active {
    background-color: rgba(0, 0, 0, .1);
  }

  &:focus {
    position: relative;
    z-index: 1;
    @include focus($color-primary)
  }

  &-icon {
    display: inline-block;
    min-height: 1em;
  }

  &-active {
    color: $color-primary;
  }

  &:disabled {
    background: none;
    opacity: 0.5;
    cursor: not-allowed;
    color: inherit;
  }
}

.textbus-toolbar-label {
  display: inline-block;
  overflow: hidden;
}

.textbus-toolbar-split-line {
  display: inline-block;
  margin-left: 6px;
  margin-right: 6px;
  height: 14px;
  width: 1px;
  background-color: rgba(0, 0, 0, .2);
}

.textbus-toolbar-dropdown-menu {
  position: absolute;
  left: 0;
  top: 100%;
  transform-origin: 0 0;
  transition-property: opacity, transform;
  transition-duration: .1s;
  opacity: 0.5;
  transform: scaleY(0);
  background-color: rgba(252, 252, 251, .96);
  box-shadow: 1px 1px 3px rgba(0, 0, 0, .2);
  border-radius: 4px;
  min-width: 100%;
  font-size: 13px;
  z-index: 2;
}

.textbus-toolbar-dropdown-button {
  position: relative;
  display: inline-block;
}

.textbus-toolbar-dropdown {
  position: relative;
  display: inline-block;

  &:focus-within {
    z-index: 10;
  }

  &.textbus-toolbar-dropdown-open {
    > .textbus-toolbar-action {
      background-color: #fff;
    }

    .textbus-toolbar-dropdown-menu {
      transform: scaleY(1);
      opacity: 1;
    }

    .textbus-dropdown-caret {
      &:after {
        transform: rotateZ(180deg);
      }
    }
  }
}

.textbus-toolbar-select-options {
  padding-top: 5px;
  padding-bottom: 5px;
}

.textbus-toolbar-option {
  color: inherit;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 3px 20px;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  outline: none;
  font-size: 1em;
  cursor: pointer;
  white-space: nowrap;
  line-height: inherit;
  min-height: 25px;

  &-keymap {
    font-size: 12px;
    line-height: 1;
    font-weight: normal;
    margin-left: 20px;
    opacity: .8;
    display: inline-flex;
    align-items: center;
    font-variant-numeric: tabular-nums;
    font-family: Microsoft YaHei Mono, Menlo, Monaco, Consolas, Courier New, monospace;

    > span {
      margin-right: 1px;
    }
  }

  &-icon {
    margin-right: .5em;
    margin-left: -.5em;
    width: 1.2em;
    opacity: .8;
  }

  &-label {
    flex: 1;

    &:before {
      margin-right: .5em;
      //font-size: 1.2em;
      vertical-align: middle;
    }
  }

  &-active {
    color: $color-primary;
  }

  &:hover {
    color: #fff;
    background-color: $color-primary;
  }


  &:disabled, &-disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: inherit;
    color: inherit;

    &:hover {
      color: inherit;
      background: inherit;
    }
  }
}

.textbus-dropdown-caret {
  margin-left: 2px;
  height: 100%;
  display: inline-flex;
  justify-content: center;
  align-items: center;

  &:after {
    content: "";
    display: inline-block;
    width: 0;
    height: 0;
    vertical-align: middle;
    border-top: 4px dashed;
    border-right: 4px solid transparent;
    border-left: 4px solid transparent;
    transition: ease .15s;
  }
}

.textbus-toolbar-select-icon {
  font-size: 0.6em;
  margin-right: 3px;
}

.textbus-toolbar-select-label {
  width: 75px;
  display: inline-block;
  justify-content: space-between;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: left;
  height: 28px;
  line-height: 26px;

  &-mini {
    width: auto;
  }
}

.textbus-toolbar-dropdown-button-wrap {
  display: inline-flex;

  &:hover {
    background-color: rgba(0, 0, 0, .05);
  }
}

.textbus-toolbar-dropdown-left-button {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  padding-right: 4px;
}

.textbus-toolbar-dropdown-right-button {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  padding-left: 1px;
  padding-right: 3px;
}

.textbus-form-mini {
  overflow: hidden;
  font-size: 14px;
  padding: 15px;
  min-width: 160px;
  box-sizing: content-box;
  user-select: none;
  border-radius: 4px;

  .textbus-form-group {
    padding: 0 0 5px;
    display: block;
  }

  .textbus-control-label {
    padding-bottom: 5px;
    text-align: left;
    width: auto;
  }

  .textbus-form-footer {
    border: none;
    background: none;
    padding-left: 0;
    padding-right: 0;
    padding-bottom: 0;

    button {
      margin-left: 0;
    }
  }

  .textbus-form-control, .textbus-btn {
    padding: 3px 6px;
    font-size: 13px;
  }

  .textbus-control-label {
    font-weight: bold;
  }

  .textbus-control-static {
    label {
      margin-right: 1em;
      display: inline-flex;
      align-items: center;
      cursor: pointer;

      &:last-child {
        margin-right: 0;
      }
    }

    input {
      margin-right: .3em;
      vertical-align: middle;
    }
  }
}

.textbus-toolbar-group-menu {
  padding-top: 5px;
  padding-bottom: 5px;
}

.textbus-toolbar-group-item {
  min-width: 120px;
  position: relative;

  .textbus-toolbar-submenu {
    height: 0;
    overflow: hidden;
  }

  &:hover {
    z-index: 4;

    .textbus-toolbar-submenu {
      height: auto;
      overflow: auto;
      transform: scale(1);
    }
  }
}

.textbus-toolbar-group-button {
  @extend .textbus-toolbar-option;

  &-icon {
    margin-right: .5em;
    margin-left: -.5em;
    width: 1.2em;
    opacity: .8;
  }

  &-label {
    flex: 1;
  }

  &-caret {
    margin-right: -.5em;
    margin-left: 10px;

    &:after {
      content: "";
      display: inline-block;
      width: 0;
      height: 0;
      vertical-align: middle;
      border-top: 4px solid transparent;
      border-left: 4px dashed;
      border-bottom: 4px solid transparent;
      transition: .15s ease;
    }
  }

  &-active {
    color: $color-primary
  }

  &-keymap {
    font-size: 12px;
    line-height: 1;
    font-weight: 400;
    margin-left: 20px;
    opacity: .8;
    display: inline-flex;
    align-items: center;
    font-variant-numeric: tabular-nums;
    font-family: Microsoft YaHei Mono, Menlo, Monaco, Consolas, Courier New, monospace;
  }
}

.textbus-toolbar-submenu {
  position: absolute;
  top: 0;
  left: 100%;
  transform: scaleY(0);
  transition: transform .1s;
  transform-origin: 0 0;
  background-color: rgba(252, 252, 251, .96);
  box-shadow: 1px 1px 3px rgba(0, 0, 0, .2);
  border-radius: 4px;
}

.textbus-toolbar-keymap-prompt {
  position: absolute;
  top: 100%;
  right: 0;
  white-space: nowrap;
  z-index: 2;
  line-height: 1;
  padding: 3px 8px;
  border-radius: 5px;
  align-items: center;
  font-size: 12px;
  display: none;
  pointer-events: none;
  background-color: rgba(0, 0, 0, .1);
  font-variant-numeric: tabular-nums;
  font-family: Microsoft YaHei Mono, Menlo, Monaco, Consolas, Courier New, monospace;

  > span {
    margin-right: 1px;
  }

  &-show {
    display: flex;
    align-items: center;
  }
}

.textbus-toolbar-keymap-join {
  opacity: .8;
  font-size: .8em;
}

.textbus-toolbar-palette {
  border-radius: 4px;
  overflow: hidden;
}
