@import "../../../variables";

.lzb-constructor-controls {
  margin-top: -10px;
  margin-bottom: 80px;
}

.lzb-constructor-controls-item,
.lzb-constructor-controls-item-appender {
  position: relative;
  z-index: 1;
  padding: 20px 25px;
  margin-top: 15px;
  color: $color_dark_darken;
  cursor: pointer;
  background-color: #fff;
  border-radius: $radius_box;
  box-shadow: rgba(#000, 0.1) 0 1px 3px 0, rgba(#000, 0.06) 0 1px 2px 0;
  transition: 0.15s background-color ease-in-out, 0.15s color ease-in-out, 0.15s border-color ease-in-out, 0.15s box-shadow ease-in-out;
}

// appender
.lzb-constructor-controls-item-appender {
  display: block;
  width: 100%;
  padding: 18px 25px;
  color: $color_dark_lighten;
  background: $color_gray_lighten_2;
  border: 1px dashed $color_gray_darken;
  outline: none;
  box-shadow: none;

  &:hover {
    color: $color_dark_darken;
    background: #fff;
    border-color: $color_dark_lighten_2;
  }

  svg {
    display: block;
    margin: 0 auto;
  }
}

// head
.lzb-constructor-controls-item {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  padding-left: 60px;

  &:hover {
    box-shadow: rgba(#000, 0.1) 0 0px 0px 1px;
  }

  &.lzb-constructor-controls-item-selected {
    box-shadow: rgba(#000, 0.1) 0 0px 0px 1px, 0 0 0 3px $color_gray_lighten, 0 0 0 5px $blue-50;
  }

  &.lzb-constructor-controls-item-dragging {
    z-index: 2;
    box-shadow: 0 0 0 1px $color_gray_darken, 0 5px 15px 0 $color_gray_darken;
  }

  &.lzb-constructor-controls-item-undefined {
    background-image: linear-gradient(45deg, rgba(0, 0, 0, 15%) 25%, transparent 25%, transparent 50%, rgba(0, 0, 0, 15%) 50%, rgba(0, 0, 0, 15%) 75%, transparent 75%, transparent);
    filter: opacity(0.4) saturate(0);
    background-size: 6px 6px;
  }

  > div {
    flex: 1;
  }

  // icon
  .lzb-constructor-controls-item-icon {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 65px;
    color: $color_dark_darken;
    cursor: grab;

    &::after {
      position: absolute;
      top: 15px;
      right: 15px;
      bottom: 15px;
      left: 15px;
      z-index: -1;
      display: block;
      content: "";
      background-color: $color_gray_lighten;
      border-radius: 30px;
      box-shadow: inset rgb(0 0 0 / 5%) 0 1px 2px 0;
    }

    svg {
      width: 1.5em;
      height: 1.5em;
    }

    > span {
      position: absolute;
      top: 0;
      display: flex;
      align-items: center;
      justify-content: center;
      width: 100%;
      height: 100%;
      transition: 0.15s opacity ease-in-out, 0.15s transform ease-in-out;

      + span {
        opacity: 0;
        transform: scale(0.5);
      }
    }

    .lzb-constructor-controls-item-dragging > &,
    &:hover {
      > span {
        opacity: 0;
        transform: scale(0.5);

        + span {
          opacity: 1;
          transform: translateY(0);
        }
      }
    }
  }

  // drag icon
  .lzb-constructor-controls-item-handler {
    z-index: 1;
  }

  .lzb-constructor-controls-item-label-text {
    display: block;
    font-weight: 600;
    transition: 0.15s transform ease-in-out;

    .lzb-constructor-controls-item-label-no {
      opacity: 0.3;
    }

    .required {
      margin-left: 5px;
    }
  }

  .lzb-constructor-controls-item-label-buttons {
    position: absolute;
    bottom: 20px;
    display: block;
    opacity: 0;
    transition: 0.15s opacity ease-in-out, 0.15s transform ease-in-out;

    button {
      display: inline-flex;
      align-items: center;
      padding: 0;
      margin-right: 5px;
      font-size: 0.8em;
      color: inherit;
      cursor: pointer;
      background: none;
      border: none;
      opacity: 0.5;
      transition: 0.15s opacity ease-in-out;

      &:hover {
        opacity: 1;
      }

      svg {
        width: 1em;
        height: 1em;
        margin-right: 0.2em;
      }
    }

    .lzb-constructor-controls-item-label-buttons-remove {
      color: $alert-red;
    }
  }

  small {
    font-size: 80%;
    color: $color_dark_lighten;
  }
}

.lzb-constructor-controls-item:hover,
.lzb-constructor-controls-item:focus,
.lzb-constructor-controls-item-selected {
  > .lzb-constructor-controls-item-label {
    .lzb-constructor-controls-item-label-text {
      transform: translateY(-7px);
    }

    .lzb-constructor-controls-item-label-buttons {
      opacity: 1;
      transform: translateY(12px);
    }
  }
}

.lzb-constructor-controls-item-name {
  position: relative;
  display: flex;
  align-items: center;
  align-self: center;
  padding: 3px 10px;
  font-size: 80%;
  font-weight: 600;
  color: $color_dark_darken;
  cursor: pointer;
  background-color: $color_gray_lighten;
  border: none;
  border-radius: 20px;
  outline: 0;
  transition: 0.15s color ease-in-out, 0.15s background-color ease-in-out, 0.15s box-shadow ease-in-out;

  &:hover,
  &:focus {
    background-color: #fff;
    box-shadow: rgba(0, 0, 0, 20%) 0 0 0 1px, rgba(0, 0, 0, 10%) 0 2px 4px 0;
  }

  svg {
    width: 1em;
    height: 1em;
    margin-left: 0.4em;
  }
}

// repeater child items.
.lzb-constructor-controls-item-childs {
  padding-left: 20px;
}

// repeater toggle child button.
.lzb-constructor-controls-item-repeater-toggle {
  position: relative;
  display: block;
  width: 100%;
  padding: 9px;
  padding-left: 20px;
  margin-top: 3px;
  margin-bottom: -11px;
  font-size: 80%;
  color: $color_dark_lighten;
  text-align: left;
  cursor: pointer;
  background: none;
  border: none;
  outline: none;
  transition: 0.15s color;

  &:hover {
    color: $color_dark_darken;
  }

  > svg {
    height: 0.7em;
    margin-left: 0.5em;
    vertical-align: -0.05em;
  }

  &.lzb-constructor-controls-item-repeater-toggle-collapsed > svg {
    transform: rotate(-90deg);
  }
}
