@use './variables.scss';

#scenegraph {
  display: flex;
  flex-direction: column;
  overflow: auto;
  padding-top: 32px;
  width: auto;

  // Layers container
  .layers {
    margin-top: 72px;
    overflow-y: auto;
    height: 512px; // 584px - 72px
  }

  // Layer block styling
  .layersBlock {
    display: flex;
    align-items: center;
    column-gap: 8px;
  }

  // Layer styling
  .layer {
    width: 100%;
    margin-top: 6px;
    margin-bottom: 6px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: flex-start;

    &:not(.active):hover {
      outline: 2px solid variables.$purple-900;
      > div:first-child {
        background: none;
      }
    }

    &.active {
      background: variables.$purple-300;
      &:hover {
        background: variables.$purple-900;
      }
    }
  }

  // Entity styling
  .entity {
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    padding: 3px;
    width: 100%;
    white-space: nowrap;

    &:focus {
      background: variables.$purple-900;
      border: 1px solid variables.$white;
    }

    &:hover {
      background: variables.$purple-900;
    }

    &:first-child {
      margin: 0px !important;
      &:hover {
        background: variables.$purple-900;
      }
    }

    &.option {
      display: flex;
      flex-direction: column;
      width: 100%;
      flex: none;
      order: 1;
      flex-grow: 0;
      height: 40px;
      justify-content: center;
      padding: 0 16px;
      box-sizing: border-box;

      > span {
        display: flex;
        justify-content: flex-start;
        align-items: center;
        flex-direction: row;
        position: relative;
      }

      &.active {
        background: variables.$purple-900;

        .id {
          color: variables.$white;
        }
      }
    }

    &.disabled {
      background: variables.$purple-600;
      color: variables.$white;
      padding: 10.5px 16px 10.5px 14.5px;

      .component:hover {
        color: #1888c1;
      }

      .entityActions {
        display: inline;
      }
    }

    &.novisible {
      box-sizing: border-box;

      &.disabled {
        background: variables.$gray-200;
      }

      &:focus {
        border: 1px solid variables.$white;
      }

      &.active,
      &:not(.active) {
        span,
        .id {
          color: variables.$lightgray-700;
        }
      }

      &:first-child ~ .entity .entityName {
        color: variables.$lightgray-700;
      }

      &.active:first-child ~ .entity .entityName {
        color: variables.$lightgray-700;
      }
    }
  }

  // Component hover effect
  .component:hover {
    color: variables.$blue-100;
  }

  // Entity icons and actions
  .entityIcons {
    margin-left: 2px;
  }

  .entityActions {
    display: none;
    margin: 0 14px;

    .button {
      color: variables.$white;
      font-size: 12px;
      margin-left: 6px;
    }

    .fa:hover {
      color: variables.$blue-100;
    }
  }

  // Font awesome icons
  .fa {
    color: variables.$lightgray-600;
  }

  .fa-trash,
  .fa-clone {
    display: none;
  }

  .active .fa {
    color: variables.$white-100;
  }

  .fa-eye,
  .fa-eye-slash {
    color: variables.$lightgray-300;
    background-repeat: no-repeat;
    background-size: contain;
    background-position: center;
    width: 15px;
    height: 15px;

    &:before {
      content: none;
    }
  }

  .fa-eye {
    background-image: url(variables.$faEye);
  }

  .fa-eye-slash {
    background-image: url(variables.$faEyeSlash) !important;
  }

  // ID styling
  .id {
    color: variables.$lightgray-600;
  }

  // Collapse space styling
  .collapsespace {
    color: variables.$white !important;
    display: inline-block;
    text-align: center;
    width: 14px;
    right: 0px;
    position: absolute;
    z-index: 1;

    &::before {
      content: '';
      position: absolute;
      top: 50%;
      left: 50%;
      transform: translate(-45%, -50%);
      width: 20px;
      height: 20px;
      background: variables.$darkgray-800;
      border-radius: 50%;
      z-index: -1;
    }
  }

  // Icons and buttons
  .icons a.button {
    color: variables.$white;
  }

  // Search functionality
  .search {
    display: none;
    padding: 5px;
    font-size: 16px;
    position: relative;

    input {
      color: variables.$lightgray-100;
      background: variables.$darkgray-200;
      border-radius: 5px;
      height: 22px;
      text-indent: 10px;
      width: 216px;
    }

    .fa-search {
      position: absolute;
      right: 14px;
      top: 8px;
    }

    .fa-times {
      position: absolute;
      right: 15px;
      top: 9px;
    }
  }

  // Outliner component
  .outliner {
    color: variables.$lightgray-100;
    cursor: default;
    font-size: 16px;
    outline: none;
    overflow: hidden;
    position: absolute;
    top: 80px;
    width: 372px;
    height: 584px;
    align-items: center;
    padding: 0;
    background: variables.$darkgray-800;
    border-radius: 0 8px 8px 0;
    transition: all 0.3s ease-in-out;
    cursor: pointer;

    // Layers title section
    #layers-title {
      justify-content: flex-start;
      border-top-right-radius: 8px;
      display: flex;
      align-items: center;

      #toggle-leftbar {
        width: 52px;
        height: 60px;
        display: flex;
        justify-content: center;
        align-items: center;
        cursor: pointer;

        .move-icon {
          translate: 15px 0px;
        }

        &:hover {
          background-color: variables.$purple-900;
          .move-icon {
            translate: 0px 0px;
          }
        }

        &:active {
          background-color: variables.$darkpurple;
        }
      }
    }

    // Hidden state
    &.hide {
      width: 52px;
      height: 60px;
      border-radius: 0 12px 12px 0;

      #layers-title {
        width: 52px;
        height: 60px;
        display: flex;
        border-radius: 0 12px 12px 0;

        span {
          display: none;
        }

        .toggle-icon {
          display: none;
        }

        &:hover {
          width: 155px;
          background-color: variables.$purple-900;

          span {
            display: block;
            font-size: 22px;
          }
        }
      }
    }
  }
}

// Bottom section of scenegraph
.scenegraph-bottom {
  background-color: variables.$darkgray-900;
  border-top: 1px solid variables.$black-200;
  bottom: 10px;
  height: 40px;
  left: 0;
  z-index: 100;

  a {
    float: right;
    margin: 10px;
  }
}
