// jsPlumb样式优化
@import "jsplumbtoolkit-defaults";
@import "../../styles/variables";

body{
  .primary{
    color:$--color-primary;
  }
}

.step-img{
  margin: 2px auto;
  font-size: 40px;
  width: 40px;
  height: 40px;
  &.iconfont{
    color: #ffffff;
    &.icon-node{
      font-size: 24px;
      width: 24px;
      height:24px;
      margin: 5px auto;
    }
  }
}

.flow-layout {
  .flow-tools {
    .icon-grid-open,.icon-auto-sort-open {
      color: $activeButton;
    }

    .icon-grid-close, icon-auto-sort-close {
      color:$closeButton;
    }

    .icon-undo-disabled {
      color:$disabledButton;
    }
  }
}

.flow-layout {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
}

.flow-editor {
  position: relative;
  display: flex;
  flex-direction: row;
  flex: 1;
  overflow: hidden;
  height: 100%;
}

.flow-editor.draft {
  background: #fff;
}

.canvas-container {
  flex: 1;
  overflow: auto;
  z-index: 0;
}

.canvas-container.show-grid[data-zoom="100"] {
  background-image: linear-gradient(#eee 1px, transparent 0),
    linear-gradient(90deg, #eee 1px, transparent 0),
    linear-gradient(#f5f5f5 1px, transparent 0),
    linear-gradient(90deg, #f5f5f5 1px, transparent 0);
  background-size: 75px 75px, 75px 75px, 15px 15px, 15px 15px;
}

.canvas-container.show-grid[data-zoom="90"] {
  background-image: linear-gradient(#eee 1px, transparent 0),
    linear-gradient(90deg, #eee 1px, transparent 0),
    linear-gradient(#f5f5f5 1px, transparent 0),
    linear-gradient(90deg, #f5f5f5 1px, transparent 0);
  background-size: 70px 70px, 70px 70px, 14px 14px, 14px 14px;
}

.canvas-container.show-grid[data-zoom="80"] {
  background-image: linear-gradient(#eee 1px, transparent 0),
    linear-gradient(90deg, #eee 1px, transparent 0),
    linear-gradient(#f5f5f5 1px, transparent 0),
    linear-gradient(90deg, #f5f5f5 1px, transparent 0);
  background-size: 60px 60px, 60px 60px, 12px 12px, 12px 12px;
}

.canvas-container.show-grid[data-zoom="70"] {
  background-image: linear-gradient(#eee 1px, transparent 0),
    linear-gradient(90deg, #eee 1px, transparent 0),
    linear-gradient(#f5f5f5 1px, transparent 0),
    linear-gradient(90deg, #f5f5f5 1px, transparent 0);
  background-size: 55px 55px, 55px 55px, 11px 11px, 11px 11px;
}

.canvas-container.show-grid[data-zoom="60"] {
  background-image: linear-gradient(#eee 1px, transparent 0),
    linear-gradient(90deg, #eee 1px, transparent 0),
    linear-gradient(#f5f5f5 1px, transparent 0),
    linear-gradient(90deg, #f5f5f5 1px, transparent 0);
  background-size: 45px 45px, 45px 45px, 9px 9px, 9px 9px;
}

.canvas-container.show-grid[data-zoom="50"] {
  background-image: linear-gradient(#eee 1px, transparent 0),
    linear-gradient(90deg, #eee 1px, transparent 0),
    linear-gradient(#f5f5f5 1px, transparent 0),
    linear-gradient(90deg, #f5f5f5 1px, transparent 0);
  background-size: 40px 40px, 40px 40px, 8px 8px, 8px 8px;
}

.canvas-container.show-grid:before {
  content: "";
  height: 10px;
  width: 100%;
  display: block;
  background-repeat-y: no-repeat;
  position: absolute;
  background-image: linear-gradient(90deg, #ccc 1px, transparent 0),
    linear-gradient(90deg, #ddd 1px, transparent 0);
  background-size: 75px 10px, 5px 5px;
}

.canvas-container.show-grid:after {
  content: "";
  height: 100%;
  width: 10px;
  display: block;
  background-repeat-x: no-repeat;
  position: absolute;
  top: 0;
  background-image: linear-gradient(#ccc 1px, transparent 0),
    linear-gradient(#ddd 1px, transparent 0);
  background-size: 10px 75px, 5px 5px;
}

#campaignCanvas {
  background-color: transparent;
  transform-origin: top;
  width: 100%;
  height: 100%;
  overflow: visible !important;
}

.flow-editor {
}

.node {
  display: inline-block;
  vertical-align: bottom;
  background-color: #8db9d3;
  color: #fff;
  border-radius: 10px;
  margin: 9px;
  width: 50px;
  height: 50px;
  cursor: pointer;
  padding: 0;
  font-size: 0.9em;
  transition: 0.2s outline;
}

.node-circle {
  border-radius: 25px;
}

.node-square {
  display: inline-block;
  vertical-align: bottom;
  margin: 9px;
  width: 50px;
  height: 50px;
  cursor: pointer;
  position: relative;
  .square {
    width: 50px;
    height: 50px;
    border-radius: 10px;
    background-color: #8db9d3;
    transform: rotate(45deg) scale(0.8);
    overflow: hidden;
  }

  .step-img {
    transform: rotate(-45deg);
    margin: inherit;
  }
}

.step-title {
  font-size: 10px;
  text-align: center;
}

// 右侧的editor
.flow-editor-sidebar {
  position: relative;
  width: 70px;
  background-color: #0a9398;
  color: #ffffff;
  z-index: 1;
  overflow-y: auto;
  overflow-x: hidden;
  transition: all 0.3s;

  &.collapsed {
    transform: translateX(-100%);
    overflow: visible;
    width: 0;
  }

  .items-box {
    padding-top: 15px;
    padding-bottom: 5px;
    border-bottom: 1px solid #7f7f7f;

    &:last-child {
      border-bottom: none;
    }
  }
}

// editor
.canvas-container {
  .flow-item {
    height: 50px;
    width: 50px;
  }
  .flow-text {
    margin-left: 10px;
    padding-top: 8px;
    vertical-align: top;
    width: 62px;
    .text-line {
      color: #444;
      width: 62px;
      display: inline-block;
    }
    span {
      max-width: 100px;
      display: inline-block;
    }
    span.text-content {
      white-space: pre;
      text-overflow: ellipsis;
      overflow: hidden;
      color: #8b9ea5;
      max-width: 90px;
      display: inline-block;
      position: absolute;
      word-break: break-all;
      word-break: break-word;
      &:hover {
        overflow: visible;
        width: 90px;
        white-space: pre-wrap;
        z-index: 1;
      }
    }
    i {
      position: absolute;
    }
  }

  .node-content-wrap {
    position: absolute;
    width: 50px;
    height: 50px;
    cursor: pointer;
    display: flex;
    flex-shrink: 0;
    z-index: 1;
    .node-square {
      margin: auto;
    }

    .node-content {
      display: flex;
      width: 50px;
    }

    .flow-item {
      flex-shrink: 0;
    }

    &:hover {
      .flow-delete {
        display: inline-block;
        text-align: center;
        font-size: 16px;
      }
    }
  }

  .node {
    margin: auto;
  }

  .node-temp.node-temp-img {
    position: relative;
    transform: scale(0.8) translateY(-5px);
    transition: all 0.5s;
    background: #fff;
    color: #8a8a8a;
    border: 2px dashed;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex-shrink: 0;
    align-items: center;
    font-size: 28px;
    cursor: pointer;
    &:before {
      content: "+";
      font-size: 32px;
      margin-top: -2px;
      position: absolute;
      margin-left: 0.5px;
    }

    &:after {
      content: "";
      font-size: 14px;
      padding: 0 4px;
      opacity: 0;
    }
  }

  .flow-delete {
    cursor: pointer;
    display: none;
    color: #ff7373;
  }

  .node-temp-small {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 1.5px dashed;
    color: #ccc;
    text-align: center;
    background: #fff;
    cursor: pointer;
    transition: transform 0.3s, width 0.3s, height 0.3s, border-radius 0.3s;
    justify-content: center;
    display: none;
    z-index: 1;
    &.is-active {
      .sortable-ghost {
        display: none;
      }
    }

    &:before {
      width: 100px;
      height: 50px;
      position: absolute;
      left: 18px;
      display: flex;
      align-items: center;
      justify-content: center;
    }

    &:after {
      content: "+";
      background: #fff;
      position: relative;
      top: 2px;
    }

    &.is-active,
    &:hover {
      color: #72c6d0;
      width: 135px;
      height: 50px;
      border-radius: 50px;
      z-index: 1;

      &:before {
        content: "\70B9\51FB\6216\62D6\52A8\5DE6\4FA7\8282\70B9\5230\6B64\5904";
      }

      &:after {
        opacity: 0;
      }
    }
  }
}

.flow-tools {
  position: absolute;
  box-sizing: border-box;
  right: 90px;
  top: 10px;
  background: rgba(255, 255, 255, 1);
  border: 1px solid rgba(242, 242, 242, 1);
  height: 40px;
  border-radius: 3px;
  padding: 5px 0;
  z-index: 1;

  .tool-item {
    width: 25px;
    height: 25px;
    display: inline-block;
    cursor: pointer;
    color: #bfbfbf;
    margin: 0 5px;
    vertical-align: top;

    span {
      display: inline-block;
      width: 25px;
      height: 25px;
      font-size: 25px;
    }

    .fa {
      font-size: 25px;
    }

    .fa-mail-forward {
      font-size: 23px;
    }
  }
}

.flow-zoom {
  height: 96px;
  padding: 5px;
  top: 50px;
  right: 130px;
  position: absolute;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  z-index: 1;

  .zoom-btn {
    z-index: 2;
    .el-button--mini {
      width: 24px;
      height: 24px;

      &.is-circle {
        padding: 5px;
      }
    }
  }
  &:before {
    content: "";
    position: absolute;
    border: 1px solid;
    width: 2px;
    height: 80px;
    left: 16px;
    box-shadow: 0px 0px 10px #ccc;
  }
  &:after {
    content: attr(data-zoom);
    top: 10px;
    left: 33px;
    position: absolute;
  }
}

.node-item-label {
  transform: translate(-6px, 10px) !important;
  z-index: 2;
  .node-item-title {
    max-width: 60px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
  }
}

.item-border {
  border: 1px solid #eee;
  border-radius: 4px;
  padding: 5px 10px;

  .item-title {
    font-size: 12px;
  }
}

.text-step-count {
  color: #aa5c00;
}

.pre-show {
  height: 500px;
  overflow: auto;
}
