@use '../global/common' as global;

@keyframes nested-item-added {
  from {
    opacity: 0;
    transform: translateY(-5px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.acms-nested-items {
  margin-bottom: -5px;
}

.acms-nested-item {
  display: flex;
  flex-direction: column;
  row-gap: 10px;
  padding: 6px;
  margin-bottom: 5px;
  font-size: 13px;
  background-color: global.$acms-color-gray20;
  border-radius: 2px;
  transition:
    background-color 0.3s,
    opacity 0.3s linear;
  animation-name: nested-item-added;
  animation-duration: 0.3s;
  animation-timing-function: ease-out;
}

.acms-nested-item-inner {
  display: flex;
  flex-direction: column;
  gap: 10px 0;
}

.acms-nested-item-child {
  display: flex;
  flex: 1;
  align-items: center;
  padding: 0 10px;

  > * {
    width: 100%;
  }
}

.acms-nested-item-media {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  justify-content: flex-start;

  .acms-media-field-preview {
    height: 95px;
  }

  .acms-media-unit-preview-wrap {
    padding: 0;
  }
}

.acms-nested-item-child-checkbox {
  display: inline-flex;
  flex: initial;
  align-items: center;
}

.acms-nested-item-child-link {
  flex: 2;
}

.acms-nested-item-actions {
  display: flex;
  gap: 10px;
  padding: 0 10px;
}

.acms-nested-item-handle {
  padding: 0 10px;
}

.acms-nested-item-detail {
  padding-left: 0;
}

.acms-nested-private > .acms-nested-item {
  opacity: 0.66;
}

.acms-nested-item .nestable-icon {
  width: auto;
  height: auto;
  margin-right: 0;
  font-style: normal;
  background-image: none;
}

.acms-nested-collapse-btn {
  padding: 3px 6px;
}

.acms-nested-item .nestable-icon.nestable-icon--plus-gray::before {
  display: block;
  width: 15px;
  height: 15px;
  font-size: 15px;
  content: '+';
}

.acms-nested-item .nestable-icon.nestable-icon--minus-gray::before {
  display: block;
  width: 15px;
  height: 15px;
  font-size: 15px;
  content: '-';
}

.acms-nested-selected > .acms-nested-item {
  background-color: global.$acms-color-gray80;
}

.acms-nested-dragging {
  opacity: 0.5;
}

.acms-nested-dragging .acms-nested-item-handle {
  cursor: grabbing;
}

@include global.media-breakpoint-up(md) {
  .acms-nested-item-inner {
    flex-direction: row;
    gap: 0 10px;
  }

  .acms-nested-item-child,
  .acms-nested-item-handle,
  .acms-nested-item-media,
  .acms-nested-item-actions {
    padding: 0;
  }

  .acms-nested-item-detail {
    padding-left: 114px;
  }
}
