.test-instance {
  height: 100%;
  display: flex;
  flex-direction: column;
  background: #f0f2f5;

  // 顶部标签栏
  .tabs {
    background: #fff;
    border-bottom: 1px solid #e5e6eb;
    padding: 10px 24px;
    display: flex;
    align-items: center;

    .tab-left {
      display: flex;
      gap: 8px;
    }

    .tab-center {
      flex: 1;
      display: flex;
      justify-content: flex-end;
      gap: 8px;
    }

    .tab-right {
      display: flex;
      justify-content: flex-end;
      gap: 8px;
    }
  }

  // 主内容区
  .main-content {
    flex: 1;
    display: flex;
    overflow: hidden;
    background: #f0f2f5;

    // 左侧面板
    .left-panel {
      width: 280px;
      background: #fff;
      border-right: 1px solid #e5e6eb;
      display: flex;
      flex-direction: column;

      .panel-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 16px 20px;
        border-bottom: 1px solid #e5e6eb;
        font-size: 18px;
        font-weight: 700;
        color: #1d2129;

        .icon-btn {
          cursor: pointer;
          color: #4e5969;
          font-size: 16px;

          &:hover {
            color: #165dff;
          }
        }
      }

      .tree-container {
        flex: 1;
        overflow-y: auto;


        :global(.arco-collapse-item-header-title) {
          width: 100%;
        }

        .tree-list {
          .tree-item {
            display: flex;
            align-items: center;
            padding: 8px 5px;
            margin-bottom: 4px;
            border-radius: 4px;
            cursor: pointer;
            transition: background 0.2s;

            &:hover {
              background: #f2f3f5;
            }

            .item-icon {
              margin-right: 8px;
              font-size: 12px;
            }

            .item-text {
              flex: 1;
              font-size: 13px;
              color: #4e5969;
            }

            .item-actions {
              display: flex;
              gap: 8px;
              opacity: 1;
              transition: opacity 0.2s;

              svg {
                font-size: 14px;
                color: #86909c;
                cursor: pointer;

                &:hover {
                  color: #165dff;
                }
              }
            }
          }
        }
      }
    }

    // 中间流程图区域
    .center-panel {
      flex: 1.5;
      display: flex;
      align-items: flex-start;
      justify-content: center;
      padding: 40px 80px;
      overflow: auto;

      .flow-wrapper {
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 0;

        .flow-node {
          display: flex;
          flex-direction: row;
          align-items: center;

          .node-box {
            background: #fff;
            border-radius: 10px;
            box-shadow: 0 2px 16px rgba(0, 0, 0, 0.12);
            min-width: 280px;

            .node-header {
              display: flex;
              align-items: center;
              gap: 10px;
              padding: 14px 18px;
              border-bottom: 1px solid #e5e6eb;

              .node-icon {
                font-size: 20px;
              }

              .node-title {
                font-size: 17px;
                font-weight: 500;
                color: #1d2129;
              }
            }

            .node-label {
              padding: 10px 18px;
              font-size: 14px;
              color: #86909c;
              text-align: center;
            }

            &.node-start {
              .node-header {
                background: #5a6c7d;
                color: #fff;
                border-radius: 10px 10px 0 0;

                .node-title {
                  color: #fff;
                }
              }
            }

            &.node-end {
              .node-header {
                background: #5a6c7d;
                color: #fff;
                border-radius: 10px 10px 0 0;

                .node-title {
                  color: #fff;
                }
              }
            }

            &.node-component {
              .node-header {
                background: #ffb800;
                color: #fff;
                border-radius: 10px 10px 0 0;

                .node-title {
                  color: #fff;
                }
              }

              .node-body {
                padding: 16px;

                .node-function {
                  display: flex;
                  align-items: center;
                  gap: 8px;
                  font-size: 15px;
                  font-weight: 500;
                  color: #1d2129;
                  margin-bottom: 10px;
                  opacity: 0.4;
                  transition: opacity 0.3s;

                  .function-dot {
                    width: 10px;
                    height: 10px;
                    border-radius: 50%;
                    background: #86909c;
                    flex-shrink: 0;
                    transition: background 0.3s;
                  }

                  &.active {
                    opacity: 1;

                    .function-dot {
                      background: #165dff;
                    }
                  }
                }

                .node-params {
                  display: flex;
                  flex-direction: column;
                  gap: 7px;
                  margin-bottom: 8px;

                  .param-item {
                    display: flex;
                    align-items: center;
                    gap: 8px;
                    opacity: 0.4;
                    transition: opacity 0.3s;

                    .param-dot {
                      width: 8px;
                      height: 8px;
                      border-radius: 50%;
                      background: #86909c;
                      flex-shrink: 0;
                      transition: background 0.3s;
                    }

                    .param-label {
                      font-size: 14px;
                      color: #4e5969;
                    }

                    &.active {
                      opacity: 1;

                      .param-dot {
                        background: #165dff;
                      }
                    }
                  }
                }

                .param-item-right {
                  display: flex;
                  align-items: center;
                  justify-content: flex-end;
                  gap: 8px;
                  margin-bottom: 7px;
                  opacity: 0.4;
                  transition: opacity 0.3s;

                  .param-dot {
                    width: 8px;
                    height: 8px;
                    border-radius: 50%;
                    background: #86909c;
                    flex-shrink: 0;
                    transition: background 0.3s;
                  }

                  .param-label {
                    font-size: 14px;
                    color: #4e5969;
                  }

                  &.active {
                    opacity: 1;

                    .param-dot {
                      background: #165dff;
                    }
                  }
                }
              }
            }
          }

          .node-connector {
            display: flex;
            flex-direction: row;
            align-items: center;
            margin: 0;

            .connector-line {
              width: 40px;
              height: 2px;
              background: #d9d9d9;
            }

            .connector-dot {
              width: 8px;
              height: 8px;
              border-radius: 50%;
              background: #d9d9d9;
              margin-left: -4px;
            }
          }
        }
      }
    }

    // 右侧面板
    .right-panel {
      flex: 1;
      background: #fff;
      border-left: 1px solid #e5e6eb;
      display: flex;
      flex-direction: column;

      .panel-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 16px 20px;
        border-bottom: 1px solid #e5e6eb;
        font-size: 14px;
        font-weight: 500;
        color: #1d2129;

        .header-actions {
          display: flex;
          gap: 12px;

          .icon-btn {
            cursor: pointer;
            font-size: 16px;
            opacity: 0.6;
            transition: opacity 0.2s;

            &:hover {
              opacity: 1;
            }
          }
        }
      }

      .log-content {
        flex: 1;
        overflow-y: auto;
        padding: 20px;

        .log-empty {
          text-align: center;
          color: #86909c;
          font-size: 13px;
          line-height: 1.8;
          padding-top: 40px;

          p {
            margin: 8px 0;
          }
        }

        .log-list {
          display: flex;
          flex-direction: column;
          gap: 4px;

          .log-item {
            padding: 8px 12px;
            background: #f7f8fa;
            border-radius: 4px;
            font-size: 12px;
            font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
            color: #4e5969;
            line-height: 1.6;
            word-break: break-all;
            white-space: pre-wrap;
          }
        }
      }
    }
  }
}
