@import 'base/variables';
@import 'base/font';
@import 'base/mixins';

.form-wrap.form-builder {
  @import 'base/bs';
  @import 'base/animation';
  @import 'controls';
  @import 'stage';
  @import 'kc-toggle';
  position: relative;

  &::after {
    content: '';
    display: table;
    clear: both;
  }
}

.cb-wrap,
.stage-wrap {
  vertical-align: top;

  &.pull-right {
    float: right;
  }

  &.pull-left {
    float: left;
  }
}

.form-elements,
.form-group,
.multi-row span,
textarea {
  display: block;
}

.form-elements::after,
.form-group::after {
  content: '.';
  display: block;
  height: 0;
  clear: both;
  visibility: hidden;
}

.form-elements .field-options div:hover,
.frmb .legend,
.frmb .prev-holder {
  cursor: move;
}

// tooltips
.frmb-tt {
  display: none;
  position: absolute;
  top: 0;
  left: 0;
  border: 1px solid darken($grey, 25%);
  background-color: $grey;
  border-radius: 5px;
  padding: 5px;
  color: $white;
  z-index: 20;
  text-align: left;
  font-size: 12px;
  pointer-events: none;

  &::before {
    border-color: darken($grey, 25%) transparent;
    bottom: -11px;
  }

  &::before,
  &::after {
    content: '';
    position: absolute;
    border-style: solid;
    border-width: 10px 10px 0;
    border-color: $grey transparent;
    display: block;
    width: 0;
    z-index: 1;
    margin-left: -10px;
    bottom: -10px;
    left: 20px;
  }

  a {
    text-decoration: underline;
    color: $white;
  }
}

.frmb li {
  &:hover,
  .fb-mobile & {
    .del-button,
    .toggle-form {
      opacity: 1;
    }
  }
}

.frmb-xml .ui-dialog-content {
  white-space: pre-wrap;
  word-wrap: break-word;
  font-size: 12px;
  padding: 0 30px;
  margin-top: 0;
}

.toggle-form {
  opacity: 0;

  &:hover {
    border-color: lighten($grey, 40%);
  }

  &::before {
    margin: 0;
  }
}

.formb-field-vars .copy-var {
  display: inline-block;
  width: 24px;
  height: 24px;
  background: $grey-light-30;
  text-indent: -9999px;
}

.ui-button {
  .ui-button-text {
    line-height: 0;
  }
}

.form-builder-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: $overlay-color;
  display: none;
  z-index: 10;

  &.visible {
    display: block;
  }
}

.form-builder-dialog {
  position: absolute;
  border-radius: 5px;
  background: $white;
  z-index: 20;
  transform: translate(-50%, -50%);
  top: 0;
  left: 0;
  padding: 10px;
  box-shadow: 0 3px 10px $black;
  min-width: 166px;
  max-height: 80%;
  overflow-y: scroll;

  h3 {
    margin-top: 0;
  }

  &.data-dialog {
    width: 65%;
    background-color: $dirt-gray;

    pre {
      background: none;
      border: 0 none;
      box-shadow: none;
      margin: 0;
      color: darken($white, 5%);
    }
  }

  &.positioned {
    transform: translate(-50%, -100%);

    .button-wrap {
      &::before {
        content: '';
        width: 0;
        height: 0;
        border-left: 15px solid transparent;
        border-right: 15px solid transparent;
        border-top: 10px solid $white;
        position: absolute;
        left: 50%;
        top: 100%;
        transform: translate(-50%, 10px);
      }
    }
  }

  .button-wrap {
    position: relative;
    margin-top: 10px;
    text-align: right;
    clear: both;

    .btn {
      margin-left: 10px;
    }
  }
}
