@use '../../../../../styles/typography';

:host {
  position: relative;
  color: var(--color-tree-node-element-name);
  cursor: default;
  @extend %monospaced;
  white-space: nowrap;
  text-overflow: ellipsis;
  display: block;

  &:hover {
    background-color: var(--color-tree-node-hovered);
  }

  &.selected,
  &.highlighted {
    background-color: var(--color-tree-node-highlighted);
  }

  &.new-node {
    animation: appear 1.5s;
  }

  .non-element {
    color: var(--color-tree-node-non-element-name);
  }

  .tree-node-info {
    display: flex;

    & > button {
      outline: none;
      border: 0;
      padding: 0;
      position: absolute;
      background-color: transparent;
      top: 2px;
    }

    .mat-icon {
      font-size: 0.8em;
      width: 16px;
      height: 13px;
      display: inline-block;
      color: var(--primary-contrast);
    }

    .node-name {
      position: relative;

      .angular-element {
        content: '';
        color: var(--color-tree-node-ng-element);

        &::before {
          content: '<';
        }

        &::after {
          content: '/>';
        }
      }

      .dir-names {
        color: var(--color-tree-node-dir-name);
      }

      .matched-text {
        position: absolute;
        top: 0;
        left: 0;
        color: transparent;
        pointer-events: none;

        mark {
          background: var(--color-tree-node-matched);
          color: var(--full-contrast);
          border-radius: 2px;
        }
      }
    }

    .console-reference {
      display: none;
    }

    .console-reference,
    .on-push {
      color: var(--color-tree-node-console-ref);
      padding-left: 8px;
      font-style: italic;
    }

    .hydration {
      margin: auto 8px auto auto;
      font-size: 14px;
      color: var(--blue-02);

      position: sticky;
      right: 0;

      &.skipped {
        color: var(--senary-contrast);
      }

      &.mismatched {
        color: var(--red-04);
      }
    }
  }

  &.selected .console-reference {
    display: block !important;
  }

  .hydration-error {
    color: var(--dynamic-red-01);
    margin-left: 16px;
    padding: 0 8px 8px 0px;

    pre {
      margin: 0;
      background: var(--dynamic-transparent-01);
      padding: 8px;
      border-radius: 8px;

      &:not(:last-child) {
        margin-bottom: 16px;
      }
    }
  }
}

@keyframes appear {
  0% {
    background-color: transparent;
  }
  50% {
    background-color: var(--blue-04);
  }
  100% {
    background-color: transparent;
  }
}
