.agents-page {
  min-width: 1024px;
}

.agents-resource-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 16px;
}

.agents-resources > .ant-alert {
  margin-bottom: 16px;
}

.agents-resource-detail {
  .ant-descriptions,
  .agents-resource-section {
    margin-bottom: 24px;
  }

  .ant-descriptions-item-label {
    width: 180px;
  }

  .ant-descriptions-item-content {
    overflow-wrap: anywhere;
    white-space: pre-wrap;
  }
}

.agents-resource-json {
  margin: 0;
  padding: 12px;
  border: 1px solid #f0f0f0;
  border-radius: 4px;
  background: #fafafa;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.agents-page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 8px;

  .ant-typography {
    margin-bottom: 4px;
  }
}

.agents-agent-control {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 4px;
}

.agents-agent-selector {
  width: 360px;
}

.agents-agent-source {
  margin-bottom: 16px;
}

.agents-agent-option,
.agents-project-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;

  > span:first-child {
    display: flex;
    min-width: 0;
    flex-direction: column;
  }
}

.agents-workspace {
  display: grid;
  min-height: calc(100vh - 300px);
  overflow: hidden;
  border: 1px solid #f0f0f0;
  background: #fff;
  grid-template-columns: auto 8px minmax(680px, 1fr);
}

.agents-browser {
  min-width: 0;
  overflow: auto;
}

.agents-browser-resizer {
  position: relative;
  cursor: col-resize;
  outline: none;
  touch-action: none;

  &::after {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 1px;
    background: #f0f0f0;
    content: '';
    transform: translateX(-50%);
  }

  &:hover::after,
  &:focus::after,
  &:active::after {
    background: #1890ff;
  }
}

.agents-browser-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px;
}

.agents-project-actions {
  .ant-space-item,
  .ant-btn {
    display: flex;
    align-items: center;
  }

  .ant-btn {
    height: 24px;
    justify-content: center;
    line-height: 1;
  }
}

.agents-project-selector {
  width: calc(100% - 24px);
  margin: 0 12px 12px;
}

.agents-tree-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 8px 12px;
  border-top: 1px solid #f0f0f0;
  border-bottom: 1px solid #f0f0f0;
}

.agents-browser .ant-tree {
  min-width: 100%;
  padding: 8px;
}

.agents-browser .ant-tree-node-content-wrapper {
  display: flex;
  min-width: 0;
  align-items: center;

  .ant-tree-iconEle {
    flex: none;
  }

  .ant-tree-title {
    min-width: 0;
    flex: 1;
  }
}

.agents-tree-loading {
  display: block;
  margin: 32px auto;
}

.agents-tree-node-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
  width: 100%;
}

.agents-tree-node-name {
  min-width: 0;
  flex: 1;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agents-tree-node-more {
  visibility: hidden;
  flex: none;
}

.ant-tree-node-content-wrapper:hover .agents-tree-node-more,
.ant-tree-node-content-wrapper:focus .agents-tree-node-more,
.agents-tree-node-more:focus {
  visibility: visible;
}

.agents-tree-inline-action {
  height: auto;
  padding: 0;
}

.agents-file-panel {
  min-width: 0;
  overflow: hidden;
  padding: 16px;
}

.agents-file-panel > .ant-empty,
.agents-file-panel > .ant-result {
  margin-top: 80px;
}

.agents-editor {
  display: flex;
  height: 100%;
  min-height: 480px;
  flex-direction: column;
}

.agents-file-header {
  padding-bottom: 12px;
  border-bottom: 1px solid #f0f0f0;
}

.agents-file-title-row,
.agents-file-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.agents-file-meta-row {
  margin-top: 12px;
}

.agents-file-title {
  display: flex;
  min-width: 0;
  align-items: center;
  flex: 1;
  gap: 8px;
}

.agents-file-path {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agents-file-tags,
.agents-file-actions {
  flex: none;
}

.agents-file-tags .ant-tag {
  margin-right: 0;
}

.agents-code-editor {
  min-height: 360px;
  overflow: auto;
  flex: 1;
  margin-top: 12px;
  border: 1px solid #f0f0f0;

  .cm-editor {
    min-height: 360px;
  }
}

.agents-directory-picker {
  max-height: 420px;
  overflow: auto;
  margin-bottom: 16px;
  padding: 12px;
  border: 1px solid #f0f0f0;
}
