.field-management-popup {
  width: 280px;
  max-height: 500px;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.field-management-search {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-bottom: 1px solid #f0f0f0;
}

.field-management-search-icon {
  color: #999;
  flex-shrink: 0;
}

.field-management-search-input {
  flex: 1;

  &.cn-ui-input {
    border: none;
    background: transparent;
    box-shadow: none;

    &:hover,
    &:focus,
    &.cn-ui-input-focus {
      border: none;
      box-shadow: none;
    }

    input {
      background: transparent;
    }
  }
}

.field-management-list {
  flex: 1;
  overflow-y: auto;
  max-height: 340px;

  // 隐藏滚动条
  scrollbar-width: none; // Firefox
  -ms-overflow-style: none; // IE/Edge

  &::-webkit-scrollbar {
    display: none; // Chrome/Safari/Opera
  }
}

// 固定列区域
.field-management-pinned-area {
  min-height: 32px;
  border-bottom: 1px solid #f0f0f0;
}

.field-management-pinned-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  font-size: 12px;
  color: #bfbfbf;
  border: 1px dashed #d9d9d9;
  border-radius: 4px;
  margin: 4px 8px;
}

// 非固定列区域
.field-management-unpinned-area {
  transition: background-color 0.2s;

  &.field-management-unpinned-area-highlight {
    background-color: rgba(24, 144, 255, 0.04);
  }
}

.field-management-item {
  display: flex;
  align-items: center;
  padding: 6px 12px;
  gap: 6px;
  transition:
    background-color 0.2s,
    opacity 0.2s;
  cursor: default;

  &:hover {
    background-color: #f5f5f5;
  }

  &.field-management-item-dragging {
    opacity: 0.5;
    background-color: #e6f7ff;
  }

  // 隐藏字段透明度 30%
  &.field-management-item-hidden {
    opacity: 0.3;

    &:hover {
      opacity: 0.5;
    }
  }

  // 唯一固定字段样式
  &.field-management-item-only-pinned {
    background-color: #fafafa;

    .field-management-item-drag-handle {
      cursor: not-allowed;
      opacity: 0.3;
    }
  }
}

.field-management-item-drag-handle {
  display: flex;
  align-items: center;
  color: #999;
  cursor: grab;
  padding: 4px;
  margin-left: -4px;

  &:active {
    cursor: grabbing;
  }

  &.field-management-item-drag-handle-disabled {
    cursor: not-allowed;
    opacity: 0;
  }
}

.field-management-item-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  flex-shrink: 0;

  img {
    width: 16px;
    height: 16px;
  }

  .cn-ui-icon {
    font-size: 14px;
    color: #666;
  }
}

.field-management-item-name {
  flex: 1;
  font-size: 14px;
  color: #333;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.field-management-item-pin {
  display: flex;
  align-items: center;
  color: var(--color-primary-hover, #203c99);
  font-size: 12px;
  margin-right: 4px;
}

.field-management-item-lock {
  display: flex;
  align-items: center;
  color: #999;
  font-size: 12px;
}

.field-management-item-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.field-management-item-visibility {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  cursor: pointer;
  color: #999;
  border-radius: 4px;
  transition: all 0.2s;

  &:hover {
    background-color: #e8e8e8;
    color: #666;
  }

  &.field-management-item-visibility-off {
    color: #bfbfbf;
  }

  &.field-management-item-visibility-disabled {
    cursor: not-allowed;
    opacity: 0.3;
    pointer-events: none;
  }
}

.field-management-item-more {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  cursor: pointer;
  color: #999;
  border-radius: 4px;
  transition: all 0.2s;

  &:hover {
    background-color: #e8e8e8;
    color: #666;
  }
}

.field-management-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-top: 1px solid #f0f0f0;
  background-color: #fafafa;
}

.field-management-footer-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.field-management-footer-action {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: #666;
  cursor: pointer;
  transition: color 0.2s;

  &:hover {
    color: var(--color-primary-hover, #203c99);
  }

  .cn-ui-icon {
    font-size: 12px;
  }
}

.field-management-add-field {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: #666;
  cursor: pointer;
  transition: background 0.2s;
  padding: 4px 6px;
  border-radius: 4px;

  &:hover {
    background: var(--cnai-color-bg-hover, #dedfe7);
    color: inherit;
  }
}

// 更多操作的下拉菜单样式
.field-management-more-menu {
  min-width: 120px;
  padding: 4px 0;
  background: #fff;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.field-management-more-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  font-size: 14px;
  color: #333;
  cursor: pointer;
  transition: background-color 0.2s;

  &:hover {
    background-color: #f5f5f5;
  }

  &.field-management-more-menu-item-danger {
    color: #ff4d4f;

    &:hover {
      background-color: #fff1f0;
    }
  }

  .cn-ui-icon {
    font-size: 14px;
  }
}

// 拖拽预览样式
.field-management-drag-overlay {
  background: #fff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  border-radius: 4px;
  padding: 8px 16px;
  display: flex;
  align-items: center;
  gap: 8px;

  .field-management-item-icon {
    flex-shrink: 0;
  }

  .field-management-item-name {
    flex: 1;
  }
}

.field-management-drag-overlay-pin-hint {
  display: flex;
  align-items: center;
}
