@umbGroupBuilderToolbarHeight: 60px;

/* ---------- TOOLBAR --------- */
.umb-group-builder__toolbar {
  display: flex;
  align-items: center;
  padding: 0;
  border-right-width: 21px;
  margin-left: -20px;
  width: calc(100% + 40px);
  margin-top: -20px;
  height: @umbGroupBuilderToolbarHeight;

  .left {
    flex: 1 1 auto;
    width: 50%;
    display: block;
    margin-right: 40px;
  }

  .right {
    flex: 0 0 auto;
  }
}

/* ---------- TABS ----------  */

.umb-group-builder__tabs {
  height: @umbGroupBuilderToolbarHeight;
  position: relative;
}

.umb-group-builder__tabs-list {
  height: 100%;
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  overflow-x: auto;
  overflow-y: visible;
  scroll-behavior: smooth;
  -ms-overflow-style: none;
  scrollbar-width: none;
  margin-bottom: -100px; // allow validation messages to overflow container
  padding-bottom: 100px; // allow validation messages to overflow container
  pointer-events: none; // allow validation messages to overflow container

  li {
    pointer-events: auto;
    height: 100%;

    &:only-of-type {
      .umb-group-builder__tab {
        margin-left: 0;
      }
    }
  }
}

.umb-group-builder__tabs-list::-webkit-scrollbar {
  display: none;
}

.umb-group-builder__tabs-overflow {
  height: 100%;
  width: 30px;
  position: absolute;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
  background: white;
}

.umb-group-builder__tabs-overflow--left {
  left: 0;
  box-shadow: 4px 0 5px rgba(0,0,0,0.08);

  .caret {
    transform: rotate(90deg) translate(0, 2px);
  }
}

.umb-group-builder__tabs-overflow--right {
  right: 0;
  box-shadow: -4px 0 5px rgba(0,0,0,0.08);

  .caret {
    transform: rotate(270deg) translate(0, -2px);
  }
}

.umb-group-builder__tabs-list__add-tab {
    display: contents;

    > umb-button {
        white-space: nowrap;

        .umb-button {
          margin-left: 0;
        }
        
        .umb-button__content {
            flex-wrap: nowrap;
        }
    }

   > umb-button,
   .umb-button,
   .umb-button__button {
        height: 100%;
    }
}

.umb-group-builder__tab {
  background-color: @white;
  position: relative;
  padding: 0 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  border-right: 1px solid @gray-9;
  &:first-of-type {
    border-bottom-left-radius: 3px;
  }
  &:last-of-type {
    border-bottom-right-radius: 3px;
  }

  &:hover {
    cursor: pointer;

    .umb-group-builder__tab-remove {
      display: block;
    }
  }

  .ui-droppable-hover & {
      
    animation: umb-group-builder-tab--droppable-active 800ms ease-in-out alternate infinite;

    @keyframes umb-group-builder-tab--droppable-active {
        0%  { background-color: white }
        50%   { background-color: @gray-12 }
    }
  }

  .badge {
    background-color: @red;
    animation-duration: 1.4s;
    animation-iteration-count: infinite;
    animation-name: umb-group-builder-tab--badge-bounce;
    animation-timing-function: ease;
    display: none;

    @keyframes umb-group-builder-tab--badge-bounce {
        0%   { transform: translateY(0); }
        20%  { transform: translateY(-6px); }
        40%  { transform: translateY(0); }
        55%  { transform: translateY(-3px); }
        70%  { transform: translateY(0); }
        100% { transform: translateY(0); }
    }
  }

  &::before {
    content: "";
    position: absolute;
    height: 0px;
    left: 15px;
    right: 15px;
    background-color: @ui-light-active-border;
    bottom: 0;
    border-radius: @baseBorderRadius @baseBorderRadius 0 0;
    opacity: 0;
    transition: all .2s linear;
  }

  &.is-active {
    color: @ui-light-active-type !important;

    .umb-group-builder__tab-remove {
      display: block;
    }

    &::before {
      opacity: 1;
      height: 4px;
    }
  }

  &.is-deletable {
    padding-right: 45px;
  }

  &.is-inherited {
    padding-right: 22px;

    .umb-group-builder__group-title-input {
      padding: 0;
    }
  }

  .umb-group-builder__group-title-input {
    &:disabled {
      cursor: pointer;
    }
  }
}

.show-validation {
  .umb-group-builder__tab {
    .badge {
      display: block;
    }

    &.has-error {
      &::before {
        background-color: @red;
      }
    }
  }
}

.umb-group-builder__tab-sortable {
  list-style: none;
}

.umb-group-builder__tab-sortable-placeholder {
  background: transparent;
  border: 1px dashed @gray-8;
  border-top: none;
  border-bottom: none;
}

.umb-group-builder__tab-remove {
  position: absolute;
  right: 20px;
  display: none;
}

.umb-group-builder__tab-title-wrapper {
  display: flex;
  align-items: center;
}

.umb-group-builder__tab-title-icon {
  margin-right: 5px;
}

.umb-group-builder__tab-name {
  white-space: nowrap;
}

.umb-group-builder__tab-val-message {
  position: absolute;
  top: calc(100% + 5px);
  left: 20px;
}

.umb-group-builder__tab--placeholder {
  border: 1px dashed @ui-action-discreet-border;
  color: @ui-action-discreet-type;
  padding-right: 10px;
  min-width: 100px;
  background: transparent;
  border-radius: @baseBorderRadius;
  margin-left: 5px;
  transition: color, border-color, 80ms;
  &:hover {
    color: @ui-action-discreet-type-hover;
    border-color: @ui-action-discreet-border-hover;
  }
}

.umb-group-builder__tab-inherited-label {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 1;
  display: block;
  white-space: nowrap;
  padding: 0 4px;
  color: @black;
  font-size: 12px;
  background-color: @gray-8;
  border-radius: @baseBorderRadius;
  margin-top: 5px;

  &:after {
    bottom: 100%;
    left: 10px;
    border: solid transparent;
    content: " ";
    height: 0;
    width: 0;
    position: absolute;
    pointer-events: none;
    border-color: rgba(255, 255, 255, 0);
    border-bottom-color: @gray-8;
    border-width: 4px;
    margin-left: -4px;
  }

  button {
    font-size: 12px;
    color: @black;
    text-decoration: underline;
  }
}

.umb-group-builder__tab.-sortable {
  cursor: move;
  padding-right: 20px;
}

.umb-group-builder__tab-sort-order {
  margin-left: 10px;
}

.umb-group-builder__ungrouped-properties {
    margin-top: 20px;
    position: relative;
}

/* ---------- GROUPS ----------  */

.umb-group-builder__groups {
  list-style: none;
  margin: 0;
  padding: 0;
}

.umb-group-builder__group {
  min-height: 86px;
  border: 1px solid transparent;
  border-radius: @baseBorderRadius;
  box-sizing: border-box;
  background-color: @white;
  position: relative;
  box-shadow: 0 1px 1px 0 rgba(0,0,0,0.16);
  margin-top: 20px;
  margin-bottom: 20px;
}

.umb-group-builder__group.-inherited {
  border-color: @gray-9;
  box-shadow: none;
}

.umb-group-builder__group.-placeholder {
  width:100%;
  min-height: 86px;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  border: 1px dashed @gray-7;
  background-color: transparent;
  color: @ui-action-type;
  font-weight: bold;
  position: relative;
  box-shadow: none;
  &:hover {
      color:@ui-action-type-hover;
      text-decoration: none;
      border-color: @ui-active-type-hover;
  }
}

.umb-group-builder__group.-sortable {
  min-height: initial;
  cursor: move;
}

.umb-group-builder__group-actions {
  position: absolute;
  top: 5px;
  right: 5px;
  visibility: hidden;
  opacity: 0;
  z-index: 10;
}

.umb-group-builder__group-action {
  display: inline-block;
}

.umb-group-builder__group-remove {
  position: relative;
  margin-left: auto;
  font-size: 18px;
  color: @ui-icon;
}

.umb-group-builder__group-remove:hover {
  cursor: pointer;
  color: @ui-icon-hover;
}

.umb-group-builder__group-title-wrapper {
  display: flex;
  align-items: center;
  border-bottom: 1px solid @gray-9;
  padding: 10px 15px 10px 10px;
}

.umb-group-builder__group-title {
  font-weight: bold;
  display: flex;
  align-items: center;
  color: @black;
}

.umb-group-builder__group-title-icon {
  margin-left: 5px;
}

.umb-group-builder__group-title.-active {
  border-color: @blueMid;
}

.umb-group-builder__group-title.-placeholder {
  border: 1px dashed @gray-8;
  border-bottom: none;
  width: 70px;
}

.umb-group-builder__group-title.-inherited {
  border-color: @gray-9;
}

input.umb-group-builder__group-title-input {
  border-color: transparent;
  background: transparent;
  margin-bottom: 0;
}

input.umb-group-builder__group-title-input:disabled:hover {
    border-color: transparent;
}

.umb-group-builder__group-title-input:hover {
  border-color: @inputBorder;
}

.umb-group-builder__group-title-input.-placeholder {
  border: 1px dashed @gray-6;
}

.umb-group-builder__group-title-right {
  display: flex;
  align-items: center;
  margin-left: auto;
}

.umb-group-builder__group-inherited-label {
  font-size: 0.9rem;
  display: inline-flex;
  align-items: center;
  margin-right: 10px;
}

.umb-group-builder__group-title-val-message {
  display: flex;
  align-items: center;
}

.umb-group-builder__group-sort-order {
    margin-right: 20px;
}

.umb-group-builder__group-add-property {
    width: 100%;
    min-height: 46px;
    border-radius: @baseBorderRadius;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    border: 1px dashed @gray-7;
    background-color: transparent;
    color: @ui-action-type;
    font-weight: bold;
    position: relative;
    &:hover {
        color:@ui-action-type-hover;
        text-decoration: none;
        border-color: @ui-active-type-hover;
    }
}

.umb-group-builder__group-content {
  padding: 10px 20px 20px 20px;
}

/* ---------- PROPERTIES ---------- */

.umb-group-builder__properties {
  list-style: none;
  margin: 0;
  padding-right: 5px;
  min-height: 35px; // the height of a sortable property
}

.umb-group-builder__property {
  position: relative;
  display: flex;
  flex-flow: row;
  box-sizing: border-box;
  border-bottom: 1px solid @gray-10; 
  padding: 10px 0;
}

.umb-group-builder__property-sortable {
  list-style: none;
}

.umb-group-builder__property.-locked {
  border: transparent;
}

.umb-group-builder__property.-locked:hover {
  border: transparent;
}

.umb-group-builder__property.-sortable,
.umb-group-builder__property.-sortable-locked {
    min-height: 35px;
    border-radius: @baseBorderRadius;
    border: none;
    animation: none;
    align-items: center;
    padding: 5px 10px;
    margin-bottom: 5px;
}

.umb-group-builder__property.-sortable {
  background: @gray-10;
  color: @gray-1;
  cursor: move;
}

.umb-group-builder__property.-sortable-locked {
  background: @gray-10;
  padding-left: 30px;
}


.umb-group-builder__property-meta {
  flex: 0 0 160px;
  margin-right: 20px;
}

.umb-group-builder__property-meta.-full-width {
  flex: 1;
  margin-right: 0;
}

.umb-group-builder__property-meta-alias {
  font-size: 12px;
  color: @gray-3;
  word-break: break-word;
  line-height: 1.5;
  margin-bottom: 5px;
}

.umb-group-builder__property-meta-label textarea {
  font-size: 14px;
  font-weight: bold;
  margin-bottom: 0;
  color: @gray-1;
  width: 100%;
  padding: 0;
  min-height: 25px;
  box-sizing: border-box;
  resize: none;
  overflow: hidden;
  border-color: transparent;
  background: transparent;
    &:focus {
        border-color: @inputBorderFocus;
    }
}

.umb-group-builder__property-meta-label textarea.ng-invalid {
   border: none;
}

.umb-group-builder__property-meta-description textarea {
  font-size: 12px;
  line-height: 1.5;
  color: @gray-3;
  margin-bottom: 0;
  padding: 0;
  width: 100%;
  min-height: 25px;
  box-sizing: border-box;
  resize: none;
  overflow: hidden;
  border-color: transparent;
  background: transparent;
    &:focus {
        border-color: @inputBorderFocus;
    }
}

.umb-group-builder__property-preview {
    flex: 1;
    height: 30px;
    overflow: hidden;
    position: relative;
    padding: 35px 10px 25px 10px;
    border-radius: 3px;
    cursor: pointer;

    &::after {
        content: "";
        position: absolute;
        top: 0;
        bottom: 0;
        left: 0;
        right: 0;
        background: rgba(225,225,225,.5);
        transition: opacity 120ms;
    }
}

.umb-group-builder__property-preview:not(.-not-clickable):hover {
    &::after {
        opacity: .66;
    }
}

.umb-group-builder__property-preview.-not-clickable {
    cursor: auto;
}

.umb-group-builder__property-preview .help-inline {
    display:none !important;
}

.umb-group-builder__property-preview-label {
  font-size: 0.75rem;
  position: absolute;
  top: 0;
  left: 0;
  text-transform: uppercase;
  z-index: 15;
  background: @gray-10;
  padding: 3px;
  line-height: 12px;
  opacity: 0.8
}


.umb-group-builder__open-settings {
    position: absolute;
    z-index:1;
    top: 0;
    bottom:0;
    left: 0;
    width: 100%;
    background-color: transparent;
    border: none;
    &:focus {
        outline:0;
        border: 1px solid @inputBorderFocus;
    }
}

.umb-group-builder__property-actions {
    flex: 0 0 44px;
    display: flex;
    align-items: flex-start;
    justify-content: flex-end;
    margin-right: -20px;
}

.umb-group-builder__property-action {
    position: relative;
    margin: 5px 0;
    
    button.btn-icon {
        border: none;
        font-size: 18px;
        position: relative;
        cursor: pointer;
        color: @ui-icon;
        margin: 0;
        padding: 5px 10px;
        width: auto;
        overflow: visible;
        background: transparent;
        line-height: normal;
        -webkit-appearance: none;
        
        &:hover, &:focus  {
            color: @ui-icon-hover;
        }
    }
}

.umb-group-builder__property-tags {
    position: absolute;
    z-index: 20;
    top: 4px;
    left: 4px;
    display: flex;
    flex-direction: row;
}

.umb-group-builder__property-tags.-right {
    right: 4px;
    left: auto;
}

.umb-group-builder__property-tag {
    font-size: 12px;
    background-color: @gray-8;
    margin-left: 4px;
    padding: 0 4px;
    display: flex;
    border-radius: 3px;
    align-items: center;

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

    &.-white {
        background-color: @white;
    }
}

.umb-group-builder__property-tag-icon {
    margin-right: 3px;
    display: flex;
    align-items: center;
    line-height: 1;
}

/* ---------- SORTABLE ---------- */

.umb-group-builder__group-sortable-placeholder {
  background: transparent;
  border: 1px dashed @gray-8;
  margin: 0 0 70px 0;
  border-radius: 10px;
  border-radius: 5px;
}

.umb-group-builder__property_sortable-placeholder {
  background: transparent;
  border: 1px dashed @gray-8;
  margin-bottom: 5px;
  border-radius: 5px;
}

.umb-group-builder__no-data-text {
  padding-top: 50px;
  font-size: 16px;
  line-height: 1.8em;
  color: @gray-7;
  text-align: center;
}

input.umb-group-builder__group-sort-value {
  margin-bottom: 0;
  margin-left: auto;
}


/* ---------- DIALOGS ---------- */

.show-validation .edit-property-settings .ng-invalid-val-required-component .editor-placeholder {
   border-color: @red;
   color: @red;
}

.content-type-editor-dialog.edit-property-settings {

    .validation-wrapper {
        position: relative;
    }

    .validation-label {
        position: absolute;
        top: 50%;
        right: 0;
        font-size: 12px;
        color: @red;
        transform: translate(0, -50%);
    }

    textarea.editor-label {
        border-color: transparent;
        box-shadow: none;
        width: 100%;
        box-sizing: border-box;
        margin-bottom: 0;
        font-size: 16px;
        font-weight: bold;
        resize: none;
        line-height: 1.5em;
        padding: 0;
        border: none;

        &:focus {
            outline: none;
            box-shadow: none !important;
        }
    }

    .editor-placeholder-button {
      .umb-button__button {
        height: 80px;
      }
    }

    .editor-placeholder {
        border: 1px dashed @ui-action-border;
        width: 100%;
        height: 80px;
        line-height: 80px;
        text-align: center;
        display: block;
        border-radius: 5px;
        font-weight: bold;
        font-size: 14px;
        color: @ui-action-type;

        &:hover {
            text-decoration: none;
            color: @ui-action-type-hover;
            border-color: @ui-action-border-hover;
            background-color: @ui-action-discreet-hover;
        }
    }

    .editor-wrapper {
        margin-bottom: 10px;
    }

    .editor {
        display: flex;
        align-items: center;
        align-content: stretch;
        min-height: 80px;
        border: 1px solid @gray-9;
        color: @ui-action-discreet-type;
        border-radius: @baseBorderRadius;
    }

    .editor-info {
        flex: 1 1 auto;
        text-align: left;
        display: flex;
        align-items: center;
        min-height: 80px;
        color: @ui-action-discreet-type;
    }

    button.editor-info {
      &:hover {
        color: @ui-action-discreet-type-hover;
        background-color: @ui-action-discreet-hover;
      }
    }

    .editor-icon-wrapper {
        display: flex;
        justify-content: center;
        align-items: center;
        width: 60px;
        height: 60px;
        text-align: center;
        line-height: 60px;
        flex: 0 0 60px;
        padding-left: 10px;

        .icon {
            font-size: 32px;
            line-height: 1;
        }
    }

    .editor-details {
        flex: 1 1 auto;
        margin-top: 10px;
        margin-bottom: 10px;

        .editor-name {
            display: block;
            font-weight: bold;
        }

        .editor-editor {
            display: block;
            font-size: 12px;
        }
    }

    .editor-remove-icon {
        flex: 0 0 48px;
        width: 48px;
        height: 48px;
        font-size: 18px;
        min-height: 80px;
        color: @ui-action-discreet-type;

        &:hover {
          color: @ui-action-discreet-type-hover;
          background-color: @ui-action-discreet-hover;
        }

        &:disabled {
          cursor: not-allowed;
          background: @sand-5;
          opacity: 0.6;
          color: @black;

          &:hover {
            background: @sand-5;
            color: @black;
          }
        }
    }

    .checkbox {
        margin-bottom: 20px;
    }

    .editor-description {
        margin-top: 20px;
        padding: 0;
    }

    .editor-description,
    .editor-validation-pattern {
        min-width: 100%;
        min-height: 25px;
        resize: none;
        box-sizing: border-box;
        border: none;
        overflow: hidden;
    }

    .editor-validation-message {
        min-width: 100%;
        min-height: 25px;
        margin-top: 4px;
    }

    .editor-validation-pattern {
        border: 1px solid @gray-7;
        margin: 10px 0 0;
        padding: 6px;
        max-height: 32px;
    }

    .umb-dropdown {
        width: 100%;
    }

    label.checkbox.no-indent {
        width: 100%;
    }
}

// Convert to tab dropzone
.umb-group-builder__convert-dropzone {
    display: inline-flex;
  border: 1px dashed @gray-7;
  align-items: center;
  justify-content: center;
  padding: 2px 15px;
  border-radius: @baseBorderRadius;
  // Hack for hiding as a droppable element:
  visibility: hidden;
  position: absolute;

  &.ui-droppable-hover {
    border-color: @black;
  }

  &.ui-droppable-active {
    visibility: visible;
    position: relative;
  }
}
