/**
 * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
 * SPDX-License-Identifier: MIT
 */

.dataStructureViewer {
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  font-size: 14px;
  line-height: 1.5;
  color: #333;
  background: #fafafa;
  border-radius: 6px;
  padding: 12px 12px 12px 0;
  margin: 12px;
  border: 1px solid #e1e4e8;
  overflow: hidden;

  .treeNode {
    margin: 2px 0;

    &Header {
      display: flex;
      align-items: flex-start;
      gap: 4px;
      min-height: 20px;
      padding: 2px 0;
      border-radius: 3px;
      transition: background-color 0.15s ease;

      &:hover {
        background-color: rgba(0, 0, 0, 0.04);
      }
    }

    &Children {
      margin-left: 8px;
      padding-left: 8px;
      position: relative;

      &::before {
        content: '';
        position: absolute;
        left: 0;
        top: 0;
        bottom: 0;
        width: 1px;
        background: #e1e4e8;
      }
    }
  }

  .expandButton {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 10px;
    color: #666;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 2px;
    transition: all 0.15s ease;
    padding: 0;
    margin: 0;

    &:hover {
      background-color: rgba(0, 0, 0, 0.1);
      color: #333;
    }

    &.expanded {
      transform: rotate(90deg);
    }

    &.collapsed {
      transform: rotate(0deg);
    }
  }

  .expandPlaceholder {
    width: 16px;
    height: 16px;
    display: inline-block;
    flex-shrink: 0;
  }

  .nodeLabel {
    color: #0969da;
    font-weight: 500;
    cursor: pointer;
    user-select: auto;
    margin-right: 4px;

    &:hover {
      text-decoration: underline;
    }
  }

  .nodeValue {
    margin-left: 4px;
  }

  .primitiveValue {
    cursor: pointer;
    user-select: all;
    padding: 1px 3px;
    border-radius: 3px;
    transition: background-color 0.15s ease;

    &:hover {
      background-color: rgba(0, 0, 0, 0.05);
    }

    &Quote {
      color: #8f8f8f;
    }

    &.string {
      color: #032f62;
      background-color: rgba(3, 47, 98, 0.05);
    }

    &.number {
      color: #005cc5;
      background-color: rgba(0, 92, 197, 0.05);
    }

    &.boolean {
      color: #e36209;
      background-color: rgba(227, 98, 9, 0.05);
    }

    &.null,
    &.undefined {
      color: #6a737d;
      font-style: italic;
      background-color: rgba(106, 115, 125, 0.05);
    }
  }
}
