// jsPlumb样式优化
@import "jsplumbtoolkit-defaults";
@import "step-imgs";

.flow-layout {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.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;
  cursor: grab;
  transition: all 0.3s ease-out;
}

.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;
  &:before{
    background-size: 75px 10px, 5px 5px;
  }
  &:after {
    background-size: 10px 75px, 5px 5px;
  }
}

.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;
  &:before{
    background-size: 70px 10px, 5px 5px;
  }
  &:after {
    background-size: 10px 70px, 5px 5px;
  }
}

.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;
  &:before{
    background-size: 60px 10px, 5px 5px;
  }
  &:after {
    background-size: 10px 60px, 5px 5px;
  }
}

.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;
  &:before{
    background-size: 55px 10px, 5px 5px;
  }
  &:after {
    background-size: 10px 55px, 5px 5px;
  }
}

.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;
  &:before{
    background-size: 45px 10px, 5px 5px;
  }
  &:after {
    background-size: 10px 45px, 5px 5px;
  }
}

.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;
  &:before{
    background-size: 40px 10px, 5px 5px;
  }
  &:after {
    background-size: 10px 40px, 5px 5px;
  }
}

.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;
  position: relative;
}


.flow-editor {

}

.node {
  display: inline-block;
  vertical-align: bottom;
  background-color: #8db9d3;
  color: #fff;
  border-radius: 10px;
  margin: 0px 9px 15px;
  width: 50px;
  height: 50px;
  cursor: pointer;
  padding: 0;
  font-size: 0.9em;
  transition: 0.2s outline;
}

.node-circle {
  border-radius: 25px;

  .step-img {
    margin: 0 auto;
    margin-top: 10px;
    width: 30px;
    height: 30px;
  }
}

.node-square {
  display: inline-block;
  vertical-align: bottom;
  margin: 0px 9px 0;
  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-top: 5px;
    margin-left: 5px;
    width: 40px;
    height: 40px;
  }

  .step-expand {
    margin-top: 2px;
    margin-left: 2px;
  }
}


.step-img {
  margin-top: 5px;
  margin-left: 13px;
  width: 24px;
  height: 24px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.step-title {
  font-size: 10px;
  text-align: center;
}

// 右侧的editor
.flow-editor-sidebar {
  position: relative;
  width: 287px;
  background-color: #616D74;
  color: #bababa;
  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: 5px;
    padding-top: 8px;
    vertical-align: top;
    width: 62px;

    .text-line {
      color: #444;
      display: inline-block;
    }

    span {
      max-width: 50px;
      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;

    .node-square {
      margin: auto;
    }

    .node-content {
      display: flex;
    }

    .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: #ccc;
    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: 29px;
      margin-top: -2px;
      position: absolute;
      margin-left: 0.5px;
      color: #ccc;
    }

    &:after {
      content: "";
      font-size: 14px;
      padding: 0 4px;
      opacity: 0;
    }


    &:hover {
      border-radius: 30px;
      width: 135px;
      transform: translateX(-45px);
      height: 100px;
      color: #72c6d0;
      z-index: 1;
      text-align: center;

      &:before {
        color: #72c6d0;
        content: '';
      }

      &:after {
        opacity: 1;
        content: '\70B9\51FB\6216\62D6\52A8\5DE6\4FA7\8282\70B9\5230\6B64\5904';
      }
    }



    &.is-active {
      position: relative;
      border-radius: 30px;
      width: 135px;
      transform: translateX(-45px);
      height: 100px;
      color: #72c6d0;
      z-index: 1;
      text-align: center;

      &:before {
        color: #72c6d0;
        content: '';
      }

      &:after {
        opacity: 1;
        content: '\70B9\51FB\6216\62D6\52A8\5DE6\4FA7\8282\70B9\5230\6B64\5904';
      }

      .sortable-ghost {
        display: none;
      }
    }
  }



  .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;

    &.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;
      }
    }
  }


}


// dialog
.dialog-wrap {
  .el-dialog__header {
    padding: 15px 20px 10px;
    background-color: #81D3F8;
    color: #F2F2F2;
  }

  .el-dialog__body {
    padding: 15px 10px;
  }

  .dialog-title {
  }

  .el-icon-arrow-left {
    font-size: 14px;
    cursor: pointer;
    padding-right: 15px;
    border-right: 1px solid #ccc;
  }

  .desc {
    position: relative;
    line-height: 14px;
  }

}


.flow-tools {
  position: absolute;
  box-sizing: border-box;
  right: 297px;
  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;
    }

    .fa{
      font-size: 25px;
    }

    .fa-mail-forward{
      font-size: 23px;
    }
  }
}


.flow-zoom {
  height: 96px;
  padding: 5px;
  top: 50px;
  left: 20px;
  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(10px, -15px) !important;
  color: #bababa;
  width: 60px;

  .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;
}





