$primary-color: #409eff;
$primary-active-color: #ecf5ff;
$primary-background-color: #ecf8ff;

*,
:after,
:before {
  -webkit-box-sizing: border-box;
  -moz-box-sizing: border-box;
  box-sizing: border-box;
}

body {
  margin: 0 !important;
}

#app {
  font-family: "Avenir", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color: #2c3e50;
  min-height: 100%;
  height: 100%;
}

.form-designer {
  height: 100%;
  background: #fff;
  outline: 1px solid #e4e7ed;

  ::-webkit-scrollbar {
    width: 0px !important;
    height: 0px !important;
  }

  ::-webkit-scrollbar-track {
    -webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0) !important;
    border-radius: 10px !important;
    background-color: rgba(0, 0, 0, 0) !important;
  }

  ::-webkit-scrollbar-thumb {
    border-radius: 10px !important;
    -webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0) !important;
    background-color: #fff !important;
  }

  .fields-list {
    padding: 10px 0;
    width: 100%;
    height: 100%;

    .field-title {
      padding: 8px 12px;
      font-size: 13px;
    }

    ul {
      position: relative;
      overflow: hidden;
      padding: 0 10px 10px;
      margin: 0;
    }

    .field-label {
      font-size: 12px;
      display: block;
      width: 48%;
      line-height: 26px;
      position: relative;
      float: left;
      left: 0;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      margin: 1%;
      color: #333;
      border: 1px solid #f4f6fc;

      &:hover {
        color: $primary-color;
        border: 1px dashed $primary-color;
      }

      & > a {
        display: block;
        cursor: move;
        background: #f4f6fc;
        border: 1px solid #f4f6fc;
        color: #333;

        .icon {
          margin-right: 6px;
          margin-left: 8px;
          font-size: 14px;
          display: inline-block;
          vertical-align: middle;
        }

        span {
          display: inline-block;
          vertical-align: middle;
        }
      }
    }

    .field-label-disabled {
      font-size: 12px;
      display: block;
      width: 48%;
      line-height: 26px;
      position: relative;
      float: left;
      left: 0;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      margin: 1%;
      color: #333;
      border: 1px solid #f4f6fc;

      &:hover {
        color: gray;
        border: 1px dashed gray;
      }

      & > a {
        display: block;
        cursor: not-allowed;
        background: #f4f6fc;
        border: 1px solid #f4f6fc;

        .icon {
          margin-right: 6px;
          margin-left: 8px;
          font-size: 14px;
          display: inline-block;
          vertical-align: middle;
        }

        span {
          display: inline-block;
          vertical-align: middle;
        }
      }
    }
  }

  .widget-container {
    flex: 1;
    border-left: 1px solid #e0e0e0;
    border-right: 1px solid #e0e0e0;

    .widget-container-header {
      height: 45px !important;
      display: flex;
      justify-content: space-between;
      align-items: center;
      border-bottom: solid 2px #e4e7ed;
    }

    .el-main {
      padding: 0;
      position: relative;
    }
  }

  .widget-form-container {
    height: 100%;
    position: relative;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;

    .el-form {
      height: 100%;
      .el-row {
        height: 100%;
      }
    }

    .widget-form-list {
      height: 100%;
      min-height: calc(100% - 45px);
      padding-bottom: 50px;
      overflow: hidden;
      overflow-y: scroll;
      display: flex;
      flex-wrap: wrap;
      align-content: flex-start;
      .widget-form-item {
        min-height: 55px;
        padding: 5px 10px 18px;
        margin: 0;
        position: relative;
        // border-left: 5px solid transparent;

        &.required {
          .el-form-item__label::before {
            content: "*";
            color: #f56c6c;
            margin-right: 4px;
          }
        }

        &:after {
          content: "";
          position: absolute;
          left: 0;
          right: 0;
          bottom: 0;
          top: 0;
          display: block;
          z-index: 1001;
        }

        &:hover {
          background: $primary-background-color;
          cursor: move;
        }

        &.active {
          border-left: 3px solid $primary-color;
          background: $primary-active-color;
        }

        .widget-action-delete {
          position: absolute;
          right: 10px;
          bottom: -32px;
          z-index: 1002;
        }

        .widget-action-clone {
          position: absolute;
          right: 50px;
          bottom: -32px;
          z-index: 1002;
        }
      }

      .widget-form-table {
        position: relative;
        padding: 2px;
        float: left;
        width: 100%;

        &__content {
          display: flex;
          flex-wrap: wrap;
          align-content: flex-start;
          padding: 10px 5px;
          width: 100%;
          height: 100%;
          overflow-y: hidden;
          outline: 1px dashed #ccc;
          outline-offset: -1px;
          min-height: 150px;

          .ghost {
            background: white;
            border-left: 5px solid $primary-color;
            box-sizing: border-box;
            font-size: 0;
            content: "";
            overflow: hidden;
            padding: 0 !important;
            position: relative;
            outline: none 0;
            height: 100%;
            min-height: 90px;
            width: 0 !important;
            min-width: 0 !important;
            margin: 1px 2px 0 2px;
          }
        }

        &__item {
          position: relative;
          width: 33.3%;
          padding: 1px;
          background-color: white;
          margin: 3px;
          &.is-form {
            width: auto;
          }
          &.required {
            .el-table__header .cell::before {
              content: "*";
              color: #f56c6c;
              margin-right: 4px;
            }
          }

          &.active {
            outline: 1px solid $primary-color;
            outline-offset: -1px;
          }

          &:hover {
            outline: 1px solid $primary-color;
            outline-offset: -1px;
            cursor: move;
          }

          &:after {
            position: absolute;
            left: 0;
            right: 0;
            bottom: 0;
            top: 0;
            display: block;
            content: "";
            z-index: 1001;
          }

          .widget-table-action-delete {
            position: absolute;
            right: 0;
            bottom: 0;
            z-index: 1002;
          }

          .widget-table-action-clone {
            position: absolute;
            right: 30px;
            bottom: 0;
            z-index: 1002;

            i {
              font-size: 10px;
            }
          }

          .el-button--small.is-circle {
            padding: 5px;
          }
        }

        &.active {
          border-left: 3px solid $primary-color;
          background: $primary-active-color;
        }

        &:hover {
          background: $primary-background-color;
          cursor: move;
        }

        .widget-action-delete {
          position: absolute;
          right: 10px;
          bottom: -12px;
          z-index: 1001;
        }

        .widget-action-clear {
          position: absolute;
          right: 50px;
          bottom: -12px;
          z-index: 1001;
        }

        .widget-action-clone {
          position: absolute;
          right: 90px;
          bottom: -12px;
          z-index: 1001;
        }
      }

      .widget-form-group {
        position: relative;
        width: 100%;
        float: left;
        padding: 2px;

        &__head {
          margin: 10px;
        }

        &__body {
          min-height: 150px;
          height: 100%;
          outline: 1px dashed #ccc;
          outline-offset: -1px;
          overflow: hidden;
          padding-bottom: 15px;
          display: flex;
          flex-wrap: wrap;
          align-content: flex-start;
          .ghost {
            background: white;
            border-left: 5px solid $primary-color;
            box-sizing: border-box;
            font-size: 0;
            content: "";
            overflow: hidden;
            padding: 0 !important;
            position: relative;
            outline: none 0;
            height: 100%;
            min-height: 57px;
            width: 0 !important;
            min-width: 0 !important;
            margin: 1px 2px 0 2px;
          }
        }

        &__item {
          position: relative;
          // border-left: 5px solid transparent;
          background: white;
          margin: 3px;

          &.required {
            .el-form-item__label::before {
              content: "*";
              color: #f56c6c;
              margin-right: 4px;
            }
          }

          &.active {
            outline: 1px solid $primary-color;
            outline-offset: -1px;
          }

          &:hover {
            outline: 1px solid $primary-color;
            outline-offset: -1px;
            cursor: move;
          }

          &:after {
            position: absolute;
            left: 0;
            right: 0;
            bottom: 0;
            top: 0;
            display: block;
            content: "";
            z-index: 1001;
          }

          &--delete {
            position: absolute;
            right: 0;
            bottom: -24px;
            z-index: 1002;
          }

          &--clone {
            position: absolute;
            right: 34px;
            bottom: -24px;
            z-index: 1002;
          }
        }

        &.active {
          border-left: 3px solid $primary-color;
          background: $primary-active-color;
        }

        &:hover {
          background: $primary-background-color;
          cursor: move;
        }

        .widget-action-delete {
          position: absolute;
          right: 10px;
          bottom: -12px;
          z-index: 1001;
        }

        .widget-action-clear {
          position: absolute;
          right: 50px;
          bottom: -12px;
          z-index: 1001;
        }

        .widget-action-clone {
          position: absolute;
          right: 90px;
          bottom: -12px;
          z-index: 1001;
        }
      }

      .iconfont {
        font-size: 13px;
      }

      .el-button--small.is-circle {
        padding: 7px;
      }
    }

    .ghost {
      background: white;
      border-top: 5px solid $primary-color;
      box-sizing: border-box;
      font-size: 0;
      content: "";
      overflow: hidden;
      padding: 0 !important;
      position: relative;
      outline: none 0;
      height: 0 !important;
      width: 100%;
      margin: 2px 0;
    }
    .el-form-item {
      display: flex;
      align-items: center;
      padding: 10px 2px;
      margin: 0px;
      .el-form-item__label {
        font-weight: bold;
        line-height: 1.2;
      }
      .el-form-item__content {
        margin-left: 0 !important;
        flex: 1;
      }
    }
  }

  .widget-config-container {
    height: 100%;
    padding-top: 5px;

    .el-tabs {
      height: 100%;
    }

    .el-tabs__header {
      margin: 0;
      height: 45px;
      background: white;
      z-index: 1000;
    }

    .el-tabs__content {
      height: calc(100% - 45px);
      overflow-y: scroll;
    }

    .widget-config {
      .el-tabs__header {
        position: relative;
        display: block;
        top: 0;
        margin: 0;
      }

      .el-tabs__content {
        margin-top: 0;
      }

      .ghost {
        background: #fff;
        border: 1px dashed $primary-color;
      }

      ul {
        margin: 0;
        padding: 0;

        li {
          display: flex;
          align-items: center;
          width: 100%;

          .ghost {
            list-style: none;
            font-size: 0;
            height: 35px;
          }
        }
      }
    }
    .avue-group__item {
      padding: 0;
    }
  }

  .el-container {
    height: 100%;

    .el-main {
      height: calc(100% - 45px);
    }

    .el-aside {
      background: #fff;
    }
  }

  .danger {
    color: #f56c6c;
  }

  .warning {
    color: #e6a23c;
  }

  .el-input-number.is-controls-right {
    .el-input-number__decrease {
      border-left: none;
    }
    .el-input-number__increase {
      border-left: none;
      border-bottom: none;
    }
  }

  .el-date-editor,
  .el-cascader,
  .el-select,
  .el-input-number {
    width: 100%;
  }
}

.drawer-foot {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 20px;
  display: flex;

  button {
    width: 50%;
  }

  & > span {
    display: inline-block;
    width: 50%;
    button {
      width: 100%;
    }
  }
}

.preview-form {
  padding-bottom: 80px;
  // overflow-y: scroll;
  // height: 83vh;
}

.popper-bo {
  .el-alert {
    margin-bottom: 10px;
  }
}

.el-drawer__wrapper {
  :focus {
    outline: 0;
  }
}
